Supervisor Pattern
One orchestrator agent decomposes work, delegates to specialist agents, and merges results — simple to reason about, but the orchestrator is the bottleneck and the single point of failure.
You have not marked these as done yet. Read on anyway if they feel familiar; come back to them if something here does not land.
Key points
- Specialists are tools from the supervisor's point of view.
- Send narrow briefs; never forward the whole conversation.
- Supervisor context grows with delegations — compress or reference results.
- Parallelise independent delegations; budget the total.
- Evaluate routing separately from specialist quality.
Mechanism
The supervisor is itself an agent whose tools are the other agents. delegate(agent="researcher", task="find 3 recent papers on X") is just a tool call whose implementation runs a sub-agent loop and returns its final answer as the tool result. This is why Supervisor Architecture was already reachable from the single-agent architecture lessons — it is single-agent with expensive tools.
The supervisor holds the plan and the running state; specialists hold only their sub-task. Good supervisors send narrow, self-contained briefs (goal, constraints, expected output format) because the specialist has no other context. Bad supervisors forward the entire conversation and pay the token bill three times.
1SPECIALISTS = {2 "researcher": Agent(system=RESEARCH_PROMPT, tools=[web_search, read_url]),3 "coder": Agent(system=CODER_PROMPT, tools=[read_file, write_file, run_tests]),4}5 6def delegate(agent: str, brief: str, max_turns: int = 8) -> str:7 """Run a specialist on a self-contained brief and return its final answer."""8 spec = SPECIALISTS[agent]9 return spec.run(brief, max_turns=max_turns, budget_tokens=20_000)10 11supervisor = Agent(system=SUPERVISOR_PROMPT, tools=[delegate, final_answer])Where it breaks
Every specialist result flows through the supervisor, so its context grows with the number of delegations. After 10 delegations returning 2k tokens each, the supervisor is carrying 20k tokens of results and its planning quality drops. Summarise results on the way in, or store them and pass references (Context Selection & Compression).
Delegations are sequential unless you make them parallel. A supervisor that issues one delegation per turn takes 5 × (specialist latency) for 5 independent sub-tasks. Use Parallel vs Sequential Tool Calls semantics: emit several delegate calls in one turn when tasks are independent.
The supervisor is also the place where "I have enough, stop" must be decided. Without an explicit budget it will keep delegating "one more check" (agent-loop-not-terminating).
- Give the supervisor a hard delegation budget (e.g. 6) and a token budget; make exceeding either a terminal state.
- Return structured results (
{summary, evidence, confidence}) from specialists so the supervisor can merge without re-reading everything. - Log each delegation as its own span with the brief and the result (Tracing Agents).
Evaluation
Evaluate specialists in isolation with their own golden briefs, then evaluate the supervisor on routing and merging with specialists stubbed to canned answers. If you only evaluate end to end, a regression in the coder looks identical to a regression in the supervisor's brief-writing.
When to use — and when not to
- Sub-tasks are heterogeneous and need different tools or prompts.
- One party must own the overall plan and final answer.
- Sub-tasks are dynamic — you do not know in advance which specialists are needed.
- The order of steps is fixed — use Pipeline Pattern or a workflow graph.
- Specialists need to talk to each other frequently — the supervisor becomes a relay.
- A single agent with the union of tools performs equally well on evals.
Failure modes
Reference · showHide
- Supervisor context bloat from raw specialist outputs.
- Serial delegation makes latency additive.
- Vague briefs → specialists solve the wrong problem confidently.
- No termination budget → infinite "verify once more" loops.
- Supervisor rewrites specialist findings and introduces errors during merge.
Tradeoffs
Check yourself
Answer out loud or on paper first, then compare. These come from the interview questions linked to this lesson.
What is the difference between a router architecture and a supervisor architecture, and when would you use each?
Show a strong answerHide the answer
A Router Architecture makes one decision at the start: classify the input and dispatch it to one of several specialised handlers, each of which completes the task on its own. The router is usually a cheap classifier or a small model with structured output; it runs once and exits the picture. A Supervisor Architecture stays in the loop: it decomposes the task, delegates sub-tasks to workers, receives their results, and decides what to do next, possibly many times.
Use a router when the inputs fall into distinct categories that need different handling and each category can be handled end-to-end by one path: support intents, document types, languages. Use a supervisor when a single task genuinely requires coordinating several capabilities whose results feed each other, such as research → analysis → drafting where the analysis result changes what to research next.
The supervisor is much more expensive: every round trip is an LLM call, context grows with worker outputs, and the supervisor becomes a single point of failure. Routers are cheap, fast, and testable as classifiers.
Full interview question, with follow-ups and red flags →When does splitting a system into multiple agents improve it, and when does it make the system worse?
Show a strong answerHide the answer
A split helps when the parts have genuinely different responsibilities that would otherwise crowd one prompt, need independent context (a reviewer should not see the drafter's reasoning, or a worker needs 50k tokens of documents the coordinator does not), need different capabilities (different tools, permissions, or models, such as a cheap model for extraction and a strong one for judgement), or can run in parallel on independent sub-tasks. The boundary between agents must be a clear, typed contract. See Multi-Agent Systems Overview and When Not to Use Multi-Agent.
It makes the system worse when the agents share most of their context (you now pay to transmit it), when the task is sequential and one agent could do it with a longer prompt, when coordination requires many round trips (each is an LLM call plus latency), or when nobody can say what each agent is responsible for. Information is lost at every hand-off because agents summarise for each other, and errors compound across hops.
The precondition is always: can this be solved reliably with one agent or a deterministic workflow? If yes, the split is cost without benefit. If not, I introduce the smallest number of agents with the clearest boundaries and evaluate the whole system end-to-end, not each agent in isolation.
Full interview question, with follow-ups and red flags →How do you evaluate a router?
Show a strong answerHide the answer
Labeled set, confusion matrix, per-class precision and recall, calibration of the confidence used for the unsure threshold.
Full interview question, with follow-ups and red flags →