Skip to main content

Pattern · Agents

Supervisor and sub-agents

A lead agent splits work into parts, runs sub-agents with fresh contexts in parallel, and merges their summaries.

Say it in the interview

I would start with one agent and only split when parts are independent or the context overflows; then a lead plans, sub-agents run in parallel with their own tools, and each returns a short sourced summary.

When to use it

  • Independent parts that can run in parallel
  • One context window cannot hold everything

How it works

  1. Lead agent: plan the parts → Sub-agent A (own context and tools)
  2. Lead agent: plan the parts → Sub-agent B (own context and tools)
  3. Lead agent: plan the parts → Sub-agent C (own context and tools)
  4. Sub-agent A (own context and tools) → short summary → Lead merges and checks conflicts
  5. Sub-agent B (own context and tools) → short summary → Lead merges and checks conflicts
  6. Sub-agent C (own context and tools) → short summary → Lead merges and checks conflicts

Trade-offs

  • Parallel and clean contexts
  • Several times the tokens of one agent
  • Harder to debug

Pitfalls interviewers probe

  • Multi-agent where one agent would do
  • Sub-agents returning whole transcripts instead of summaries

Practise it on these questions

Today's AI turns are used

Lessons, roadmaps, videos, practice cards and the code playground stay free with your account, with no limit.