Sub-Agent Spawning
The agent can spawn child agents for complex tasks, enabling recursive delegation.
Tool Name
spawn_agent
Parameters
| Key | Type | Default | Description |
|---|---|---|---|
mission | string | โ | High-level role/context for the sub-agent |
task | string | โ | Concrete question or work to accomplish |
Behavior
- Child agent runs at
parent_depth + 1 - Inherits parent's provider, state store, model, and non-spawn tools
- Gets a focused system prompt: base instructions + mission context
- Runs a complete agentic loop in an isolated session (
sub-{depth}-{uuid}) - Returns final text response to parent (truncated to
max_response_chars) - If
child_depth < max_depth, child also gets thespawn_agenttool
Configuration
config.toml
[subagents]
enabled = true
max_depth = 3
max_iterations = 10
max_response_chars = 8000
timeout_secs = 300Recursion Limit
Sub-agents can spawn their own sub-agents up to
max_depth levels deep. At max depth, the spawn_agent tool is not provided.Timeout
Each sub-agent invocation has a hard timeout (
timeout_secs). If a sub-agent takes too long, the parent receives a timeout error.