agentapi

package
v0.0.0-...-b5b84f9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package agentapi provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.6.1-0.20260404004943-9ea3cc79a4c7 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidUserContent = errors.New("agentapi: invalid user message content")

ErrInvalidUserContent indicates the inbound UserMessageContent cannot be turned into rt.MessageContent (e.g. empty parts).

View Source
var ErrNilSessionEvent = errors.New("agentapi: nil session event")

ErrNilSessionEvent is returned when ToStreamEvent is called with a nil *rt.SessionEvent.

Functions

func GetSwagger

func GetSwagger() (swagger *openapi3.T, err error)

GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.

func Handler

func Handler(si ServerInterface) http.Handler

Handler creates http.Handler with routing matching OpenAPI spec.

func HandlerFromMux

func HandlerFromMux(si ServerInterface, m ServeMux) http.Handler

HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.

func HandlerFromMuxWithBaseURL

func HandlerFromMuxWithBaseURL(si ServerInterface, m ServeMux, baseURL string) http.Handler

func HandlerWithOptions

func HandlerWithOptions(si ServerInterface, options StdHTTPServerOptions) http.Handler

HandlerWithOptions creates http.Handler with additional options

func PathToRawSpec

func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)

Constructs a synthetic filesystem for resolving external references when loading openapi specifications.

Types

type AgentAPIRequestMapper

type AgentAPIRequestMapper struct{}

AgentAPIRequestMapper maps OpenAPI UserMessageContent to ADK/genai inputs.

func NewAgentAPIRequestMapper

func NewAgentAPIRequestMapper() *AgentAPIRequestMapper

NewAgentAPIRequestMapper returns a request mapper for StartAgentRun and related handlers.

func (*AgentAPIRequestMapper) ToMessageContent

func (m *AgentAPIRequestMapper) ToMessageContent(uc UserMessageContent) (*rt.MessageContent, error)

ToMessageContent validates and converts API UserMessageContent to *rt.MessageContent. Empty or unusable parts return ErrInvalidUserContent (handler maps to 400).

type AgentAPISSEWriter

type AgentAPISSEWriter struct {
	// contains filtered or unexported fields
}

AgentAPISSEWriter streams RunResult as Server-Sent Events (text/event-stream).

func NewAgentAPISSEWriter

func NewAgentAPISSEWriter(mapper StreamEventMapper) *AgentAPISSEWriter

NewAgentAPISSEWriter returns an SSE response driver with the given stream-event mapper.

func (*AgentAPISSEWriter) StreamAgentRun

func (s *AgentAPISSEWriter) StreamAgentRun(ctx context.Context, w http.ResponseWriter, result *rt.RunResult) error

StreamAgentRun writes the sessionBound event, maps each session event through the injected mapper, then writes done. Headers are set for SSE; each logical event is flushed when supported.

func (*AgentAPISSEWriter) StreamSessionRead

func (s *AgentAPISSEWriter) StreamSessionRead(
	ctx context.Context, w http.ResponseWriter, output *rt.ReadSessionResult,
) error

StreamSessionRead writes the sessionBound event, sessionStatus (active/idle), maps each session event through the injected mapper, then writes done. Headers are set for SSE; each logical event is flushed when supported. The unified Events() iterator in output handles pre-run history and current-run events seamlessly — the SSE writer does not need to distinguish between them.

type AgentAPIServer

type AgentAPIServer struct {
	// contains filtered or unexported fields
}

AgentAPIServer implements ServerInterface with injected dependencies.

func NewAgentAPIServer

func NewAgentAPIServer(p ServerParams) *AgentAPIServer

NewAgentAPIServer constructs an AgentAPIServer from p.

func (*AgentAPIServer) ContinueAgentRun

func (s *AgentAPIServer) ContinueAgentRun(w http.ResponseWriter, r *http.Request, sessionID SessionId)

ContinueAgentRun implements ServerInterface.

func (*AgentAPIServer) CreateProvider

func (s *AgentAPIServer) CreateProvider(w http.ResponseWriter, r *http.Request)

CreateProvider implements ServerInterface.

func (*AgentAPIServer) DeleteProvider

func (s *AgentAPIServer) DeleteProvider(w http.ResponseWriter, r *http.Request, providerName ProviderName)

