agentapi

package
v0.0.0-...-9be4777 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: MIT Imports: 22 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 ACPStdioAgentCommand

type ACPStdioAgentCommand struct {
	// Args Command arguments passed to the ACP-compatible stdio agent executable.
	Args *[]string `json:"args,omitempty"`

	// Command Command executable to launch the ACP-compatible stdio agent.
	Command string `json:"command"`
}

ACPStdioAgentCommand Command defaults used to launch an ACP-compatible stdio agent.

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) CreateAgentProfile

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

CreateAgentProfile implements ServerInterface.

func (*AgentAPIServer) CreateProvider

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

CreateProvider implements ServerInterface.

func (*AgentAPIServer) DeleteAgentProfile

func (s *AgentAPIServer) DeleteAgentProfile(w http.ResponseWriter, r *http.Request, profileName ProfileName)

DeleteAgentProfile implements ServerInterface.

func (*AgentAPIServer) DeleteProvider

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

DeleteProvider implements ServerInterface.

func (*AgentAPIServer) GetAgentProfile

func (s *AgentAPIServer) GetAgentProfile(w http.ResponseWriter, r *http.Request, profileName ProfileName)

GetAgentProfile implements ServerInterface.

func (*AgentAPIServer) GetProvider

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

GetProvider implements ServerInterface.

func (*AgentAPIServer) ListAgentProfiles

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

ListAgentProfiles implements ServerInterface.

func (*AgentAPIServer) ListModels

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

ListModels implements ServerInterface.

func (*AgentAPIServer) ListProviders

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

ListProviders implements ServerInterface.

func (*AgentAPIServer) ListSessions

func (s *AgentAPIServer) ListSessions(w http.ResponseWriter, r *http.Request, params ListSessionsParams)

ListSessions 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.

func (*AgentAPIServer) UpdateAgentProfile

func (s *AgentAPIServer) UpdateAgentProfile(w http.ResponseWriter, r *http.Request, profileName ProfileName)

UpdateAgentProfile implements ServerInterface.

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 AgentProfileACPStdioExecutionSettings

type AgentProfileACPStdioExecutionSettings struct {
	// AgentCommand Command defaults used to launch an ACP-compatible stdio agent.
	AgentCommand ACPStdioAgentCommand `json:"agentCommand"`

	// Cwd Optional working directory used to launch the ACP stdio agent.
	Cwd *string `json:"cwd,omitempty"`

	// Mode Execution mode for ACP-compatible stdio profiles.
	Mode string `json:"mode"`
}

AgentProfileACPStdioExecutionSettings Runtime-owned execution defaults for ACP-compatible stdio profile execution.

type AgentProfileExecutionSettings

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

AgentProfileExecutionSettings defines model for AgentProfileExecutionSettings.

func (AgentProfileExecutionSettings) AsAgentProfileACPStdioExecutionSettings

func (t AgentProfileExecutionSettings) AsAgentProfileACPStdioExecutionSettings() (AgentProfileACPStdioExecutionSettings, error)

AsAgentProfileACPStdioExecutionSettings returns the union data inside the AgentProfileExecutionSettings as a AgentProfileACPStdioExecutionSettings

func (AgentProfileExecutionSettings) AsAgentProfileRegularExecutionSettings

func (t AgentProfileExecutionSettings) AsAgentProfileRegularExecutionSettings() (AgentProfileRegularExecutionSettings, error)

AsAgentProfileRegularExecutionSettings returns the union data inside the AgentProfileExecutionSettings as a AgentProfileRegularExecutionSettings

func (*AgentProfileExecutionSettings) FromAgentProfileACPStdioExecutionSettings

func (t *AgentProfileExecutionSettings) FromAgentProfileACPStdioExecutionSettings(v AgentProfileACPStdioExecutionSettings) error

FromAgentProfileACPStdioExecutionSettings overwrites any union data inside the AgentProfileExecutionSettings as the provided AgentProfileACPStdioExecutionSettings

func (*AgentProfileExecutionSettings) FromAgentProfileRegularExecutionSettings

func (t *AgentProfileExecutionSettings) FromAgentProfileRegularExecutionSettings(v AgentProfileRegularExecutionSettings) error

FromAgentProfileRegularExecutionSettings overwrites any union data inside the AgentProfileExecutionSettings as the provided AgentProfileRegularExecutionSettings

func (AgentProfileExecutionSettings) MarshalJSON

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

func (*AgentProfileExecutionSettings) MergeAgentProfileACPStdioExecutionSettings

func (t *AgentProfileExecutionSettings) MergeAgentProfileACPStdioExecutionSettings(v AgentProfileACPStdioExecutionSettings) error

MergeAgentProfileACPStdioExecutionSettings performs a merge with any union data inside the AgentProfileExecutionSettings, using the provided AgentProfileACPStdioExecutionSettings

