Multi-Agent Systems

Orchestrators, sub-agents and handoffs: when splitting work across agents helps and when it just multiplies cost and confusion.

Advanced · about 5 hours · difficulty 4/5

Learn first: Planning, Reflection and Long Tasks, Memory and Context Engineering

A multi-agent system uses several model instances with different instructions, tools or context. It can parallelize work and keep each context focused, but every extra agent adds latency, cost and new ways to miscommunicate.

Common topologies

  • Orchestrator and workers: a lead agent breaks the task down, launches sub-agents with fresh context for each piece (for example parallel research threads), and merges their results.
  • Handoffs / routing: a triage agent hands the conversation to a specialist (billing, technical support) that owns the next turns.
  • Evaluator and optimizer: one agent produces, another critiques, repeat until the critic is satisfied.
  • Pipelines: agents in a fixed sequence, which is really a workflow with model steps.

When it helps

  • The task splits into independent pieces that benefit from parallel exploration.
  • Sub-tasks need different tools or permissions that you want isolated.
  • A single context would overflow with irrelevant detail.

When it hurts

Tightly coupled tasks (such as editing one codebase) suffer when agents cannot see each other's decisions. Multi-agent runs can use many times the tokens of a single agent, so measure whether quality actually improves.

Engineering details

Give sub-agents clear, self-contained briefs: goal, constraints, output format and budget. Return condensed results to the orchestrator, not full transcripts. Trace the whole tree with parent and child ids.

Good enough to move on

You can build an orchestrator that spawns two or three parallel sub-agents, merges their outputs and compare it against a single agent on the same eval set for quality, cost and latency.

Key concepts

  • Orchestrator-worker pattern
  • Handoffs and routing
  • Evaluator-optimizer loops
  • Writing sub-agent briefs
  • Parallel execution
  • Cost and coordination trade-offs
  • Agent-to-agent protocols (A2A)

Mini project

Build a 'compare three products' research system where an orchestrator launches one sub-agent per product in parallel and writes a comparison table, then report its token cost versus a single-agent version.

Check yourself

Give one task that benefits from multiple agents and one that gets worse. What property of the task decides it?

Free resources