Documentation
¶
Index ¶
- type Agent
- func (a *Agent) AddDate() bool
- func (a *Agent) AddEnvironmentInfo() bool
- func (a *Agent) AddPromptFiles() []string
- func (a *Agent) Commands() types.Commands
- func (a *Agent) ConfiguredModels() []provider.Provider
- func (a *Agent) Description() string
- func (a *Agent) DrainWarnings() []string
- func (a *Agent) FallbackCooldown() time.Duration
- func (a *Agent) FallbackModels() []provider.Provider
- func (a *Agent) FallbackRetries() int
- func (a *Agent) Handoffs() []*Agent
- func (a *Agent) HasModelOverride() bool
- func (a *Agent) HasSubAgents() bool
- func (a *Agent) Hooks() *latest.HooksConfig
- func (a *Agent) Instruction() string
- func (a *Agent) MaxIterations() int
- func (a *Agent) Model() provider.Provider
- func (a *Agent) Name() string
- func (a *Agent) NumHistoryItems() int
- func (a *Agent) Parents() []*Agent
- func (a *Agent) SetModelOverride(models ...provider.Provider)
- func (a *Agent) StopToolSets(ctx context.Context) error
- func (a *Agent) SubAgents() []*Agent
- func (a *Agent) ThinkingConfigured() bool
- func (a *Agent) ToolSets() []tools.ToolSet
- func (a *Agent) Tools(ctx context.Context) ([]tools.Tool, error)
- func (a *Agent) WelcomeMessage() string
- type Opt
- func WithAddDate(addDate bool) Opt
- func WithAddDescriptionParameter(addDescriptionParameter bool) Opt
- func WithAddEnvironmentInfo(addEnvironmentInfo bool) Opt
- func WithAddPromptFiles(addPromptFiles []string) Opt
- func WithCommands(commands types.Commands) Opt
- func WithDescription(description string) Opt
- func WithFallbackCooldown(cooldown time.Duration) Opt
- func WithFallbackModel(model provider.Provider) Opt
- func WithFallbackRetries(retries int) Opt
- func WithHandoffs(handoffs ...*Agent) Opt
- func WithHooks(hooks *latest.HooksConfig) Opt
- func WithInstruction(instruction string) Opt
- func WithLoadTimeWarnings(warnings []string) Opt
- func WithMaxIterations(maxIterations int) Opt
- func WithModel(model provider.Provider) Opt
- func WithName(name string) Opt
- func WithNumHistoryItems(numHistoryItems int) Opt
- func WithSubAgents(subAgents ...*Agent) Opt
- func WithThinkingConfigured(configured bool) Opt
- func WithToolSets(toolSet ...tools.ToolSet) Opt
- func WithTools(allTools ...tools.Tool) Opt
- func WithWelcomeMessage(welcomeMessage string) Opt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
Agent represents an AI agent
func (*Agent) AddEnvironmentInfo ¶
func (*Agent) AddPromptFiles ¶
func (*Agent) ConfiguredModels ¶
ConfiguredModels returns the originally configured models for this agent. This is useful for listing available models in the TUI picker.
func (*Agent) Description ¶
Description returns the agent's description
func (*Agent) DrainWarnings ¶
DrainWarnings returns pending warnings and clears them.
func (*Agent) FallbackCooldown ¶
FallbackCooldown returns the duration to stick with a successful fallback model before retrying the primary. Returns 0 if not configured.
func (*Agent) FallbackModels ¶
FallbackModels returns the fallback models to try if the primary model fails.
func (*Agent) FallbackRetries ¶
FallbackRetries returns the number of retries per fallback model.
func (*Agent) HasModelOverride ¶
HasModelOverride returns true if a model override is currently set.
func (*Agent) HasSubAgents ¶
HasSubAgents checks if the agent has sub-agents
func (*Agent) Hooks ¶
func (a *Agent) Hooks() *latest.HooksConfig
Hooks returns the hooks configuration for this agent.
func (*Agent) Instruction ¶
Instruction returns the agent's instructions
func (*Agent) MaxIterations ¶
func (*Agent) Model ¶
Model returns the model to use for this agent. If model override(s) are set, it returns one of the overrides (randomly for alloy). Otherwise, it returns a random model from the available models.
func (*Agent) NumHistoryItems ¶
func (*Agent) SetModelOverride ¶
SetModelOverride sets runtime model override(s) for this agent. The override(s) take precedence over the configured models. For alloy models, multiple providers can be passed and one will be randomly selected. Pass no arguments or nil providers to clear the override.
func (*Agent) ThinkingConfigured ¶
ThinkingConfigured returns true if thinking_budget was explicitly set in the agent's config. This is used to initialize session thinking state - thinking is only enabled by default when the user explicitly configured it in their YAML.
func (*Agent) WelcomeMessage ¶
WelcomeMessage returns the agent's welcome message
type Opt ¶
type Opt func(a *Agent)
func WithAddDate ¶
func WithAddEnvironmentInfo ¶
func WithAddPromptFiles ¶
func WithCommands ¶
func WithDescription ¶
func WithFallbackCooldown ¶
WithFallbackCooldown sets the duration to stick with a successful fallback model before retrying the primary. Only applies after a non-retryable error (e.g., 429).
func WithFallbackModel ¶
WithFallbackModel adds a fallback model to try if the primary model fails. For retryable errors (5xx, timeouts), the same model is retried with backoff. For non-retryable errors (429), we immediately move to the next model in the chain.
func WithFallbackRetries ¶
WithFallbackRetries sets the number of retries per fallback model with exponential backoff.
func WithHandoffs ¶
func WithHooks ¶
func WithHooks(hooks *latest.HooksConfig) Opt
func WithInstruction ¶
func WithLoadTimeWarnings ¶
func WithMaxIterations ¶
func WithNumHistoryItems ¶
func WithSubAgents ¶
func WithThinkingConfigured ¶
WithThinkingConfigured sets whether thinking_budget was explicitly configured in the agent's YAML. When true, the session will initialize with thinking enabled.