func (*AgentProfileExecutionSettings) MergeAgentProfileRegularExecutionSettings

func (t *AgentProfileExecutionSettings) MergeAgentProfileRegularExecutionSettings(v AgentProfileRegularExecutionSettings) error

MergeAgentProfileRegularExecutionSettings performs a merge with any union data inside the AgentProfileExecutionSettings, using the provided AgentProfileRegularExecutionSettings

func (*AgentProfileExecutionSettings) UnmarshalJSON

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

type AgentProfileListResponse

type AgentProfileListResponse struct {
	Profiles []AgentProfileResponse `json:"profiles"`
}

AgentProfileListResponse List of saved agent profiles.

type AgentProfileRegularExecutionSettings

type AgentProfileRegularExecutionSettings struct {
	// DefaultModel Fully-qualified default model in `provider/model-name` form.
	DefaultModel string `json:"defaultModel"`

	// Mode Execution mode. Omit for regular built-in execution.
	Mode *AgentProfileRegularExecutionSettingsMode `json:"mode,omitempty"`
}

AgentProfileRegularExecutionSettings Runtime-owned execution defaults for built-in profile execution.

type AgentProfileRegularExecutionSettingsMode

type AgentProfileRegularExecutionSettingsMode string

AgentProfileRegularExecutionSettingsMode Execution mode. Omit for regular built-in execution.

const (
	Regular AgentProfileRegularExecutionSettingsMode = "regular"
)

Defines values for AgentProfileRegularExecutionSettingsMode.

func (AgentProfileRegularExecutionSettingsMode) Valid

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

type AgentProfileResponse

type AgentProfileResponse struct {
	// CreatedAt ISO 8601 creation timestamp.
	CreatedAt time.Time `json:"createdAt"`

	// DisplayName Human-friendly profile label (may be empty).
	DisplayName       string                        `json:"displayName"`
	ExecutionSettings AgentProfileExecutionSettings `json:"executionSettings"`

	// Instructions Profile-specific behavior instructions.
	Instructions string `json:"instructions"`

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

	// Role Profile role describing high-level responsibility.
	Role string `json:"role"`

	// ToolRefs Tool references available to this profile.
	ToolRefs []string `json:"toolRefs"`

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

AgentProfileResponse A saved agent profile as returned by the API.

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 Fully-qualified model name (`provider/model-name`) for built-in execution. Optional override for regular profiles; ignored for `acp-stdio`.
	Model *string `json:"model,omitempty"`

	// ProfileName Name of the saved agent profile whose execution settings will be used for this run.
	ProfileName *string `json:"profileName,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 CreateAgentProfileJSONRequestBody

type CreateAgentProfileJSONRequestBody = CreateAgentProfileRequest

CreateAgentProfileJSONRequestBody defines body for CreateAgentProfile for application/json ContentType.

type CreateAgentProfileRequest

type CreateAgentProfileRequest struct {
	// DisplayName Optional human-friendly profile label.
	DisplayName       *string                       `json:"displayName,omitempty"`
	ExecutionSettings AgentProfileExecutionSettings `json:"executionSettings"`

	// Instructions Profile-specific behavior instructions.
	Instructions string `json:"instructions"`

	// Name Unique technical profile name (primary key). Immutable after creation.
	Name string `json:"name"`

	// Role Profile role describing high-level responsibility.
	Role string `json:"role"`

	// ToolRefs Tool references available to this profile.
	ToolRefs *[]string `json:"toolRefs,omitempty"`
}

CreateAgentProfileRequest Request body for creating a saved agent profile.

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"`

	// Models Models available through this provider.
	Models *[]ModelConfig `json:"models,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 ListSessionsParams

type ListSessionsParams struct {
	// Limit Maximum number of sessions to return (1–100).
	Limit int `form:"limit" json:"limit"`

	// Offset Number of sessions to skip (for pagination). Defaults to 0.
	Offset *int `form:"offset,omitempty" json:"offset,omitempty"`
}

ListSessionsParams defines parameters for ListSessions.

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 ModelConfig

type ModelConfig struct {
	// DisplayName Optional human-friendly label (e.g., "GPT 4.1").
	DisplayName *string `json:"displayName,omitempty"`

	// Name Technical model identifier (e.g., "gpt-4.1").
	Name string `json:"name"`

	// Summarization Designates this model for summarization tasks (e.g. generating session titles). If multiple models have this enabled, the first one found is used.
	Summarization *bool `json:"summarization,omitempty"`
}

ModelConfig A model available through a provider.

type ModelInfo

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

	// Name Technical model identifier (e.g., "gpt-4.1").
	Name string `json:"name"`

	// Provider Provider name (prefix in fully-qualified model names like `provider/model-name`).
	Provider string `json:"provider"`
}

ModelInfo A model available across providers, including the provider name for fully-qualified identification.

type ModelListResponse

type ModelListResponse struct {
	Models []ModelInfo `json:"models"`
}

ModelListResponse List of available models across all providers.

type ModelsLister

type ModelsLister interface {
	ListModels(ctx context.Context) ([]rt.ModelInfo, error)
}

ModelsLister lists available models across all providers.

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 ProfileName

type ProfileName = string

ProfileName defines model for ProfileName.

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"`

	// Models Models available through this provider.
	Models []ModelConfig `json:"models"`

	// 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 {
	// List all saved agent profiles
	// (GET /agent-profiles)
	ListAgentProfiles(w http.ResponseWriter, r *http.Request)
	// Create a new saved agent profile
	// (POST /agent-profiles)
	CreateAgentProfile(w http.ResponseWriter, r *http.Request)
	// Delete a saved agent profile by name
	// (DELETE /agent-profiles/{profileName})
	DeleteAgentProfile(w http.ResponseWriter, r *http.Request, profileName ProfileName)
	// Get a saved agent profile by name
	// (GET /agent-profiles/{profileName})
	GetAgentProfile(w http.ResponseWriter, r *http.Request, profileName ProfileName)
	// Update mutable fields for a saved agent profile
	// (PUT /agent-profiles/{profileName})
	UpdateAgentProfile(w http.ResponseWriter, r *http.Request, profileName ProfileName)
	// Start a new agent run
	// (POST /agent-runs)
	StartAgentRun(w http.ResponseWriter, r *http.Request)
	// List all available models across all providers
	// (GET /models)
	ListModels(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)
	// List sessions for the authenticated user
	// (GET /sessions)
	ListSessions(w http.ResponseWriter, r *http.Request, params ListSessionsParams)
	// 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) CreateAgentProfile

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

CreateAgentProfile operation middleware

func (*ServerInterfaceWrapper) CreateProvider

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

CreateProvider operation middleware

func (*ServerInterfaceWrapper) DeleteAgentProfile

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

DeleteAgentProfile operation middleware

func (*ServerInterfaceWrapper) DeleteProvider

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

DeleteProvider operation middleware

func (*ServerInterfaceWrapper) GetAgentProfile

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

GetAgentProfile operation middleware

func (*ServerInterfaceWrapper) GetProvider

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

GetProvider operation middleware

func (*ServerInterfaceWrapper) ListAgentProfiles

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

ListAgentProfiles operation middleware

func (*ServerInterfaceWrapper) ListModels

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

ListModels operation middleware

func (*ServerInterfaceWrapper) ListProviders

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

ListProviders operation middleware

func (*ServerInterfaceWrapper) ListSessions

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

ListSessions 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) UpdateAgentProfile

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

