Documentation
¶
Index ¶
- func GetDefaultPrompt() string
- func GetPlatformContext(allowedCommands []string, allowedBuiltins []string) string
- func InjectAvailableRoles(prompt string, availableRoles []string) string
- func InjectPlatformContext(prompt string, allowedCommands []string, allowedBuiltins []string) string
- func InjectPlatformContextFromRegistry(prompt string, reg tool.Registry) string
- type Agent
- func (a *Agent) Checkpoint(ctx context.Context) error
- func (a *Agent) InvalidateToolCache()
- func (a *Agent) LoadState(ctx context.Context, id string) error
- func (a *Agent) Resume(ctx context.Context) error
- func (a *Agent) Run(ctx context.Context, input string) (string, error)
- func (a *Agent) SaveState(ctx context.Context, id string) error
- func (a *Agent) Trace(ctx context.Context, typ trace.EventType, data any)
- type ErrorHandlingConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDefaultPrompt ¶
func GetDefaultPrompt() string
GetDefaultPrompt loads the canonical agent_0 prompt from the role file
func GetPlatformContext ¶
GetPlatformContext returns OS-specific guidance for agents with tiered tool hierarchy
func InjectAvailableRoles ¶
InjectAvailableRoles adds available agent role information to the prompt
func InjectPlatformContext ¶
Types ¶
type Agent ¶
type Agent struct {
ID uuid.UUID
Client model.Client
ModelName string
Tools tool.Registry
Mem memory.Store
Vector memory.VectorStore
Vars map[string]string // cloned on spawn to avoid shared mutation
Tracer trace.Writer
Cost *cost.Manager
Prompt string
// Error handling configuration
ErrorHandling ErrorHandlingConfig
// contains filtered or unexported fields
}
Agent represents a conversational agent with LLM capabilities
func (*Agent) Checkpoint ¶
Checkpoint persists the agent's current loop state under its ID.
func (*Agent) InvalidateToolCache ¶
func (a *Agent) InvalidateToolCache()
InvalidateToolCache clears the cached tool name slice (call after mutating Tools)
type ErrorHandlingConfig ¶
type ErrorHandlingConfig struct {
// TreatErrorsAsResults makes tool errors visible to the agent instead of terminating
TreatErrorsAsResults bool
// MaxErrorRetries limits how many consecutive errors an agent can handle
MaxErrorRetries int
// IncludeErrorContext adds detailed error context to help with recovery
IncludeErrorContext bool
}
ErrorHandlingConfig defines how the agent handles errors
func DefaultErrorHandling ¶
func DefaultErrorHandling() ErrorHandlingConfig
DefaultErrorHandling returns sensible defaults for error handling
Click to show internal directories.
Click to hide internal directories.