Multi-agent patterns
Multi-agent patterns describe how several AI agents work together โ instead of a single agent doing everything alone.
Why several agents instead of one?
A single agent has a limited context window and works step by step. For large tasks โ extensive research, complex codebases โ that runs into limits. Multiple specialized or parallel agents can get around this, but cost more tokens and need coordination.
Common patterns
- Orchestrator-worker: a lead agent (orchestrator) breaks a task down, delegates parts to subagents, and combines their results. Anthropic's own research system uses exactly this pattern: a lead agent coordinates multiple specialized subagents that investigate different aspects of a question in parallel.
- Sequential pipeline: the output of agent A becomes the input for agent B, which passes it on to agent C โ like an assembly line.
- Parallel fan-out: multiple agents work independently on different sub-problems at the same time, and the results are merged at the end.
- Review/debate: one agent produces a solution, a second, independent agent checks or critiques it before it's approved.
The tradeoff
More agents means more tokens, more cost, and more coordination overhead โ but also more parallelism, better specialization, and a cleaner main context, because intermediate steps stay in their respective subagent contexts instead of flooding the main context.
EXAMPLE
Conceptual example: an orchestrator agent gets the task 'Compare three cloud providers.' It sends out three subagents that each research one provider in parallel, and at the end combines their results into a comparison.
QUICK QUIZ
What is the orchestrator-worker pattern in multi-agent systems?
SOURCES
- Anthropic Engineering: How we built our multi-agent research system โ www.anthropic.com
- Claude Code Doku: Subagents โ code.claude.com