Expand description
Spawn Agent Tool (MVP 8 Phase 2)
Internal tool for recursive agent spawning. Allows an agent to delegate subtasks to child agents, enabling hierarchical task decomposition.
§Depth Limit
To prevent infinite recursion, each spawn tracks depth and enforces limits:
- Default limit: 3 levels
- Maximum limit: 10 levels
- Spawning at max depth returns an error
§Events
Spawning emits an AgentSpawned event with:
parent_task_id: The spawning agent’s task IDchild_task_id: The new agent’s task IDdepth: Current recursion depth
§rig::ToolDyn Integration
SpawnAgentTool implements rig::tool::ToolDyn for seamless integration
with RigAgentLoop. When an agent has depth_limit > current_depth,
the spawn_agent tool is automatically added to its tool list.
§Example
{
"task_id": "subtask-1",
"prompt": "Generate the header section",
"context": {"entity": "qr-code"},
"max_turns": 5
}Structs§
- Spawn
Agent Params - Parameters for spawning a child agent
- Spawn
Agent Tool - Internal tool for spawning sub-agents
Enums§
- Spawn
Agent Error - Errors that can occur when spawning agents