Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AgentDefinition ¶
func AgentDefinition(presets *PresetRegistry) tools.Definition
AgentDefinition returns the tool definition without requiring a live config. presets is optional — when provided, the preset enum is included in the schema.
Types ¶
type AgentConfig ¶
type AgentConfig struct {
Providers providers.ProviderGetter
Registry *tools.Registry
Model ai.Model
APIKey string
BaseURL string
System string
Emit func(agent.LoopEvent) // optional event emitter for observability
Presets *PresetRegistry // loaded agent presets (nil = no presets)
PresetLoader func(string) *PresetRegistry
Hooks *hooks.HookSet // inherited by subagents (nil = no hooks)
ToolLifecycle *agent.ToolLifecycle
// Configurable limits (zero = use defaults).
MaxTasks int // max tasks per invocation
MaxConcurrency int // max parallel subagent goroutines
MaxResultChars int // max runes in result output
}
AgentConfig holds the dependencies needed to spawn subagent loops.
type AgentPreset ¶
type AgentPreset struct {
Name string // unique identifier
Description string // human-readable description
System string // markdown body = system prompt for the subagent
Tools []string // nil = all tools; empty slice = no tools
HasTools bool // true when tools is explicitly set (even if empty)
MaxTurns int // 0 = use global default
Timeout time.Duration // 0 = use global default
Model string // empty = inherit parent model
FilePath string // absolute path to the source .md file
Source string // "project", "agent", "common", or "builtin"
}
AgentPreset defines a reusable subagent configuration loaded from a markdown file.
func LoadAgentPresets ¶
func LoadAgentPresets(cfg LoadAgentPresetsConfig) []AgentPreset
LoadAgentPresets discovers agent presets in increasing priority order: ANNA_HOME -> agent root -> user root -> project root.
type AgentTool ¶
type AgentTool struct {
// contains filtered or unexported fields
}
AgentTool spawns child agent loops for bounded subtasks.
func NewAgentTool ¶
func NewAgentTool(cfg AgentConfig) *AgentTool
NewAgentTool creates an agent tool with the given configuration.
func (*AgentTool) Definition ¶
func (t *AgentTool) Definition() tools.Definition
type LoadAgentPresetsConfig ¶
type LoadAgentPresetsConfig struct {
AnnaHome string // anna home dir (e.g. ~/.anna)
AgentRoot string // agent root dir (e.g. ~/.anna/workspaces/{agentID})
UserRoot string // user root dir (e.g. ~/.anna/workspaces/{agentID}/users/{userID})
ProjectRoot string // optional project root for local/project-attached runs
Runtime pkgplugins.ToolRuntime
}
LoadAgentPresetsConfig configures the agent preset discovery paths.
type PresetRegistry ¶
type PresetRegistry struct {
// contains filtered or unexported fields
}
PresetRegistry holds loaded agent presets with O(1) lookup.
func NewPresetRegistry ¶
func NewPresetRegistry(presets []AgentPreset) *PresetRegistry
NewPresetRegistry creates a registry from a slice of presets.
func (*PresetRegistry) All ¶
func (r *PresetRegistry) All() []AgentPreset
All returns all loaded presets.
func (*PresetRegistry) Lookup ¶
func (r *PresetRegistry) Lookup(name string) (AgentPreset, bool)
Lookup returns a preset by name and whether it exists.
func (*PresetRegistry) Names ¶
func (r *PresetRegistry) Names() []string
Names returns all available preset names in load order.
type SubAgentFinished ¶
type SubAgentFinished struct {
TaskID string `json:"taskId"`
Duration time.Duration `json:"duration"`
Error string `json:"error,omitempty"`
}
SubAgentFinished is emitted when a subagent task completes.
func (SubAgentFinished) Kind ¶
func (SubAgentFinished) Kind() string
type SubAgentStarted ¶
type SubAgentStarted struct {
TaskID string `json:"taskId"`
Preset string `json:"preset,omitempty"`
}
SubAgentStarted is emitted when a subagent task begins execution.
func (SubAgentStarted) Kind ¶
func (SubAgentStarted) Kind() string