DeleteProvider implements ServerInterface.

func (*AgentAPIServer) GetProvider

func (s *AgentAPIServer) GetProvider(w http.ResponseWriter, r *http.Request, providerName ProviderName)

GetProvider implements ServerInterface.

func (*AgentAPIServer) ListProviders

func (s *AgentAPIServer) ListProviders(w http.ResponseWriter, r *http.Request)

ListProviders implements ServerInterface.

func (*AgentAPIServer) ReadSession

func (s *AgentAPIServer) ReadSession(
	w http.ResponseWriter, r *http.Request, sessionID SessionId,
)

ReadSession implements ServerInterface.

func (*AgentAPIServer) StartAgentRun

func (s *AgentAPIServer) StartAgentRun(w http.ResponseWriter, r *http.Request)

StartAgentRun implements ServerInterface. Optional request.Model is ignored for v1; see TODO(model override) when RunParams gains a model field.

func (*AgentAPIServer) UpdateProvider

func (s *AgentAPIServer) UpdateProvider(w http.ResponseWriter, r *http.Request, providerName ProviderName)

UpdateProvider implements ServerInterface.

type AgentAPIStreamEventMapper

type AgentAPIStreamEventMapper struct{}

AgentAPIStreamEventMapper maps runtime session events to OpenAPI StreamEvent payloads (SSE data JSON).

func NewAgentAPIStreamEventMapper

func NewAgentAPIStreamEventMapper() *AgentAPIStreamEventMapper

NewAgentAPIStreamEventMapper returns a stream-event mapper for the SSE driver.

func (*AgentAPIStreamEventMapper) ToStreamEvent

func (m *AgentAPIStreamEventMapper) ToStreamEvent(ev *rt.SessionEvent) (StreamEvent, error)

ToStreamEvent maps a single session event to a StreamEvent union value. It does not write HTTP or SSE frames. Events with non-empty error fields map to the error discriminator; others map to agent.

type AgentRunRequest

type AgentRunRequest struct {
	// Message User message for `POST /agent-runs` / continue run: text parts (always user role; not sent by clients).
	Message UserMessageContent `json:"message"`

	// Model Optional model name; empty selects the runtime default (`NewAgentRunnerParams.ModelName`).
	Model *string `json:"model,omitempty"`
}

AgentRunRequest defines model for AgentRunRequest.

type AgentStreamContent

type AgentStreamContent struct {
	// Parts May be empty when only metadata is present; omitting `content` entirely is allowed when there is no body.
	Parts []AgentStreamPart `json:"parts"`

	// Role Producer of the message; may be omitted when not set on the underlying event.
	Role *AgentStreamContentRole `json:"role,omitempty"`
}

AgentStreamContent Model output body on streamed `agent` events: text parts and optional `role` (mapped from ADK session events). `parts` may be empty when only metadata is present.

type AgentStreamContentRole

type AgentStreamContentRole string

AgentStreamContentRole Producer of the message; may be omitted when not set on the underlying event.

const (
	Model AgentStreamContentRole = "model"
	User  AgentStreamContentRole = "user"
)

Defines values for AgentStreamContentRole.

func (AgentStreamContentRole) Valid

func (e AgentStreamContentRole) Valid() bool

Valid indicates whether the value is a known member of the AgentStreamContentRole enum.

type AgentStreamEvent

type AgentStreamEvent struct {
	Author *string `json:"author,omitempty"`
	Branch *string `json:"branch,omitempty"`

	// Content Model output body on streamed `agent` events: text parts and optional `role` (mapped from ADK session events).
	// `parts` may be empty when only metadata is present.
	Content *AgentStreamContent `json:"content,omitempty"`

	// ErrorCode Present when the agent surfaced an error on the ADK session event / LLM response.
	ErrorCode    *string `json:"errorCode,omitempty"`
	ErrorMessage *string `json:"errorMessage,omitempty"`
	Event        string  `json:"event"`
	Id           *string `json:"id,omitempty"`
	Interrupted  *bool   `json:"interrupted,omitempty"`
	InvocationId *string `json:"invocationId,omitempty"`

	// Partial Incremental model output; when false and `turnComplete` is true, chunk is final for the turn.
	Partial              *bool                  `json:"partial,omitempty"`
	TurnComplete         *bool                  `json:"turnComplete,omitempty"`
	AdditionalProperties map[string]interface{} `json:"-"`
}

