Skip to content

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)

Hierarchical pattern: Manager assigns to Worker 1, 2, 3ManagerWorker 1Worker 2Worker 3

Peer-to-peer

text
┌───┐    ┌───┐
│ A │ ←→ │ B │
└───┘    └───┘
  ↑  ╲  ╱  ↑
  │   ╲╱   │
  │   ╱╲   │
  ↓  ╱  ╲  ↓
┌───┐    ┌───┐
│ C │ ←→ │ D │
└───┘    └───┘

Pipeline

Pipeline: Input flows through Agent A (analysis), Agent B (design), Agent C (implementation) to OutputInputAgent AAgent BAgent COutput

SDK built-in multi-agent

Full access preview

Continue with full access

You're reading a preview. Full access unlocks the full lesson, its flashcards and exercise.

Sign in to unlock

One purchase unlocks Stages 2–3, Specials, exercises and future updates