Supervisor / Orchestrator-Worker Pattern
One lead agent plans and delegates, and specialized workers run in parallel contexts and report back. Anthropic's Research system uses this pattern with Claude Opus 4 as lead and Sonnet 4 as subagents, and measured +90.2% over single-agent Opus 4 on internal research evals. Their engineering post reports that token usage alone explains 80% of the variance on BrowseComp, which suggests fresh context per subagent accounts for much of the win. Here you build the pattern from primitives, then walk through the production lessons from that post.
Learning Objectives
- Explain why a lead plus parallel workers beats a single agent on research tasks, using fresh context, prompt specialization and parallelism.
- Describe the Anthropic Research system's pairing, results and production lessons: scale effort, broad then narrow, rainbow deployment, token cost.
- Run the threaded toy supervisor and read its trace, separating measured values from printed strings.
- Identify the failure modes (hallucinated plan, over-exploring workers, synthesis conflict) and the cases where a supervisor is the wrong choice.
- Apply the Ship It checklist to a supervisor design.
Problem
Research is a task single agents tend to fail. Ask "what changed in multi-agent systems between 2023 and 2026?" and a single agent reads five papers one after another, fills half its context with their text, and then has to reason over all of them at once. By the fifth paper it is liable to lose its grip on the first. It also cannot parallelize.
The supervisor pattern splits the job. One lead agent plans the search, hands each sub-question to a worker, and synthesizes the answers. Each worker gets its own 200k-token window for a narrow question. The lead sees the worker summaries rather than the raw papers.
Anthropic's production Research system reports +90.2% on internal research evals against a single Opus 4. The same post says 80% of the BrowseComp variance is explained by token usage alone, and fresh context per subagent is the main mechanism behind that.
Concept
The pattern
┌──────────────┐
│ Lead │ plans, decomposes,
│ (Opus 4) │ synthesizes
└──┬────┬───┬──┘
│ │ │
┌───────┘ │ └───────┐
▼ ▼ ▼
┌─────────┐ ┌─────────┐ ┌─────────┐
│ Worker1 │ │ Worker2 │ │ Worker3 │
│(Sonnet) │ │(Sonnet) │ │(Sonnet) │
└─────────┘ └─────────┘ └─────────┘
fresh fresh fresh
context context context
The lead reads worker summaries, not the raw materials. Workers don't see each other's work until the lead synthesizes. Each arrow is a handoff with a narrow artifact.
Why it wins
Three mechanisms:
- Fresh context per subagent. A worker exploring "FIPA-ACL heritage" does not carry the 40k tokens the lead spent planning. It gets a 200k window for one question.
- Specialization via prompt. The lead's prompt is "decompose and synthesize," not "research." Each worker's prompt is narrow: "find what changed in X." Focused prompts produce focused outputs.
- Parallelism. Workers run concurrently, so wall-clock time is roughly
max(worker_times) + plan + synthesis, notsum(worker_times).
Engineering lessons (Anthropic 2025)
The Anthropic post lists several production lessons that still hold in 2026:
- Scale effort to query complexity. Simple queries get one agent making 3-10 tool calls. Complex queries get 10+ agents. The lead has to estimate this, not the caller.
- Broad then narrow. Decompose into broad sub-questions first, then spawn more workers per sub-question if the answer warrants depth.
- Rainbow deployments. Agents are long-running and stateful, so blue-green doesn't work. Anthropic uses rainbow: a gradual rollout of new versions while old ones drain.
- Token usage dominates. Multi-agent uses roughly 15× the tokens of single-agent, so run it only when the task value justifies the cost.
The LangGraph turn
LangGraph originally shipped a langgraph-supervisor library with a high-level create_supervisor helper. In 2025 LangChain moved the recommendation to implementing the supervisor pattern via tool-calling directly, because tool calls give more control over what the supervisor sees (context engineering). The library still works, but the docs now recommend the tool-calling form.
The failure modes
- Lead hallucinates the plan. If the lead generates sub-questions that do not decompose the real question, workers do precise research on the wrong target.
- Workers over-explore. Without explicit scope boundaries, workers drift beyond their assigned sub-question and pollute the synthesis step.
- Synthesis conflicts. Two workers return contradictory facts. The lead must either re-ask (add a round) or note the disagreement explicitly. Silently picking one side is the worst failure, because the user never learns a disagreement happened.
When supervisor is wrong
- Sequential tasks. If step 2 literally needs step 1's output, parallelism buys nothing. Use a pipeline (CrewAI Sequential, LangGraph linear graph).
- Simple queries. A single agent handles them faster and cheaper. Run the lead's "scale effort" check before spawning workers.
- Strict determinism. The supervisor delegates by LLM choice. Static graphs fit better when audit and replay matter more than adaptability.
Build It
code/main.py implements a supervisor with three parallel workers using threading. The lead decomposes a query into sub-questions, the workers run concurrently, one sub-question each, and the lead synthesizes. The workers are scripted to simulate fetch-and-summarize, so there are no LLM calls.
Key structure:
Lead.plan(query)returns three sub-questions built from fixed templates (historical origins, state of the art 2026, open problems). A real lead would use an LLM here.Worker.run(sub_q, results, idx)sleeps 0.3 seconds to stand in for a fetch, then writes aWorkerResultinto its own slot of a shared list. Each thread owns one index, so only the trace needs a lock.Lead.run(query)starts one thread per sub-question, joins them all, and callssynthesize, which concatenates the worker summaries into one answer. It does not compare them against each other.
Run:
python3 code/main.py
Output shows the trace with start and done events per worker, the final synthesis, and a stats block. You can see the wall-clock win: three 0.3-second workers finish in about 0.35 seconds, not 0.9. Threads work here because time.sleep releases the GIL, which is also what an agent waiting on a model or tool call does. The token counts in the stats are constants (800 per worker plus 1200 for the lead), not measurements.
Use It
outputs/skill-supervisor-designer.md takes a user query and produces a supervisor design: lead system prompt, worker roles, decomposition rules, and the synthesis template. Run it before building a new research-style agent system.
Ship It
Checklist before deploying a supervisor pattern:
- Model pairing. Lead on a reasoning-tier model (Opus class,
o3class). Workers on a faster, cheaper model (Sonnet,o4-mini). - Worker timeout. Kill any worker that exceeds 2× median runtime. The lead either re-spawns it with narrower scope or proceeds without it.
- Token cap per worker. A hard limit (say 10× the expected synthesis input) keeps a runaway worker from blowing the budget.
- Observability. Trace the lead's plan, each worker's tool calls, and the synthesis. This is the basis for post-hoc debugging.
- Rainbow rollout. Stateful long-running agents need a gradual version transition, not a hot swap.
I'd run code/main.py and read the trace before anything else. The three worker start lines print almost together and the done lines follow about 0.3 seconds later, which puts the case for parallel subagents on one screen. The "~0.9s sequential versus ~0.35s parallel" lines at the bottom are printed strings, though, so trust wall_clock_seconds in the stats instead.
The part I'd study is how little the lead does after the workers return. synthesize formats the summaries into a list, so a contradiction between two workers passes straight into the answer, unflagged. That is the synthesis-conflict failure from the Concept section, and Exercise 3 is where I'd spend my time, because detecting disagreement without an LLM call is harder than it sounds.
I'd also keep the toy in proportion. It has no worker timeout and no token cap, and total_tokens is bookkeeping rather than cost. Those two items from the Ship It checklist are what I'd add first.
Exercises
- Run
code/main.py, then modify the lead to spawn 5 workers instead of 3. Observe the wall-clock effect. At what worker count does spawn overhead exceed parallel savings in this demo? - Implement a worker timeout: kill any worker that runs longer than 0.5 seconds and have the lead synthesize the remaining results. What observability do you need to know a worker was cut?
- Add a conflict-detection step to the lead's synthesis: if two workers return contradictory answers, the lead notes the disagreement rather than picking one. How do you detect contradiction without calling an LLM?
- Read Anthropic's Research-system engineering post. List three practices that this toy demo would need to adopt to run in production.
- Compare LangGraph's
create_supervisor(legacy) vs the new tool-calling recommendation. Which gives you better control over what the supervisor sees? Why does Anthropic explicitly pass only sub-answers and not raw worker context into synthesis?
Key Terms
| Term | What people say | What it actually means |
|---|---|---|
| Supervisor | "Lead agent" | An orchestrator agent that plans, delegates, and synthesizes. Does not do the work itself. |
| Worker | "Subagent" | A focused agent invoked by the supervisor with narrow scope and its own context window. |
| Orchestrator-worker | "Supervisor pattern" | Same thing, different name. The 2026 literature uses both. |
| Fresh context | "Clean window" | A worker's context starts from its system prompt and assigned question, not the lead's history. |
| Rainbow deployment | "Gradual rollout" | Long-running stateful agents need versioned drain-and-replace, not blue-green. |
| Token dominance | "Context is the variable" | 80% of research-eval variance comes from total tokens used, not model choice, per Anthropic. |
| Scale effort | "Match agent count to complexity" | Lead estimates query difficulty, spawns 1 vs 10+ workers accordingly. |
| Synthesis conflict | "Workers disagree" | Two workers return contradictory facts; the lead must surface disagreement, not silently pick one. |
Further Reading
- Anthropic engineering: How we built our multi-agent research system: the production reference for the supervisor pattern
- LangGraph workflows and agents: the tool-calling supervisor is now the recommended form
- LangGraph supervisor reference: the legacy helper, still used in 2026 production
- OpenAI cookbook: Orchestrating Agents: Routines and Handoffs: handoff-based supervisor variant
Code
- main.py (python, 147 lines)