AgentStreamEvent Carries a slice of ADK `session.Event` / `model.LLMResponse` fields relevant to clients (text streaming, partial chunks, completion). Servers may add optional ids or metadata.

func (AgentStreamEvent) Get

func (a AgentStreamEvent) Get(fieldName string) (value interface{}, found bool)

Getter for additional properties for AgentStreamEvent. Returns the specified element and whether it was found

func (AgentStreamEvent) MarshalJSON

func (a AgentStreamEvent) MarshalJSON() ([]byte, error)

Override default JSON handling for AgentStreamEvent to handle AdditionalProperties

func (*AgentStreamEvent) Set

func (a *AgentStreamEvent) Set(fieldName string, value interface{})

Setter for additional properties for AgentStreamEvent

func (*AgentStreamEvent) UnmarshalJSON

func (a *AgentStreamEvent) UnmarshalJSON(b []byte) error

Override default JSON handling for AgentStreamEvent to handle AdditionalProperties

type AgentStreamPart

type AgentStreamPart struct {
	Text *string `json:"text,omitempty"`

	// ToolCall Tool invocation requested by the model.
	ToolCall *ToolCallData `json:"toolCall,omitempty"`

	// ToolResult Result returned by a tool invocation.
	ToolResult *ToolResultData `json:"toolResult,omitempty"`
}

AgentStreamPart A segment in streamed agent output. Exactly one of text, toolCall, or toolResult is present.

type BadRequest

type BadRequest = ProblemDetails

BadRequest RFC 9457 problem details (subset).

type Conflict

type Conflict = ProblemDetails

Conflict RFC 9457 problem details (subset).

type ContinueAgentRunJSONRequestBody

type ContinueAgentRunJSONRequestBody = AgentRunRequest

ContinueAgentRunJSONRequestBody defines body for ContinueAgentRun for application/json ContentType.

type CreateProviderJSONRequestBody

type CreateProviderJSONRequestBody = CreateProviderRequest

CreateProviderJSONRequestBody defines body for CreateProvider for application/json ContentType.

type CreateProviderRequest

type CreateProviderRequest struct {
	// ApiKey API key for authentication. Stored in plaintext (local/dev use).
	ApiKey string `json:"apiKey"`

	// BaseUrl Base URL of the provider API endpoint.
	BaseUrl string `json:"baseUrl"`

	// DisplayName Optional human-friendly label.
	DisplayName *string `json:"displayName,omitempty"`

	// Name Unique technical name (primary key). Must match `^[a-z][a-z0-9-]*$`. Immutable after creation.
	Name string `json:"name"`

	// Type Provider protocol type. Only `openai-compatible` is supported. Immutable after creation.
	Type string `json:"type"`
}

CreateProviderRequest Request body for creating a new provider configuration.

type DefaultIDGen

type DefaultIDGen struct{}

DefaultIDGen uses UUIDv7 from the standard google/uuid implementation.

func NewDefaultIDGen

func NewDefaultIDGen() *DefaultIDGen

NewDefaultIDGen creates a new DefaultGenerator.

func (*DefaultIDGen) MustNewV7

func (g *DefaultIDGen) MustNewV7() UUID

func (*DefaultIDGen) NewV7

func (g *DefaultIDGen) NewV7() (UUID, error)

type DoneEvent

type DoneEvent struct {
	Event string `json:"event"`
}

DoneEvent defines model for DoneEvent.

type IDGen

type IDGen interface {
	// MustNewV7 generates a new UUIDv7 identifier or panics on failure.
	MustNewV7() UUID

	// NewV7 generates a new UUIDv7 identifier and allows error handling.
	NewV7() (UUID, error)
}

IDGen defines the contract for generating unique identifiers.

type InternalError

type InternalError = ProblemDetails

InternalError RFC 9457 problem details (subset).

type InvalidParamFormatError

type InvalidParamFormatError struct {
	ParamName string
	Err       error
}

func (*InvalidParamFormatError) Error

