Multi-Agent Systems
Multi-agent systems solve complex tasks through specialization and hierarchical orchestration. Learn the SDK's built-in delegation model, dynamic workflows, and when to build custom patterns beyond them.
SDK focusagents{}AgentDefinitionhooks.SubagentStart/StopStop hook cleanupWorkflow toolultracodemaxTurns
Why multi-agent?
- Specialization - Different agents focus on different domains
- Parallelism - Multiple agents work at the same time
- Failure isolation - Bound one worker's failure when the orchestrator has fallbacks
- Scalability - Add agents as needed
Collaboration patterns
Hierarchical (manager-worker)
Peer-to-peer
text
┌───┐ ┌───┐
│ A │ ←→ │ B │
└───┘ └───┘
↑ ╲ ╱ ↑
│ ╲╱ │
│ ╱╲ │
↓ ╱ ╲ ↓
┌───┐ ┌───┐
│ C │ ←→ │ D │
└───┘ └───┘