UpdateAgentProfile 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 lp.ProvidersConfigService
	AgentProfilesService   ap.AgentProfilesService
	// ModelsLister is optional; when nil, ListModels returns an empty list.
	ModelsLister ModelsLister
}

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 SessionListResponse

type SessionListResponse struct {
	Sessions []SessionMetadata `json:"sessions"`

	// Total Total number of sessions matching the query (before limit/offset).
	Total int `json:"total"`
}

SessionListResponse defines model for SessionListResponse.

type SessionMetadata

type SessionMetadata struct {
	CreatedAt time.Time `json:"createdAt"`
	SessionId string    `json:"sessionId"`

	// Title Session title. Always non-empty — resolved by the backend. Generated via LLM summarization (if a summarization model is designated), derived from the first user message, or a date-based fallback for sessions without a stored title.
	Title     string    `json:"title"`
	UpdatedAt time.Time `json:"updatedAt"`
}

SessionMetadata defines model for SessionMetadata.

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 UpdateAgentProfileJSONRequestBody

type UpdateAgentProfileJSONRequestBody = UpdateAgentProfileRequest

UpdateAgentProfileJSONRequestBody defines body for UpdateAgentProfile for application/json ContentType.

type UpdateAgentProfileRequest

type UpdateAgentProfileRequest struct {
	// DisplayName Human-friendly profile label.
	DisplayName       *string                       `json:"displayName,omitempty"`
	ExecutionSettings AgentProfileExecutionSettings `json:"executionSettings"`

	// Instructions Profile-specific behavior instructions.
	Instructions string `json:"instructions"`

	// Role Profile role describing high-level responsibility.
	Role string `json:"role"`

	// ToolRefs Tool references available to this profile. Replaces the existing list.
	ToolRefs *[]string `json:"toolRefs,omitempty"`
}

UpdateAgentProfileRequest Request body for updating a saved agent profile. `name` is immutable and not accepted here.

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"`

	// Models Models available through this provider. Replaces the existing list.
	Models *[]ModelConfig `json:"models,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