func (e *InvalidParamFormatError) Error() string

func (*InvalidParamFormatError) Unwrap

func (e *InvalidParamFormatError) Unwrap() error

type MiddlewareFunc

type MiddlewareFunc func(http.Handler) http.Handler

type MockIDGen

type MockIDGen struct {
	// contains filtered or unexported fields
}

MockIDGen is a test double that returns a known sequence of ids by shifting values from an upstream generator (same approach as tools/firecrawl/internal/system/ident).

func NewMockIDGen

func NewMockIDGen() *MockIDGen

NewMockIDGen creates a MockGenerator with a default upstream DefaultGenerator.

func (*MockIDGen) MustNewV7

func (m *MockIDGen) MustNewV7() UUID

func (*MockIDGen) NewV7

func (m *MockIDGen) NewV7() (UUID, error)

type NotFound

type NotFound = ProblemDetails

NotFound RFC 9457 problem details (subset).

type ProblemDetails

type ProblemDetails struct {
	Detail               *string                `json:"detail,omitempty"`
	Instance             *string                `json:"instance,omitempty"`
	Status               *int                   `json:"status,omitempty"`
	Title                *string                `json:"title,omitempty"`
	Type                 *string                `json:"type,omitempty"`
	AdditionalProperties map[string]interface{} `json:"-"`
}

ProblemDetails RFC 9457 problem details (subset).

func (ProblemDetails) Get

func (a ProblemDetails) Get(fieldName string) (value interface{}, found bool)

Getter for additional properties for ProblemDetails. Returns the specified element and whether it was found

func (ProblemDetails) MarshalJSON

func (a ProblemDetails) MarshalJSON() ([]byte, error)

Override default JSON handling for ProblemDetails to handle AdditionalProperties

func (*ProblemDetails) Set

func (a *ProblemDetails) Set(fieldName string, value interface{})

Setter for additional properties for ProblemDetails

func (*ProblemDetails) UnmarshalJSON

func (a *ProblemDetails) UnmarshalJSON(b []byte) error

Override default JSON handling for ProblemDetails to handle AdditionalProperties

type ProviderListResponse

type ProviderListResponse struct {
	Providers []ProviderResponse `json:"providers"`
}

ProviderListResponse List of provider configurations.

type ProviderName

type ProviderName = string

ProviderName defines model for ProviderName.

type ProviderResponse

type ProviderResponse struct {
	// ApiKeyPreview Masked API key preview (e.g. `...xYz1`). Never the full key.
	ApiKeyPreview string `json:"apiKeyPreview"`

	// BaseUrl Base URL of the provider API endpoint.
	BaseUrl string `json:"baseUrl"`

	// CreatedAt ISO 8601 creation timestamp.
	CreatedAt time.Time `json:"createdAt"`

	// DisplayName Human-friendly label (may be empty).
	DisplayName *string `json:"displayName,omitempty"`

	// Name Unique technical name (primary key).
	Name string `json:"name"`

	// Type Provider protocol type.
	Type string `json:"type"`

	// UpdatedAt ISO 8601 last-update timestamp.
	UpdatedAt time.Time `json:"updatedAt"`
}

ProviderResponse A provider configuration as returned by the API (API key is masked).

type RequiredHeaderError

type RequiredHeaderError struct {
	ParamName string
	Err       error
}

func (*RequiredHeaderError) Error

func (e *RequiredHeaderError) Error() string

func (*RequiredHeaderError) Unwrap

func (e *RequiredHeaderError) Unwrap() error

type RequiredParamError

type RequiredParamError struct {
	ParamName string
}

func (*RequiredParamError) Error

func (e *RequiredParamError) Error() string

type ServeMux

type ServeMux interface {
	HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
	http.Handler
}

ServeMux is an abstraction of http.ServeMux.

type ServerInterface

