Documentation
¶
Overview ¶
Package agent is a workflow EnginePlugin that provides AI agent primitives: the agent.provider module type, the step.agent_execute pipeline step, and related utility steps.
Usage:
engine := workflow.NewEngine(workflow.WithPlugin(agent.New()))
Index ¶
- func NewProviderModelsFactory() plugin.StepFactory
- func NewProviderModuleFactory() plugin.ModuleFactory
- func NewProviderTestFactory() plugin.StepFactory
- func ProviderRegistryHook() plugin.WiringHook
- type AgentExecuteStep
- type AgentPlugin
- func (p *AgentPlugin) Capabilities() []capability.Contract
- func (p *AgentPlugin) ModuleFactories() map[string]plugin.ModuleFactory
- func (p *AgentPlugin) ModuleSchemas() []*schema.ModuleSchema
- func (p *AgentPlugin) StepFactories() map[string]plugin.StepFactory
- func (p *AgentPlugin) WiringHooks() []plugin.WiringHook
- type AgentSeed
- type LLMProviderConfig
- type ProviderFactory
- type ProviderModelsStep
- type ProviderModule
- func (m *ProviderModule) Agents() []AgentSeed
- func (m *ProviderModule) Init(app modular.Application) error
- func (m *ProviderModule) Name() string
- func (m *ProviderModule) Provider() provider.Provider
- func (m *ProviderModule) ProvidesServices() []modular.ServiceProvider
- func (m *ProviderModule) RequiresServices() []modular.ServiceDependency
- func (m *ProviderModule) Start(_ context.Context) error
- func (m *ProviderModule) Stop(_ context.Context) error
- func (m *ProviderModule) TestHTTPSource() *provider.HTTPSource
- type ProviderRegistry
- func (r *ProviderRegistry) GetByAlias(ctx context.Context, alias string) (provider.Provider, error)
- func (r *ProviderRegistry) GetDefault(ctx context.Context) (provider.Provider, error)
- func (r *ProviderRegistry) InvalidateCache()
- func (r *ProviderRegistry) InvalidateCacheAlias(alias string)
- func (r *ProviderRegistry) TestConnection(ctx context.Context, alias string) (bool, string, time.Duration, error)
- type ProviderTestStep
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewProviderModelsFactory ¶
func NewProviderModelsFactory() plugin.StepFactory
NewProviderModelsFactory returns the plugin.StepFactory for "step.provider_models". Exported for use by host plugins that embed agent capabilities without loading AgentPlugin as a standalone plugin.
func NewProviderModuleFactory ¶
func NewProviderModuleFactory() plugin.ModuleFactory
NewProviderModuleFactory returns the plugin.ModuleFactory for "agent.provider". This is exported so other plugins can embed the factory without loading the full AgentPlugin (which would cause duplicate step type registration conflicts).
func NewProviderTestFactory ¶
func NewProviderTestFactory() plugin.StepFactory
NewProviderTestFactory returns the plugin.StepFactory for "step.provider_test". Exported for use by host plugins that embed agent capabilities without loading AgentPlugin as a standalone plugin.
func ProviderRegistryHook ¶
func ProviderRegistryHook() plugin.WiringHook
ProviderRegistryHook returns the wiring hook that creates the agent-provider-registry. Exported for use by host plugins that embed agent capabilities without loading AgentPlugin as a standalone plugin.
Types ¶
type AgentExecuteStep ¶
type AgentExecuteStep struct {
// contains filtered or unexported fields
}
AgentExecuteStep runs the autonomous agent loop for a single task.
func (*AgentExecuteStep) Execute ¶
func (s *AgentExecuteStep) Execute(ctx context.Context, pc *module.PipelineContext) (*module.StepResult, error)
func (*AgentExecuteStep) Name ¶
func (s *AgentExecuteStep) Name() string
type AgentPlugin ¶
type AgentPlugin struct {
plugin.BaseEnginePlugin
}
AgentPlugin implements plugin.EnginePlugin.
func New ¶
func New() *AgentPlugin
New creates a new AgentPlugin ready to register with the workflow engine.
func (*AgentPlugin) Capabilities ¶
func (p *AgentPlugin) Capabilities() []capability.Contract
Capabilities returns the capability contracts for this plugin.
func (*AgentPlugin) ModuleFactories ¶
func (p *AgentPlugin) ModuleFactories() map[string]plugin.ModuleFactory
ModuleFactories returns the module factories registered by this plugin.
func (*AgentPlugin) ModuleSchemas ¶
func (p *AgentPlugin) ModuleSchemas() []*schema.ModuleSchema
ModuleSchemas returns schema definitions for IDE completions and config validation.
func (*AgentPlugin) StepFactories ¶
func (p *AgentPlugin) StepFactories() map[string]plugin.StepFactory
StepFactories returns the pipeline step factories registered by this plugin.
func (*AgentPlugin) WiringHooks ¶
func (p *AgentPlugin) WiringHooks() []plugin.WiringHook
WiringHooks returns the post-init wiring hooks for this plugin.
type AgentSeed ¶
type AgentSeed struct {
ID string `yaml:"id"`
Name string `yaml:"name"`
Role string `yaml:"role"`
SystemPrompt string `yaml:"system_prompt"`
Provider string `yaml:"provider"`
Model string `yaml:"model"`
TeamID string `yaml:"team_id"`
IsLead bool `yaml:"is_lead"`
}
AgentSeed holds the definition of an agent to seed into the database on startup.
type LLMProviderConfig ¶
type LLMProviderConfig struct {
ID string `json:"id"`
Alias string `json:"alias"`
Type string `json:"type"`
Model string `json:"model"`
SecretName string `json:"secret_name"`
BaseURL string `json:"base_url"`
MaxTokens int `json:"max_tokens"`
IsDefault int `json:"is_default"`
}
LLMProviderConfig represents a configured LLM provider stored in the database.
type ProviderFactory ¶
type ProviderFactory func(apiKey string, cfg LLMProviderConfig) (provider.Provider, error)
ProviderFactory creates a provider.Provider from an API key and config.
type ProviderModelsStep ¶
type ProviderModelsStep struct {
// contains filtered or unexported fields
}
ProviderModelsStep fetches available models from a provider's API.
func (*ProviderModelsStep) Execute ¶
func (s *ProviderModelsStep) Execute(ctx context.Context, pc *module.PipelineContext) (*module.StepResult, error)
func (*ProviderModelsStep) Name ¶
func (s *ProviderModelsStep) Name() string
type ProviderModule ¶
type ProviderModule struct {
// contains filtered or unexported fields
}
ProviderModule wraps a provider.Provider as a modular.Module. It registers itself in the service registry so steps can look it up by name.
func (*ProviderModule) Agents ¶
func (m *ProviderModule) Agents() []AgentSeed
Agents returns the agent seeds configured for this provider module.
func (*ProviderModule) Init ¶
func (m *ProviderModule) Init(app modular.Application) error
Init registers this module as a named service.
func (*ProviderModule) Name ¶
func (m *ProviderModule) Name() string
Name implements modular.Module.
func (*ProviderModule) Provider ¶
func (m *ProviderModule) Provider() provider.Provider
Provider returns the underlying AI provider.
func (*ProviderModule) ProvidesServices ¶
func (m *ProviderModule) ProvidesServices() []modular.ServiceProvider
ProvidesServices declares the provider service.
func (*ProviderModule) RequiresServices ¶
func (m *ProviderModule) RequiresServices() []modular.ServiceDependency
RequiresServices declares no dependencies.
func (*ProviderModule) Start ¶
func (m *ProviderModule) Start(_ context.Context) error
Start implements modular.Startable (no-op).
func (*ProviderModule) Stop ¶
func (m *ProviderModule) Stop(_ context.Context) error
Stop implements modular.Stoppable (no-op).
func (*ProviderModule) TestHTTPSource ¶
func (m *ProviderModule) TestHTTPSource() *provider.HTTPSource
TestHTTPSource returns the HTTPSource if the provider is a test provider in HTTP mode.
type ProviderRegistry ¶
type ProviderRegistry struct {
Factories map[string]ProviderFactory
// contains filtered or unexported fields
}
ProviderRegistry manages AI provider lifecycle: factory creation, caching, and DB lookup.
func NewProviderRegistry ¶
func NewProviderRegistry(db *sql.DB, secretsProvider secrets.Provider) *ProviderRegistry
NewProviderRegistry creates a new ProviderRegistry with built-in factories registered.
func (*ProviderRegistry) GetByAlias ¶
GetByAlias looks up a provider by its alias.
func (*ProviderRegistry) GetDefault ¶
GetDefault finds the default provider (is_default=1).
func (*ProviderRegistry) InvalidateCache ¶
func (r *ProviderRegistry) InvalidateCache()
InvalidateCache clears all cached providers.
func (*ProviderRegistry) InvalidateCacheAlias ¶
func (r *ProviderRegistry) InvalidateCacheAlias(alias string)
InvalidateCacheAlias removes a specific cached provider by alias.
type ProviderTestStep ¶
type ProviderTestStep struct {
// contains filtered or unexported fields
}
ProviderTestStep tests connectivity to a configured AI provider.
func (*ProviderTestStep) Execute ¶
func (s *ProviderTestStep) Execute(ctx context.Context, pc *module.PipelineContext) (*module.StepResult, error)
func (*ProviderTestStep) Name ¶
func (s *ProviderTestStep) Name() string
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package agent defines agent types and configuration.
|
Package agent defines agent types and configuration. |
|
Package executor provides the core autonomous agent execution loop.
|
Package executor provides the core autonomous agent execution loop. |
|
Package memory provides SQLite-backed persistent memory storage for agents.
|
Package memory provides SQLite-backed persistent memory storage for agents. |
|
Package provider defines the AI provider interface for agent backends.
|
Package provider defines the AI provider interface for agent backends. |
|
Package sdk provides reusable daemon-client infrastructure for agent CLI tools.
|
Package sdk provides reusable daemon-client infrastructure for agent CLI tools. |
|
Package task defines the task model for agent work items.
|
Package task defines the task model for agent work items. |
|
Package tools defines the Tool interface and Registry for agent tool execution.
|
Package tools defines the Tool interface and Registry for agent tool execution. |