Documentation
¶
Index ¶
- Constants
- Variables
- type ACPStdioAgentCommand
- type AgentProfile
- type AgentProfilesService
- type AgentRunner
- type CreateAgentProfileParams
- type CreateProviderConfigParams
- type DefinedTool
- type ExecutionMode
- type ExecutionSettings
- type ListSessionsParams
- type ListSessionsResult
- type MockAgentRunner
- func (_m *MockAgentRunner) EXPECT() *MockAgentRunner_Expecter
- func (_mock *MockAgentRunner) ListSessions(ctx context.Context, params ListSessionsParams) (*ListSessionsResult, error)
- func (_mock *MockAgentRunner) ReadSession(ctx context.Context, params ReadSessionParams) (*ReadSessionResult, error)
- func (_mock *MockAgentRunner) Run(ctx context.Context, params RunParams) (*RunResult, error)
- type MockAgentRunner_Expecter
- func (_e *MockAgentRunner_Expecter) ListSessions(ctx interface{}, params interface{}) *MockAgentRunner_ListSessions_Call
- func (_e *MockAgentRunner_Expecter) ReadSession(ctx interface{}, params interface{}) *MockAgentRunner_ReadSession_Call
- func (_e *MockAgentRunner_Expecter) Run(ctx interface{}, params interface{}) *MockAgentRunner_Run_Call
- type MockAgentRunner_ListSessions_Call
- func (_c *MockAgentRunner_ListSessions_Call) Return(v *ListSessionsResult, err error) *MockAgentRunner_ListSessions_Call
- func (_c *MockAgentRunner_ListSessions_Call) Run(run func(ctx context.Context, params ListSessionsParams)) *MockAgentRunner_ListSessions_Call
- func (_c *MockAgentRunner_ListSessions_Call) RunAndReturn(...) *MockAgentRunner_ListSessions_Call
- type MockAgentRunner_ReadSession_Call
- func (_c *MockAgentRunner_ReadSession_Call) Return(v *ReadSessionResult, err error) *MockAgentRunner_ReadSession_Call
- func (_c *MockAgentRunner_ReadSession_Call) Run(run func(ctx context.Context, params ReadSessionParams)) *MockAgentRunner_ReadSession_Call
- func (_c *MockAgentRunner_ReadSession_Call) RunAndReturn(...) *MockAgentRunner_ReadSession_Call
- type MockAgentRunner_Run_Call
- func (_c *MockAgentRunner_Run_Call) Return(v *RunResult, err error) *MockAgentRunner_Run_Call
- func (_c *MockAgentRunner_Run_Call) Run(run func(ctx context.Context, params RunParams)) *MockAgentRunner_Run_Call
- func (_c *MockAgentRunner_Run_Call) RunAndReturn(run func(ctx context.Context, params RunParams) (*RunResult, error)) *MockAgentRunner_Run_Call
- type ModelConfig
- type ModelInfo
- type ModelsLister
- type OpenAICompatibleLLMProviderArgs
- type OpenAICompatibleLLMProviderOpt
- type Provider
- type ProvidersConfigService
- type ReadSessionParams
- type ReadSessionResult
- type RunParams
- type RunParamsBuilder
- type RunResult
- type Runner
- func (r *Runner) AutoMigrate() error
- func (r *Runner) ListSessions(ctx context.Context, params ListSessionsParams) (*ListSessionsResult, error)
- func (r *Runner) ModelsLocator() ModelsLister
- func (r *Runner) ReadSession(ctx context.Context, params ReadSessionParams) (*ReadSessionResult, error)
- func (r *Runner) Run(ctx context.Context, params RunParams) (*RunResult, error)
- type RunnerArgs
- type RunnerOpt
- func WithDatabaseStorage(dsn string) RunnerOpt
- func WithDatabaseTablePrefix(prefix string) RunnerOpt
- func WithFileSystemStorage(baseDir string) RunnerOpt
- func WithLogger(logger *slog.Logger) RunnerOpt
- func WithSystemPromptFragments(fragments ...SystemPromptFragment) RunnerOpt
- func WithToolsRegistry(reg *ToolsRegistry) RunnerOpt
- type SessionMetadata
- type SystemPromptFragment
- type ToolContext
- type ToolDef
- type ToolsRegistry
- type UpdateAgentProfileParams
Constants ¶
const ( // ExecutionModeRegular routes the profile through the built-in runtime agent. ExecutionModeRegular = ap.ExecutionModeRegular // ExecutionModeACPStdio routes the profile through an ACP-compatible stdio command. ExecutionModeACPStdio = ap.ExecutionModeACPStdio )
Variables ¶
var ErrAgentProfileNameConflict = ap.ErrAgentProfileNameConflict
ErrAgentProfileNameConflict is returned when a profile with the given name already exists.
var ErrAgentProfileNotFound = ap.ErrAgentProfileNotFound
ErrAgentProfileNotFound is returned when a profile with the given name does not exist.
Functions ¶
This section is empty.
Types ¶
type ACPStdioAgentCommand ¶
type ACPStdioAgentCommand = ap.ACPStdioAgentCommand
ACPStdioAgentCommand stores command defaults used to launch an ACP stdio agent.
type AgentProfile ¶
type AgentProfile = ap.AgentProfile
AgentProfile is a persisted general-purpose agent profile definition.
type AgentProfilesService ¶
type AgentProfilesService = ap.AgentProfilesService
AgentProfilesService manages persisted agent profiles.
func NewDatabaseAgentProfilesService ¶
func NewDatabaseAgentProfilesService( dsn string, logger *slog.Logger, tablePrefix string, ) (AgentProfilesService, error)
NewDatabaseAgentProfilesService creates a database-backed AgentProfilesService that stores profile definitions in a relational database identified by the given DSN. tablePrefix sets the prefix for persisted SQL table names; empty means no prefix.
func NewFileAgentProfilesService ¶
func NewFileAgentProfilesService( baseDir string, logger *slog.Logger, ) (AgentProfilesService, error)
NewFileAgentProfilesService creates a file-based AgentProfilesService that stores profile definitions as YAML files under {baseDir}/agent-profiles/{name}.yaml.
type AgentRunner ¶
type AgentRunner interface {
Run(ctx context.Context, params RunParams) (*RunResult, error)
ReadSession(ctx context.Context, params ReadSessionParams) (*ReadSessionResult, error)
ListSessions(ctx context.Context, params ListSessionsParams) (*ListSessionsResult, error)
}
AgentRunner is the embedder-facing contract for agent runs, session reads, and session listing. Session listing returns paginated SessionMetadata via ListSessionsResult. *Runner implements it; internal adapters such as the background runner satisfy it as well.
type CreateAgentProfileParams ¶
type CreateAgentProfileParams = ap.CreateAgentProfileParams
CreateAgentProfileParams contains parameters required to create a profile.
type CreateProviderConfigParams ¶
type CreateProviderConfigParams = lp.CreateProviderConfigParams
CreateProviderConfigParams holds the parameters for creating a new provider config.
type DefinedTool ¶
type DefinedTool interface {
// contains filtered or unexported methods
}
type ExecutionMode ¶
type ExecutionMode = ap.ExecutionMode
ExecutionMode identifies how a profile executes.
type ExecutionSettings ¶
type ExecutionSettings = ap.ExecutionSettings
ExecutionSettings stores runtime-owned execution defaults for a profile.
type ListSessionsParams ¶
type ListSessionsParams = internal.ListSessionMetadataParams
ListSessionsParams filters and paginates session metadata for the configured app.
type ListSessionsResult ¶
type ListSessionsResult = internal.ListSessionMetadataResult
ListSessionsResult is a page of session metadata plus total count for pagination.
type MockAgentRunner ¶
MockAgentRunner is an autogenerated mock type for the AgentRunner type
func NewMockAgentRunner ¶
func NewMockAgentRunner(t interface {
mock.TestingT
Cleanup(func())
}) *MockAgentRunner
NewMockAgentRunner creates a new instance of MockAgentRunner. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockAgentRunner) EXPECT ¶
func (_m *MockAgentRunner) EXPECT() *MockAgentRunner_Expecter
func (*MockAgentRunner) ListSessions ¶
func (_mock *MockAgentRunner) ListSessions(ctx context.Context, params ListSessionsParams) (*ListSessionsResult, error)
ListSessions provides a mock function for the type MockAgentRunner
func (*MockAgentRunner) ReadSession ¶
func (_mock *MockAgentRunner) ReadSession(ctx context.Context, params ReadSessionParams) (*ReadSessionResult, error)
ReadSession provides a mock function for the type MockAgentRunner
type MockAgentRunner_Expecter ¶
type MockAgentRunner_Expecter struct {
// contains filtered or unexported fields
}
func (*MockAgentRunner_Expecter) ListSessions ¶
func (_e *MockAgentRunner_Expecter) ListSessions(ctx interface{}, params interface{}) *MockAgentRunner_ListSessions_Call
ListSessions is a helper method to define mock.On call
- ctx context.Context
- params ListSessionsParams
func (*MockAgentRunner_Expecter) ReadSession ¶
func (_e *MockAgentRunner_Expecter) ReadSession(ctx interface{}, params interface{}) *MockAgentRunner_ReadSession_Call
ReadSession is a helper method to define mock.On call
- ctx context.Context
- params ReadSessionParams
func (*MockAgentRunner_Expecter) Run ¶
func (_e *MockAgentRunner_Expecter) Run(ctx interface{}, params interface{}) *MockAgentRunner_Run_Call
Run is a helper method to define mock.On call
- ctx context.Context
- params RunParams
type MockAgentRunner_ListSessions_Call ¶
MockAgentRunner_ListSessions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListSessions'
func (*MockAgentRunner_ListSessions_Call) Return ¶
func (_c *MockAgentRunner_ListSessions_Call) Return(v *ListSessionsResult, err error) *MockAgentRunner_ListSessions_Call
func (*MockAgentRunner_ListSessions_Call) Run ¶
func (_c *MockAgentRunner_ListSessions_Call) Run(run func(ctx context.Context, params ListSessionsParams)) *MockAgentRunner_ListSessions_Call
func (*MockAgentRunner_ListSessions_Call) RunAndReturn ¶
func (_c *MockAgentRunner_ListSessions_Call) RunAndReturn(run func(ctx context.Context, params ListSessionsParams) (*ListSessionsResult, error)) *MockAgentRunner_ListSessions_Call
type MockAgentRunner_ReadSession_Call ¶
MockAgentRunner_ReadSession_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReadSession'
func (*MockAgentRunner_ReadSession_Call) Return ¶
func (_c *MockAgentRunner_ReadSession_Call) Return(v *ReadSessionResult, err error) *MockAgentRunner_ReadSession_Call
func (*MockAgentRunner_ReadSession_Call) Run ¶
func (_c *MockAgentRunner_ReadSession_Call) Run(run func(ctx context.Context, params ReadSessionParams)) *MockAgentRunner_ReadSession_Call
func (*MockAgentRunner_ReadSession_Call) RunAndReturn ¶
func (_c *MockAgentRunner_ReadSession_Call) RunAndReturn(run func(ctx context.Context, params ReadSessionParams) (*ReadSessionResult, error)) *MockAgentRunner_ReadSession_Call
type MockAgentRunner_Run_Call ¶
MockAgentRunner_Run_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Run'
func (*MockAgentRunner_Run_Call) Return ¶
func (_c *MockAgentRunner_Run_Call) Return(v *RunResult, err error) *MockAgentRunner_Run_Call
func (*MockAgentRunner_Run_Call) Run ¶
func (_c *MockAgentRunner_Run_Call) Run(run func(ctx context.Context, params RunParams)) *MockAgentRunner_Run_Call
func (*MockAgentRunner_Run_Call) RunAndReturn ¶
func (_c *MockAgentRunner_Run_Call) RunAndReturn(run func(ctx context.Context, params RunParams) (*RunResult, error)) *MockAgentRunner_Run_Call
type ModelConfig ¶
type ModelConfig = lp.ModelConfig
ModelConfig represents a single model available through a provider.
type ModelsLister ¶
ModelsLister lists available models across all configured providers. *Runner.ModelsLocator returns a value satisfying this interface for runners constructed with NewRunner and a non-nil [RunnerArgs.ProvidersConfigService].
type OpenAICompatibleLLMProviderArgs ¶
type OpenAICompatibleLLMProviderArgs struct {
// Name is the name of the provider.
// This will be used as a prefix for model names (e.g., "myprovider/model-name").
Name string
// APIKey is the API key to use with the provider.
APIKey string `json:"-"`
// BaseURL is the base URL to use with the provider.
BaseURL string
}
type OpenAICompatibleLLMProviderOpt ¶
type OpenAICompatibleLLMProviderOpt func(*oai.OpenAICompatible)
func OpenAIWithHTTPClient ¶
func OpenAIWithHTTPClient(client *http.Client) OpenAICompatibleLLMProviderOpt
OpenAIWithHTTPClient sets the HTTP client to use with the provider.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider allows defining various LLM providers.
func NewOpenAICompatibleLLMProvider ¶
func NewOpenAICompatibleLLMProvider( args OpenAICompatibleLLMProviderArgs, opts ...OpenAICompatibleLLMProviderOpt, ) *Provider
type ProvidersConfigService ¶
type ProvidersConfigService = lp.ProvidersConfigService
ProvidersConfigService is the provider configuration management contract.
func NewDatabaseProvidersConfigService ¶
func NewDatabaseProvidersConfigService( dsn string, logger *slog.Logger, tablePrefix string, ) (ProvidersConfigService, error)
NewDatabaseProvidersConfigService creates a database-backed ProvidersConfigService that stores provider configurations in a relational database identified by the given DSN. tablePrefix sets the prefix for persisted SQL table names; empty means no prefix.
func NewFileProvidersConfigService ¶
func NewFileProvidersConfigService( baseDir string, logger *slog.Logger, ) (ProvidersConfigService, error)
NewFileProvidersConfigService creates a file-based ProvidersConfigService that stores provider configurations as YAML files under {baseDir}/providers/ (canonical {name}.yaml; optional same-named {name}.yml for discovery and reads).
type ReadSessionParams ¶
type ReadSessionParams = internal.ReadSessionParams
type ReadSessionResult ¶
type ReadSessionResult = internal.ReadSessionResult
type RunParamsBuilder ¶
type RunParamsBuilder struct {
// contains filtered or unexported fields
}
RunParamsBuilder constructs RunParams for Runner.Run with required user identity and model.
func NewRunParams ¶
func NewRunParams(userID, sessionID, model string) RunParamsBuilder
NewRunParams starts a builder with userID, sessionID, and fully qualified model ("provider/model-name").
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
func (*Runner) AutoMigrate ¶
AutoMigrate runs schema migrations for database-backed session storage when configured. It is a no-op when file or in-memory storage is in use. Call this once after constructing the runner and before serving requests.
func (*Runner) ListSessions ¶
func (r *Runner) ListSessions(ctx context.Context, params ListSessionsParams) (*ListSessionsResult, error)
ListSessions returns a page of session metadata for the configured app and user. AppName in params is ignored; the runner uses its fixed app name (same as Run and ReadSession).
func (*Runner) ModelsLocator ¶
func (r *Runner) ModelsLocator() ModelsLister
ModelsLocator returns the runner's [ModelsLocator] for listing models (e.g. GET /models). The returned value satisfies ModelsLister and can be passed to [httpapi.HandlerArgs.ModelsLister].
func (*Runner) ReadSession ¶
func (r *Runner) ReadSession(ctx context.Context, params ReadSessionParams) (*ReadSessionResult, error)
ReadSession reads the events for a session from the configured session service.
type RunnerArgs ¶
type RunnerArgs struct {
// ProvidersConfigService is required. NewRunner wires a ModelsLocator for LLM resolution.
ProvidersConfigService ProvidersConfigService
// AgentProfilesService is required. NewRunner wires profile-backed execution from it.
AgentProfilesService AgentProfilesService
// contains filtered or unexported fields
}
type RunnerOpt ¶
type RunnerOpt func(*runnerOpts)
func WithDatabaseStorage ¶
WithDatabaseStorage configures the runner to persist session state in a database identified by dsn. When this option is omitted, storage defaults to in-memory. WithDatabaseStorage and WithFileSystemStorage are mutually exclusive; the last one set wins.
func WithDatabaseTablePrefix ¶
WithDatabaseTablePrefix sets the SQL table name prefix used when database-backed session storage is enabled. When empty, no prefix is applied. This option has no effect when storage is not database-backed.
func WithFileSystemStorage ¶
WithFileSystemStorage configures the runner to persist state under baseDir on disk. The directory is created if it does not exist. When this option is omitted, storage is in-memory only. If WithFileSystemStorage is passed multiple times, the last call wins. WithFileSystemStorage and WithDatabaseStorage are mutually exclusive; the last one set wins.
func WithLogger ¶
WithLogger sets the logger to use for the runner.
func WithSystemPromptFragments ¶
func WithSystemPromptFragments(fragments ...SystemPromptFragment) RunnerOpt
WithSystemPromptFragments appends extra system prompt sections after the base template and the default assistant instruction fragment. Multiple calls append in order.
func WithToolsRegistry ¶
func WithToolsRegistry(reg *ToolsRegistry) RunnerOpt
WithToolsRegistry sets an optional tools registry. When non-nil, Genkit tool stubs are registered on each provider Genkit instance as models are resolved, and ADK tools are supplied from the registry.
type SessionMetadata ¶
type SessionMetadata = internal.SessionMetadata
SessionMetadata is lightweight session listing data (id, title, timestamps).
type SystemPromptFragment ¶
type SystemPromptFragment = internal.SystemPromptFragment
SystemPromptFragment is an extra section appended after the runtime base system prompt.
type ToolContext ¶
ToolContext is the invocation context passed to agent tool handlers. It is created only inside this package (ADK bridge or test-only helpers). It embeds context.Context so a *ToolContext may be passed where a context.Context is required. ADK-specific state is not exposed on the public type.
type ToolDef ¶
type ToolDef[TArgs, TResults any] struct { Name string Description string Handler func(ctx *ToolContext, input TArgs) (TResults, error) // contains filtered or unexported fields }
ToolDef is a generic tool definition for LLM agents with typed args and results.
func NewToolDef ¶
func NewToolDef[TArgs, TResults any]( name, description string, handler func(ctx *ToolContext, input TArgs) (TResults, error), ) ToolDef[TArgs, TResults]
func (ToolDef[TArgs, TResults]) WithOutputSchema ¶
WithOutputSchema returns a copy of the tool definition with a custom output schema provided as raw JSON bytes. Use this when the output type cannot be inferred automatically (e.g., recursive types that would cause cycle-detection errors).
type ToolsRegistry ¶
type ToolsRegistry struct {
// contains filtered or unexported fields
}
ToolsRegistry allows to register tools available to the agent.
func NewToolsRegistry ¶
func NewToolsRegistry() *ToolsRegistry
NewToolsRegistry creates a new ToolsRegistry.
func (*ToolsRegistry) AddTools ¶
func (r *ToolsRegistry) AddTools(tools ...DefinedTool)
type UpdateAgentProfileParams ¶
type UpdateAgentProfileParams = ap.UpdateAgentProfileParams
UpdateAgentProfileParams contains mutable parameters for profile updates.