type ServerInterface interface {
	// Start a new agent run
	// (POST /agent-runs)
	StartAgentRun(w http.ResponseWriter, r *http.Request)
	// List all provider configurations
	// (GET /providers)
	ListProviders(w http.ResponseWriter, r *http.Request)
	// Create a new provider configuration
	// (POST /providers)
	CreateProvider(w http.ResponseWriter, r *http.Request)
	// Delete a provider configuration by name
	// (DELETE /providers/{providerName})
	DeleteProvider(w http.ResponseWriter, r *http.Request, providerName ProviderName)
	// Get a provider configuration by name
	// (GET /providers/{providerName})
	GetProvider(w http.ResponseWriter, r *http.Request, providerName ProviderName)
	// Update a provider configuration by name
	// (PUT /providers/{providerName})
	UpdateProvider(w http.ResponseWriter, r *http.Request, providerName ProviderName)
	// Read session events (replay history and optionally tail live run)
	// (GET /sessions/{sessionId})
	ReadSession(w http.ResponseWriter, r *http.Request, sessionId SessionId)
	// Continue an agent run for an existing session
	// (POST /sessions/{sessionId}/agent-runs)
	ContinueAgentRun(w http.ResponseWriter, r *http.Request, sessionId SessionId)
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandlerFunc   func(w http.ResponseWriter, r *http.Request, err error)
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) ContinueAgentRun

func (siw *ServerInterfaceWrapper) ContinueAgentRun(w http.ResponseWriter, r *http.Request)

ContinueAgentRun operation middleware

func (*ServerInterfaceWrapper) CreateProvider

func (siw *ServerInterfaceWrapper) CreateProvider(w http.ResponseWriter, r *http.Request)

CreateProvider operation middleware

func (*ServerInterfaceWrapper) DeleteProvider

func (siw *ServerInterfaceWrapper) DeleteProvider(w http.ResponseWriter, r *http.Request)

DeleteProvider operation middleware

func (*ServerInterfaceWrapper) GetProvider

func (siw *ServerInterfaceWrapper) GetProvider(w http.ResponseWriter, r *http.Request)

GetProvider operation middleware

func (*ServerInterfaceWrapper) ListProviders

func (siw *ServerInterfaceWrapper) ListProviders(w http.ResponseWriter, r *http.Request)

ListProviders operation middleware

func (*ServerInterfaceWrapper) ReadSession

func (siw *ServerInterfaceWrapper) ReadSession(w http.ResponseWriter, r *http.Request)

ReadSession operation middleware

func (*ServerInterfaceWrapper) StartAgentRun

func (siw *ServerInterfaceWrapper) StartAgentRun(w http.ResponseWriter, r *http.Request)

StartAgentRun operation middleware

func (*ServerInterfaceWrapper) UpdateProvider

func (siw *ServerInterfaceWrapper) UpdateProvider(w http.ResponseWriter, r *http.Request)

UpdateProvider operation middleware

type ServerParams

type ServerParams struct {
	Runner                 agent.AgentRunner
	Logger                 *slog.Logger
	IDGen                  IDGen
	RequestMapper          *AgentAPIRequestMapper
	SSEWriter              *AgentAPISSEWriter
	ProvidersConfigService rt.ProvidersConfigService
}

ServerParams holds dependencies for NewAgentAPIServer. Logger must be non-nil; other fields must be non-nil for correct behavior. ProvidersConfigService is required.

type SessionBoundEvent

type SessionBoundEvent struct {
	Event string `json:"event"`

	// SessionId Use this id for `POST /sessions/{sessionId}/agent-runs`.
	SessionId string `json:"sessionId"`
}

SessionBoundEvent defines model for SessionBoundEvent.

type SessionId

type SessionId = string

SessionId defines model for SessionId.

type SessionStatusEvent

type SessionStatusEvent struct {
	Event string `json:"event"`

	// Status Whether a run is currently in progress for this session.
	Status SessionStatusEventStatus `json:"status"`
}

SessionStatusEvent defines model for SessionStatusEvent.

type SessionStatusEventStatus

type SessionStatusEventStatus string

SessionStatusEventStatus Whether a run is currently in progress for this session.

const (
	Active SessionStatusEventStatus = "active"
	Idle   SessionStatusEventStatus = "idle"
)

Defines values for SessionStatusEventStatus.

func (SessionStatusEventStatus) Valid

func (e SessionStatusEventStatus) Valid() bool

Valid indicates whether the value is a known member of the SessionStatusEventStatus enum.

type StartAgentRunJSONRequestBody

