Documentation
¶
Overview ¶
Package subagents provides foreground subagent spawning for task delegation. A subagent is a fully independent agent loop with its own LLM client, tool registry, and message history. It inherits the parent's config, persona, grimoire, and permissions but runs in isolation. For v1.8, subagents run in the foreground (blocking) with no inter-agent messaging.
Index ¶
- type Manager
- type SpawnAgentTool
- func (t *SpawnAgentTool) Description() string
- func (t *SpawnAgentTool) Execute(ctx context.Context, input map[string]any, progress chan<- tools.ProgressEvent) (tools.ToolResult, error)
- func (t *SpawnAgentTool) InterruptBehavior() tools.InterruptBehavior
- func (t *SpawnAgentTool) IsConcurrencySafe(input map[string]any) bool
- func (t *SpawnAgentTool) IsReadOnly() bool
- func (t *SpawnAgentTool) Name() string
- func (t *SpawnAgentTool) Parameters() json.RawMessage
- func (t *SpawnAgentTool) ValidateInput(input map[string]any) error
- type SubagentRun
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles subagent lifecycle and execution.
func NewManager ¶
NewManager creates a subagent manager. Pass isChild=true when the manager itself is running inside a subagent to block recursive spawning.
func (*Manager) GetRun ¶
func (m *Manager) GetRun(id string) (*SubagentRun, bool)
GetRun returns a subagent run by ID.
func (*Manager) ListRuns ¶
func (m *Manager) ListRuns() []*SubagentRun
ListRuns returns all subagent runs, most recent first.
type SpawnAgentTool ¶
type SpawnAgentTool struct {
// contains filtered or unexported fields
}
SpawnAgentTool is a built-in tool that allows the model to spawn subagents for task delegation. The subagent runs in the foreground (blocks until complete) and returns its final result.
func NewSpawnAgentTool ¶
func NewSpawnAgentTool(manager *Manager) *SpawnAgentTool
NewSpawnAgentTool creates a new spawn_agent tool backed by the given manager.
func (*SpawnAgentTool) Description ¶
func (t *SpawnAgentTool) Description() string
func (*SpawnAgentTool) Execute ¶
func (t *SpawnAgentTool) Execute(ctx context.Context, input map[string]any, progress chan<- tools.ProgressEvent) (tools.ToolResult, error)
func (*SpawnAgentTool) InterruptBehavior ¶
func (t *SpawnAgentTool) InterruptBehavior() tools.InterruptBehavior
func (*SpawnAgentTool) IsConcurrencySafe ¶
func (t *SpawnAgentTool) IsConcurrencySafe(input map[string]any) bool
func (*SpawnAgentTool) IsReadOnly ¶
func (t *SpawnAgentTool) IsReadOnly() bool
func (*SpawnAgentTool) Name ¶
func (t *SpawnAgentTool) Name() string
func (*SpawnAgentTool) Parameters ¶
func (t *SpawnAgentTool) Parameters() json.RawMessage
func (*SpawnAgentTool) ValidateInput ¶
func (t *SpawnAgentTool) ValidateInput(input map[string]any) error
type SubagentRun ¶
type SubagentRun struct {
ID string `json:"id"`
Goal string `json:"goal"`
Workspace string `json:"workspace"`
Status string `json:"status"` // "running", "completed", "failed"
Result string `json:"result"`
Error string `json:"error,omitempty"`
StartedAt time.Time `json:"started_at"`
EndedAt time.Time `json:"ended_at,omitempty"`
Turns int `json:"turns"`
}
SubagentRun tracks the state and result of a spawned subagent.