Documentation
¶
Index ¶
- type Agent
- func (a *Agent) AddMessage(msg provider.Message)
- func (a *Agent) CheckpointManager() *checkpoint.Manager
- func (a *Agent) Clear()
- func (a *Agent) ContextManager() ctxpkg.ContextManager
- func (a *Agent) Messages() []provider.Message
- func (a *Agent) PermissionPolicy() permission.PermissionPolicy
- func (a *Agent) Provider() provider.Provider
- func (a *Agent) RunStream(ctx context.Context, userMsg string, onEvent func(provider.StreamEvent)) error
- func (a *Agent) RunStreamWithContent(ctx context.Context, content []provider.ContentBlock, ...) error
- func (a *Agent) SetApprovalHandler(fn func(toolName string, input string) permission.Decision)
- func (a *Agent) SetCheckpointManager(m *checkpoint.Manager)
- func (a *Agent) SetContextManager(cm ctxpkg.ContextManager)
- func (a *Agent) SetDiffConfirm(fn DiffConfirmFunc)
- func (a *Agent) SetHookConfig(cfg hooks.HookConfig)
- func (a *Agent) SetInterruptionHandler(fn func() string)
- func (a *Agent) SetPermissionPolicy(policy permission.PermissionPolicy)
- func (a *Agent) SetProvider(p provider.Provider)
- func (a *Agent) SetUsageHandler(fn func(usage provider.TokenUsage))
- func (a *Agent) SetWorkingDir(dir string)
- type DiffConfirmFunc
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 orchestrates the agentic loop: send messages to LLM, execute tool calls, loop.
func (*Agent) AddMessage ¶
AddMessage appends a message to the conversation context.
func (*Agent) CheckpointManager ¶
func (a *Agent) CheckpointManager() *checkpoint.Manager
CheckpointManager returns the checkpoint manager.
func (*Agent) ContextManager ¶
func (a *Agent) ContextManager() ctxpkg.ContextManager
func (*Agent) PermissionPolicy ¶
func (a *Agent) PermissionPolicy() permission.PermissionPolicy
PermissionPolicy returns the current policy.
func (*Agent) RunStream ¶
func (a *Agent) RunStream(ctx context.Context, userMsg string, onEvent func(provider.StreamEvent)) error
RunStream runs the agent loop with streaming, sending events to the callback.
func (*Agent) RunStreamWithContent ¶
func (a *Agent) RunStreamWithContent(ctx context.Context, content []provider.ContentBlock, onEvent func(provider.StreamEvent)) error
RunStreamWithContent runs the agent loop and emits UI events for complete model turns.
func (*Agent) SetApprovalHandler ¶
func (a *Agent) SetApprovalHandler(fn func(toolName string, input string) permission.Decision)
SetApprovalHandler sets a callback for interactive approval (Ask → Deny by default). If nil, Ask decisions are treated as Deny.
func (*Agent) SetCheckpointManager ¶
func (a *Agent) SetCheckpointManager(m *checkpoint.Manager)
SetCheckpointManager sets the checkpoint manager for undo support.
func (*Agent) SetContextManager ¶
func (a *Agent) SetContextManager(cm ctxpkg.ContextManager)
SetContextManager replaces the default context manager.
func (*Agent) SetDiffConfirm ¶
func (a *Agent) SetDiffConfirm(fn DiffConfirmFunc)
SetDiffConfirm sets the diff confirmation callback.
func (*Agent) SetHookConfig ¶
func (a *Agent) SetHookConfig(cfg hooks.HookConfig)
SetHookConfig sets the hooks configuration.
func (*Agent) SetInterruptionHandler ¶ added in v1.1.15
SetInterruptionHandler sets a callback that drains user guidance arriving mid-run.
func (*Agent) SetPermissionPolicy ¶
func (a *Agent) SetPermissionPolicy(policy permission.PermissionPolicy)
SetPermissionPolicy sets the permission policy for tool checks.
func (*Agent) SetProvider ¶
ContextManager returns the context manager for external inspection.
func (*Agent) SetUsageHandler ¶
func (a *Agent) SetUsageHandler(fn func(usage provider.TokenUsage))
SetUsageHandler sets a callback invoked after each API call with token usage.
func (*Agent) SetWorkingDir ¶
SetWorkingDir sets the working directory for hooks.
type DiffConfirmFunc ¶
Agent orchestrates the agentic loop: send messages to LLM, execute tool calls, loop. DiffConfirmFunc is called before a file write to request user confirmation. It receives the file path and unified diff string, and returns true if approved.