type StartAgentRunJSONRequestBody = AgentRunRequest

StartAgentRunJSONRequestBody defines body for StartAgentRun for application/json ContentType.

type StdHTTPServerOptions

type StdHTTPServerOptions struct {
	BaseURL          string
	BaseRouter       ServeMux
	Middlewares      []MiddlewareFunc
	ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

type StreamErrorEvent

type StreamErrorEvent struct {
	Code  *string `json:"code,omitempty"`
	Event string  `json:"event"`

	// Message Human-readable failure; after this, the stream may end.
	Message string `json:"message"`
}

StreamErrorEvent defines model for StreamErrorEvent.

type StreamEvent

type StreamEvent struct {
	// contains filtered or unexported fields
}

StreamEvent defines model for StreamEvent.

func (StreamEvent) AsAgentStreamEvent

func (t StreamEvent) AsAgentStreamEvent() (AgentStreamEvent, error)

AsAgentStreamEvent returns the union data inside the StreamEvent as a AgentStreamEvent

func (StreamEvent) AsDoneEvent

func (t StreamEvent) AsDoneEvent() (DoneEvent, error)

AsDoneEvent returns the union data inside the StreamEvent as a DoneEvent

func (StreamEvent) AsSessionBoundEvent

func (t StreamEvent) AsSessionBoundEvent() (SessionBoundEvent, error)

AsSessionBoundEvent returns the union data inside the StreamEvent as a SessionBoundEvent

func (StreamEvent) AsSessionStatusEvent

func (t StreamEvent) AsSessionStatusEvent() (SessionStatusEvent, error)

AsSessionStatusEvent returns the union data inside the StreamEvent as a SessionStatusEvent

func (StreamEvent) AsStreamErrorEvent

func (t StreamEvent) AsStreamErrorEvent() (StreamErrorEvent, error)

AsStreamErrorEvent returns the union data inside the StreamEvent as a StreamErrorEvent

func (StreamEvent) Discriminator

func (t StreamEvent) Discriminator() (string, error)

func (*StreamEvent) FromAgentStreamEvent

func (t *StreamEvent) FromAgentStreamEvent(v AgentStreamEvent) error

FromAgentStreamEvent overwrites any union data inside the StreamEvent as the provided AgentStreamEvent

func (*StreamEvent) FromDoneEvent

func (t *StreamEvent) FromDoneEvent(v DoneEvent) error

FromDoneEvent overwrites any union data inside the StreamEvent as the provided DoneEvent

func (*StreamEvent) FromSessionBoundEvent

func (t *StreamEvent) FromSessionBoundEvent(v SessionBoundEvent) error

FromSessionBoundEvent overwrites any union data inside the StreamEvent as the provided SessionBoundEvent

func (*StreamEvent) FromSessionStatusEvent

func (t *StreamEvent) FromSessionStatusEvent(v SessionStatusEvent) error

FromSessionStatusEvent overwrites any union data inside the StreamEvent as the provided SessionStatusEvent

func (*StreamEvent) FromStreamErrorEvent

func (t *StreamEvent) FromStreamErrorEvent(v StreamErrorEvent) error

FromStreamErrorEvent overwrites any union data inside the StreamEvent as the provided StreamErrorEvent

func (StreamEvent) MarshalJSON

func (t StreamEvent) MarshalJSON() ([]byte, error)

func (*StreamEvent) MergeAgentStreamEvent

func (t *StreamEvent) MergeAgentStreamEvent(v AgentStreamEvent) error

MergeAgentStreamEvent performs a merge with any union data inside the StreamEvent, using the provided AgentStreamEvent

func (*StreamEvent) MergeDoneEvent

func (t *StreamEvent) MergeDoneEvent(v DoneEvent) error

MergeDoneEvent performs a merge with any union data inside the StreamEvent, using the provided DoneEvent

func (*StreamEvent) MergeSessionBoundEvent

func (t *StreamEvent) MergeSessionBoundEvent(v SessionBoundEvent) error

MergeSessionBoundEvent performs a merge with any union data inside the StreamEvent, using the provided SessionBoundEvent

func (*StreamEvent) MergeSessionStatusEvent

func (t *StreamEvent) MergeSessionStatusEvent(v SessionStatusEvent) error

MergeSessionStatusEvent performs a merge with any union data inside the StreamEvent, using the provided SessionStatusEvent

func (*StreamEvent) MergeStreamErrorEvent

func (t *StreamEvent) MergeStreamErrorEvent(v StreamErrorEvent) error

MergeStreamErrorEvent performs a merge with any union data inside the StreamEvent, using the provided StreamErrorEvent

func (*StreamEvent) UnmarshalJSON

func (t *StreamEvent) UnmarshalJSON(b []byte) error

func (StreamEvent) ValueByDiscriminator

func (t StreamEvent) ValueByDiscriminator() (interface{}, error)

type StreamEventMapper

type StreamEventMapper interface {
	ToStreamEvent(ev *rt.SessionEvent) (StreamEvent, error)
}

StreamEventMapper maps runtime session events to OpenAPI StreamEvent payloads (used by the SSE driver).

type TooManyValuesForParamError

type TooManyValuesForParamError struct {
	ParamName string
	Count     int
}

func (*TooManyValuesForParamError) Error

type ToolCallData

type ToolCallData struct {
	// Args Arguments passed to the tool (JSON object).
	Args *map[string]interface{} `json:"args,omitempty"`

	// Id Unique call ID matching the tool result.
	Id string `json:"id"`

	// Name Tool function name.
	Name string `json:"name"`
}

ToolCallData Tool invocation requested by the model.

type ToolResultData

type ToolResultData struct {
	// Id Call ID matching the original tool call.
	Id string `json:"id"`

	// Name Tool function name.
	Name string `json:"name"`

	// Response Tool output (JSON object).
	Response *map[string]interface{} `json:"response,omitempty"`
}

ToolResultData Result returned by a tool invocation.

type UUID

type UUID = uuid.UUID

UUID is a universally unique identifier for session and correlation ids. Use it in application code instead of referencing github.com/google/uuid directly at boundaries.

func MockIDGenLastGenerated

func MockIDGenLastGenerated(g IDGen) UUID

MockIDGenLastGenerated returns the last id returned from NewV7 / MustNewV7.

func MockIDGenNextGenerated

func MockIDGenNextGenerated(g IDGen) UUID

MockIDGenNextGenerated returns the id that the next successful NewV7 will return.

type Unauthorized

type Unauthorized = ProblemDetails

Unauthorized RFC 9457 problem details (subset).

type UnescapedCookieParamError

type UnescapedCookieParamError struct {
	ParamName string
	Err       error
}

func (*UnescapedCookieParamError) Error

func (e *UnescapedCookieParamError) Error() string

func (*UnescapedCookieParamError) Unwrap

func (e *UnescapedCookieParamError) Unwrap() error

type UnmarshalingParamError

type UnmarshalingParamError struct {
	ParamName string
	Err       error
}

func (*UnmarshalingParamError) Error

func (e *UnmarshalingParamError) Error() string

func (*UnmarshalingParamError) Unwrap

func (e *UnmarshalingParamError) Unwrap() error

type UpdateProviderJSONRequestBody

type UpdateProviderJSONRequestBody = UpdateProviderRequest

UpdateProviderJSONRequestBody defines body for UpdateProvider for application/json ContentType.

type UpdateProviderRequest

type UpdateProviderRequest struct {
	// ApiKey API key for authentication. Omit to keep the current value.
	ApiKey *string `json:"apiKey,omitempty"`

	// BaseUrl Base URL of the provider API endpoint.
	BaseUrl string `json:"baseUrl"`

	// DisplayName Human-friendly label.
	DisplayName *string `json:"displayName,omitempty"`
}

UpdateProviderRequest Request body for updating a provider configuration. `name` and `type` are immutable and not accepted here.

type UserMessageContent

type UserMessageContent struct {
	// Parts Must contain at least one segment with non-empty text after server-side validation; empty lists are rejected for POST bodies.
	Parts []UserMessagePart `json:"parts"`
}

UserMessageContent User message for `POST /agent-runs` / continue run: text parts (always user role; not sent by clients).

type UserMessagePart

type UserMessagePart struct {
	Text string `json:"text"`
}

UserMessagePart Single text segment in a user message (request body).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL