Orchestrator–Workers
Also known as: lead agent and subagents, dynamic delegation, manager pattern or agents-as-tools (OpenAI), subagents pattern (LangChain), centralized multi-agent system (Google Research)
Intent
A lead model reads the request, works out which subtasks it needs, and hands each one to a worker that starts with a fresh context. Workers send back short, structured results, and the lead merges them or plans another round. The split is decided by the model at run time, not written by the developer in code.
Problem
A platform team wants an internal assistant that answers tooling questions. A developer asks: "Compare Vitest, Jest and the built-in node:test runner for our TypeScript monorepo (about 1,200 test files, on Jest today). Cover CI speed, ecosystem and migration effort, and recommend one."
A single agent with web search and read access to the repository tries to do it all in one conversation. It works on small questions and breaks on this one:
- The context fills up. Every docs page, benchmark and config file it reads stays in the conversation. By the time it reaches node:test, the Vitest material from the start is buried or truncated, and the later items get thinner treatment.
- It is slow. It researches one runner after another, although the three investigations do not depend on each other.
- A fixed pipeline does not help. The next request ("audit every route handler for missing auth checks") needs a completely different split. Neither the number of subtasks nor their content is known before the request arrives.
- One prompt does every job. Search strategy, judging sources, reading the codebase and writing the report all share one prompt, with every tool loaded at once.
Solution
Split the system into a lead (the orchestrator) and workers. The lead plans, writes briefs and combines results; it does little of the reading itself. Each worker gets one brief, an empty context, a small set of tools and a budget, and returns a condensed result instead of its transcript.
- Plan. The lead classifies the request as a comparison and decides on four subtasks: CI speed and features of Vitest, of Jest, of node:test, and an inventory of the Jest-specific APIs the monorepo uses (mocks, custom matchers, config).
- Brief. For each subtask it writes a self-contained brief: the objective, why it matters, what the other workers cover (so the Vitest worker leaves Jest alone), which sources to prefer, a tool-call budget, when to stop, and the result format.
- Dispatch. Runtime code starts the workers in parallel, under a concurrency limit. Three use web search; the fourth has read-only access to the repository.
- Work and return. Each worker runs its own tool loop. It may read tens of thousands of tokens, but it returns a short JSON result with findings, sources, conflicts and open questions. Raw benchmark tables go to a file store, and only a reference comes back.
- Synthesize or loop. The lead merges the results and notices a gap: nobody found a CI benchmark for a repository of this size. It starts one more worker to run node:test and Vitest on a copy of one package, then writes the report itself.
Who decides the flow
The lead model decides whether to delegate, how many workers to start, what each one does, and when the run is finished. The developer decides which worker types exist and what tools they get. Runtime code enforces the hard limits: total workers, concurrency, rounds, timeouts and token budget. Each worker decides how to carry out its own subtask.
That is the difference from Parallelization, where the developer fixes the split in code. Here the list of subtasks is produced by a model for each request. It also differs from a Supervisor, which picks one specialist per step from a fixed roster and gets control back after each one; an orchestrator usually plans a batch of new subtasks at once. Many sources use the two words interchangeably, so this split is a convention of this site.
Real-world analogy
A newspaper editor gets a big story: a factory closure with many angles. The editor is the orchestrator. They decide that one reporter covers the company, one the union, one the local economy, and tell each what the others are doing so two people do not call the same source. Reporters file short pieces with their notes attached, and the editor writes the story that runs.
The analogy stops at the briefing. A human reporter can walk over and ask the editor what they meant, and knows the newspaper's history. A worker knows only what is written in its brief, so anything left out of the brief is simply unknown to it.
Structure
- Orchestrator, planning. Reads the task, classifies it, decides how many workers to use and saves the plan outside its own context when runs are long. Usually the strongest model in the system.
- Brief. The only thing a fresh-context worker receives from the lead: objective, context, what is out of scope, sources and tools, budget, a "done when" condition and the result format.
- Workers. One bounded subtask each, in a separate context, often as a ReAct loop with a minimal toolset. They can run on a cheaper model than the lead.
- Result contract. A fixed shape for what comes back: status, short summary, findings with sources, conflicts, open questions, artifact references.
- Artifact store. Files or storage for bulky outputs. Workers return references, so large content does not pass through the lead's context.
- Orchestrator, synthesis. Merges results, flags contradictions, spots gaps, and decides whether to answer. Only the lead writes the final answer.
- Another round. If something important is missing and budget remains, the lead writes new briefs. An LLM judgment, bounded by a hard cap on rounds.
- Runtime. Deterministic code that spawns workers and enforces the limits. Cost and safety are controlled here, not in the prompt.
Prompt generator
Describe the requests your system handles and the worker types the lead can start. The output is two system prompts: one for the orchestrator, one shared by all workers with the result format. Paste them into the lead agent and the subagent definitions of your framework (for example Claude Code subagent files, an OpenAI Agents SDK agent exposed with as_tool(), or LangGraph nodes), and enforce the numeric limits in code as well.
Generated prompt
Highlighted text comes from the form. [Bracketed] text is still to fill in.
Anthropic found that short briefs such as "research the semiconductor shortage" made workers misread the task or repeat each other: one covered the 2021 automotive chip crisis while two others both covered 2025 supply chains. Saying what each worker must not cover, and giving it every fact it needs, prevents most of this. Also keep the worker descriptions in the lead's prompt accurate: the lead cannot see a worker's system prompt.
Applicability
Use it when
- You cannot predict the subtasks until you see the input. This is the criterion in Anthropic's "Building effective agents": the number and content of the pieces depend on the request.
- The work is broad and splits into independent parts. Research across many sources, exploring a large codebase, auditing many items. In Google's scaling study, centralized coordination gained about 81% on a parallelizable finance task.
- The work is mostly reading. Read-heavy multi-agent systems are much easier to manage than write-heavy ones (Harrison Chase, LangChain); the Codex docs give the same advice.
- The answer is worth the tokens. Anthropic measured about 15 times the tokens of a chat interaction for its multi-agent research system, against about 4 times for a single agent.
Avoid it when
- The steps are always the same. Fix them in code with Prompt Chaining or Parallelization; both are cheaper and easier to test.
- The task is sequential. In Google's study every multi-agent variant lost 39 to 70% on the sequential PlanCraft benchmark, and the centralized one lost about 50%. A single ReAct agent or Plan-and-Execute fits better.
- Subtasks are tightly coupled or write-heavy. Parallel writers make conflicting implicit decisions. Keep one agent doing the writes, and use workers only to research or review.
- The task is small, or a strong single agent already does it well. A few tool calls do not justify delegation. Google's study found coordination gains shrink or turn negative once the single-agent baseline passes about 45% success.
- The conversation is ongoing and the specialist should change from turn to turn. Use a Supervisor or Swarm / Handoffs instead.
How to implement
- Start from a single agent. Move to orchestrator–workers only after you see a specific failure: the context overflows, serial work is too slow, or one prompt and toolset have become a tangle. Anthropic and LangChain both say a single agent with good tools often matches a multi-agent system.
- Define worker types. For each: a name and a precise description (the lead routes on it), a short system prompt, the smallest toolset that works (read-only for explorers), a model, a turn or tool-call limit and a result schema. A generic worker is a fine first version.
- Write the lead prompt. Role (plan, delegate, synthesize), how to classify requests, effort-scaling rules, how to write a brief, launch independent workers together, a stop rule, and synthesis rules. Without effort rules models over-invest: Anthropic's early system started 50 subagents for simple queries.
- Scale effort to the request. Anthropic's published rules: 1 subagent with 3 to 10 tool calls for simple fact-finding, 2 to 4 with 10 to 15 calls each for a direct comparison, 10 or more with clearly divided responsibilities for complex research. Their open-sourced lead prompt caps it at 20 and says to prefer fewer, more capable subagents.
- Fix the result contract. Status (complete, partial, failed, out of scope), a summary of about 200 words, findings with sources, conflicts, open questions, artifact references and usage. Validate it with structured output where your framework supports it. The status field lets the lead tell "nothing exists" from "the worker gave up".
- Enforce limits in code. Caps on rounds, total workers, concurrency, nesting depth, wall-clock time and tokens or dollars. Catch timeouts and errors and hand them back to the lead as a failed result instead of crashing the run.
- Plan for long runs. Save the plan outside the lead's context (Anthropic's lead does this because context past 200,000 tokens is truncated), checkpoint results, and resume from the point of failure instead of restarting.
- Trace and evaluate. Log every plan, brief and result so you can tell whether the plan or a worker went wrong. Grade final outputs against a rubric; Anthropic started with about 20 real queries. Compare against a single agent with the same budget, and re-run the evals after every change to the lead prompt, since small changes shift worker behaviour in ways that are hard to predict.
| Framework | How this pattern appears |
|---|---|
| Claude Code / Claude Agent SDK | Subagents defined in .claude/agents/ or as AgentDefinition; the lead delegates with the Agent tool (renamed from Task) and picks a type by its description. A non-fork subagent does not see the parent's history; only its final message comes back. The Workflow tool runs a model-written orchestration script for large fan-outs. |
| LangGraph | Orchestrator–worker workflow: a planner with structured output, then a conditional edge returning one Send per planned item, workers appending to a list in state, and a synthesizer node. LangChain also documents a "subagents" pattern where the main agent calls subagents as tools. |
| OpenAI Agents SDK | agent.as_tool() (agents as tools, the "manager" pattern): the manager keeps control and the nested agent does not inherit its conversation unless you pass the same session. Contrast with handoffs, where control moves. |
| OpenAI Codex | Subagents start only when explicitly requested or when AGENTS.md or a skill calls for them; settings live under [agents]. The docs recommend read-heavy work first. |
| Google ADK | AgentTool wraps an agent as a callable tool, which gives this pattern. ParallelAgent runs a fixed set of sub-agents, which is developer-defined parallelization instead. |
| CrewAI | Process.hierarchical with a manager LLM or agent. The manager works over a predefined task list, which is closer to a supervisor. |
| AutoGen Magentic-One | An orchestrator with task and progress ledgers directing four agents (see Variants). |
Caveat. These APIs move fast. Claude Code's rule on nesting changed: older docs said subagents cannot start subagents, current docs allow up to three layers below the main conversation by default, and the version where this changed is not verified. langgraph-supervisor was archived in September 2026, and LangChain points users to tool-wrapped subagents. Managed Agents tool names come from a beta cookbook and may change.
Variants
Single round (workflow form)
One planning call produces N subtasks, code fans them out, one synthesis call merges them. There is no loop, so it is cheap and easy to test. This is the form in "Building effective agents" and the LangGraph Send tutorial.
Iterative lead (agent form)
The lead is an agent loop with a "start a worker" tool. It reads results, then starts more workers or changes strategy. Anthropic's Research system and Claude Code subagents work this way.
Agents as tools
Each worker is exposed as a tool; calling it runs a nested agent whose output is the tool result. The manager keeps the conversation. OpenAI as_tool(), ADK AgentTool and LangChain subagents all use this shape.
Async workers with steering
Starting a worker returns at once. The lead can check status, send follow-up messages or stop workers, so one slow worker no longer blocks the whole batch. Result coordination and error handling get harder; Anthropic lists async orchestration as an open problem.
Ledger-based orchestrator
Microsoft's Magentic-One keeps a task ledger (known facts, facts to look up, guesses, the plan) and a progress ledger. At every step it asks whether the task is done, looping or progressing, and re-plans after more than two stalled steps. It dispatches one step at a time, which puts it close to a Supervisor.
Plan big, execute small
A frontier-model lead with no tools of its own, and cheap workers that do the token-heavy reading. In Anthropic's Managed Agents cookbook, 84 to 98% of input tokens were billed at the worker rate (the authors' own runs, which varied). Making briefs finer raised cost, because each worker has a fixed setup overhead.
Wide research
One worker per item over a long list of similar items, then a table. It is close to map-reduce, except that the model builds the item list and the briefs. Manus describes this as Wide Research; its claims about quality across hundreds of items are vendor statements without published benchmarks.
Many readers, one writer
Workers only gather information or give advice; one agent makes every write and produces the final artifact. This is how Anthropic's research system works, and it is where Cognition's 2026 follow-up lands as well.
Fork workers
The worker inherits the parent's conversation instead of starting empty. You lose some isolation and gain fewer missing-context mistakes, which helps when subtasks are coupled.
Nested orchestration
Some workers are orchestrators themselves. That is Hierarchical teams; most systems stop at two levels.
Pros and cons
Pros
- Handles tasks whose shape is unknown in advance: the split adapts to each request.
- Each worker has a clean, focused context and a small toolset, so it does its piece better than an overloaded single agent.
- The lead's context grows only by briefs and condensed results, which is why the pattern scales to work larger than one context window.
- Parallel workers cut wall-clock time on wide tasks. Anthropic reported up to 90% less research time on complex queries (internal measurement).
- Model tiering can lower the price per token: a strong lead, cheap workers.
- The lead filters errors. Google's study measured error amplification of 4.4 times for centralized systems against 17.2 times for independent agents.
Cons
- Many more tokens: about 15 times a chat interaction for Anthropic's system. Google measured 285% coordination overhead and fewer successes per token than a single agent.
- Information is lost each time a worker condenses its work into a summary.
- The lead is a single point of failure: a bad plan spoils every result built on it.
- A synchronous batch waits for its slowest worker, and fresh workers spend time gathering context.
- Hard to debug: many non-deterministic traces, and small lead-prompt changes alter worker behaviour.
- Weak on sequential or tightly coupled work, where workers make decisions that do not fit together.
Read the headline gains with care. Anthropic's +90.2% over single-agent Opus 4 is an internal eval, and the multi-agent system also spent far more tokens. On BrowseComp, Anthropic found token usage alone explained 80% of the variance in performance. Part of "multi-agent wins" is "spending more tokens in parallel wins".
Failure modes
- Over-spawning
-
The lead starts dozens of workers for a simple question and the cost explodes. Anthropic's early system started 50 for simple queries.
Mitigation: effort-scaling rules in the lead prompt, plus hard caps on workers, depth and budget in code. Track workers per query by query type.
- Answering from memory
-
The lead skips delegation and writes a plausible answer without checking anything.
Mitigation: require at least one worker for factual requests, and alert on runs with zero spawn events.
- Vague briefs and duplicate work
-
Two workers research the same thing while another area goes uncovered.
Mitigation: a brief template with objective, format, tool and source guidance and boundaries, and tell each worker what the others cover. Measuring overlap (the same URLs or files read by several workers) shows when this happens.
- Conflicting implicit decisions
-
Outputs that each look fine do not fit together. Cognition's example: one worker builds a Mario-style background, another a bird in a different style, and the merge inherits both.
Mitigation: keep writes in one agent, put shared decisions in every brief, and use fork workers or full context when coupling is high.
- Game of telephone
-
Details are lost or distorted as results pass through the lead's summaries.
Mitigation: workers write large outputs to storage and return references, and the final step reads the originals when precision matters.
- Unverified premise
-
Every fact is checked but the list itself is wrong. In the Managed Agents cookbook, both the multi-agent and the single-agent runs built a list of parks from memory and got one entry wrong.
Mitigation: give one worker the job of verifying the decomposition's premise.
- Workers that stop too late or too early
-
A worker keeps searching after it has enough, or gives up early. The MAST study counts premature termination at 6.2% of failures and being unaware of termination conditions at 12.4%.
Mitigation: a tool-call budget and a "done when" condition in every brief. Anthropic's subagent prompt uses about 15 calls with a hard maximum of 20.
- Stragglers and crashes
-
One slow worker blocks the batch, or a worker fails and leaves a hole in the results.
Mitigation: timeouts, a failed status returned to the lead, reassignment of infrastructure failures to a fresh worker, checkpoints, or async workers that can be polled and stopped.
- Loops
-
The same subtask is delegated again and again. MAST counts step repetition at 15.7% of failures.
Mitigation: a stall counter that forces a re-plan (Magentic-One re-plans after more than two stalled steps) and a hard cap on rounds.
- Prompt injection through worker output
-
A worker reads a malicious page and returns text shaped like instructions, which the lead then follows.
Mitigation: treat results as data, not instructions. Claude Code scans subagent reports for instruction-shaped text before the parent reads them.
Relations with other patterns
- Parallelization: the developer fixes the split in code. Many orchestrator–workers systems are parallelization over a work list written by a model.
- Prompt Chaining: the sequence of steps is fixed at design time; here the subtasks are invented at run time.
- Routing: picks one handler and is done. An orchestrator creates several subtasks and merges the results. ADK's "Coordinator/Dispatcher" is mostly routing.
- ReAct (tool-use loop): each worker, and often the lead, is a ReAct loop. This pattern composes them.
- Plan-and-Execute: one agent plans and runs the steps in its own context. Here separate agents with separate contexts carry out the plan, often in parallel. The two are often combined.
- Supervisor: same hub-and-spoke shape, but it routes one step at a time over a fixed roster and gets control back after each worker. Sources often use the two names for the same thing.
- Hierarchical teams: orchestrator–workers nested over several levels.
- Swarm / Handoffs: control moves to a peer and does not come back. Here the lead keeps control and gets results back (OpenAI contrasts agents as tools with handoffs).
- Evaluator–Optimizer: often added on top as verifier workers or a review loop after synthesis.
- Council / Debate: several agents get the same question; here each worker gets a different piece.
- Group Chat: agents share one thread. Magentic-One's team mechanics are described there.
- Blackboard: coordination through a shared store. The artifact store here is a light version of it.
- Human-in-the-Loop: approval before a costly fan-out, or before the final answer ships.
Further reading
- Building effective agents (Anthropic, Dec 2024): the definition of the orchestrator–workers workflow and how it differs from parallelization.
- How we built our multi-agent research system (Anthropic, June 2025): the lead and subagent design, effort scaling, brief writing, token costs and evaluation.
- Research lead agent prompt (Anthropic cookbook): the open-sourced lead prompt with query types, worker counts and the cap of 20.
- Don't Build Multi-Agents and Multi-Agents: What's Actually Working (Cognition, 2025 and 2026): the case against parallel writers, and the later view on manager agents and reviewers.
- Towards a Science of Scaling Agent Systems (Kim et al., Google Research): when centralized coordination helps and when it hurts, across 180 configurations.
- Subagents (Claude Code docs): a working implementation with worker definitions, context isolation and limits.