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:

A single agent reads pages for all three test runners into one context window, the earliest pages get buried, and the report comes out slow and uneven. Request compare 3 test runners and recommend one One agent reads everything, in sequence context window Vitest pages (buried) Jest pages node:test pages repo config files migration guides Report slow: one page at a time early sources lost uneven depth per runner one prompt, every tool
One agent, one context, one thread of work: the more it reads, the less it keeps of what it read first.

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.

  1. 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).
  2. 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.
  3. 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.
  4. 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.
  5. 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

The task goes to the orchestrator, which writes briefs for three workers with separate contexts; workers return condensed results and store large outputs in an artifact store; the orchestrator synthesizes, then answers or plans another round, all inside limits enforced by runtime code. gaps found and budget left: another round large outputs read on demand Task Orchestrator plan + briefs Vitest worker own context + tools Jest worker own context + tools Repo worker read-only tools Orchestrator synthesizes Answer Artifact store Runtime code: worker cap, concurrency limit, timeouts, round and token budgets 1 2 3 4 5 6 7 8
Solid arrows carry briefs and the final answer, dashed arrows carry results. The two orchestrator boxes are the same agent at two moments. Workers do not talk to each other.
  1. 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.
  2. 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.
  3. 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.
  4. Result contract. A fixed shape for what comes back: status, short summary, findings with sources, conflicts, open questions, artifact references.
  5. Artifact store. Files or storage for bulky outputs. Workers return references, so large content does not pass through the lead's context.
  6. Orchestrator, synthesis. Merges results, flags contradictions, spots gaps, and decides whether to answer. Only the lead writes the final answer.
  7. 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.
  8. 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.

Worker types the lead picks from these by description
Kind of work

Generated prompt

Highlighted text comes from the form. [Bracketed] text is still to fill in.

The briefs decide the quality

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

Avoid it when

How to implement

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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".
  6. 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.
  7. 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.
  8. 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 support (check current docs before use)
FrameworkHow this pattern appears
Claude Code / Claude Agent SDKSubagents 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.
LangGraphOrchestrator–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 SDKagent.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 CodexSubagents 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 ADKAgentTool 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.
CrewAIProcess.hierarchical with a manager LLM or agent. The manager works over a predefined task list, which is closer to a supervisor.
AutoGen Magentic-OneAn 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

Further reading