← ~/pillars / multi-agent-orchestration / orchestrator-worker

Orchestrator-worker

One controller decomposes the job, dispatches workers with curated context, and synthesises results, with the documented rules for sequential versus parallel.

updated 2026-08-10 ~4 min read pattern 01/06 Architecture & Orchestration

on this page

Context. You have a job that decomposes (a migration across modules, a cross-layer feature, a batch of independent fixes) and a single session either fills its context window doing all of it or serialises work that could run concurrently.

Forces. Parallelism is not free: agent teams “add coordination overhead and use significantly more tokens than a single session” (agent teams). Decomposition quality decides the outcome: tasks that look independent often touch the same files, and concurrent edits to one file are last-write-wins. Workers do not inherit the orchestrator’s conversation history, so everything a worker needs must travel in the dispatch prompt. And the richest topology, peer-to-peer agent teams, is experimental.

Resolution. One controller decomposes the job dynamically, maps every task to a disjoint set of files, dispatches workers with curated context, and synthesises the results. Pick the worker mechanism by stability and shape: subagents for delegation that returns to one session, headless fan-out for independent batch work, agent teams only when workers genuinely need to talk to each other.

Decomposition is dynamic, not a fixed fan-out

Anthropic’s patterns guidance defines orchestrator-workers as a central LLM that “dynamically breaks down tasks, delegates them to worker LLMs, and synthesizes their results” (Building effective agents). The word doing the work is dynamically: the orchestrator decides what subtasks this specific input needs, rather than running a fixed pipeline. Plain parallelisation is the simpler sibling, in two variants: sectioning (split into independent subtasks, fan out) and voting (run the same task several times for diverse outputs). The supporting principle: LLMs generally perform better when each consideration gets a separate call with focused attention.

Three worker mechanisms

MechanismWhat it isStatus
SubagentFresh context window inside the session; custom system prompt and tool list; returns a summaryStable
Agent teamIndependent Claude Code sessions sharing a task list and a peer-to-peer mailbox, coordinated by a leadExperimental
Headless fan-outA loop of claude -p invocations, each a one-shot workerStable

Subagent specifics that shape orchestration (subagents docs): subagents can spawn subagents of their own, three layers below the main conversation by default (v2.1.219), with CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH setting the limit. At the cap Claude Code withholds the Agent tool, so the deepest workers must finish the job themselves rather than delegating on. Treat that number as a parameter you pin, not one you inherit: it moved twice during July 2026 (changelog). Width has its own ceiling, and it is the one that bites a fan-out design: “when 20 subagents are running in a session, spawning another with the Agent tool fails with Concurrent subagent limit reached”. The session total is unbounded, and the separate cap that used to make long sessions refuse new agents was removed in v2.1.224, so a long-running orchestrator no longer degrades over the day. Each level’s results come back as a condensed summary: the point being that the worker’s exploration never bloats the controller’s context. Keep worker prompts leaf-sized unless the subtask itself genuinely benefits from a nested worker.

Agent teams (agent teams docs) add a shared task list and teammate-to-teammate messaging, which suits work where investigators must challenge each other. The caveats are material: the feature is disabled by default behind CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1, and has known limitations: no session resumption with in-process teammates, task status can lag, one team per session, no nested teams. Do not build your team’s standard workflow on it yet; prototype with it, standardise on subagents.

Sequential or parallel

The documented rule: fan out only when subtasks are independent, with no shared files, no ordering, no mid-task coordination. “For sequential tasks, same-file edits, or work with many dependencies, a single session or subagents are more effective” (agent teams). The same docs give a practical ceiling of 3–5 parallel workers before coordination overhead outweighs gains: a 15-task job maps to roughly three workers owning 5–6 tasks each, not fifteen workers owning one.

File ownership is the decomposition test

“Break the work so each teammate owns a different set of files” (agent teams). Decompose by file ownership, not by logical concern: “add validation” and “add logging” sound independent and collide in every touched class. The agent-teams task list locks task claiming, but nothing locks file editing. Ownership discipline has to be written into each dispatch prompt as an explicit authorised-files list. If you cannot draw disjoint file sets, the tasks are not parallel; run them sequentially in one session.

Dispatch with curated context

Workers load project context (CLAUDE.md, MCP servers, skills) but never the orchestrator’s conversation history (agent teams). A dispatch prompt therefore carries four things: the task spec with specific file paths, scope boundaries (what not to touch), constraints from the parent conversation that are not in CLAUDE.md, and the expected output format so worker reports are comparable. Withhold the rest: other workers’ reasoning and your own deliberation about the decomposition add tokens and anchoring bias, not value. The full treatment is in context isolation and handoff.

Worked example

A Java service needs twelve REST controllers migrated to a new validation framework. The orchestrator (your main session) reads the migration spec, confirms the controllers do not share files beyond an untouched common parent, and writes TASKS.md: twelve entries, each naming one controller file, its test file, and the spec section that applies. It then dispatches the implementer subagent per task (task text inline, authorised files listed, report path HANDOFF-T01.md through HANDOFF-T12.md), three at a time, respecting the worker ceiling. Each worker returns a status report; the orchestrator reads only those reports, never the workers’ exploration. Tasks whose report says BLOCKED or QUESTIONS get re-dispatched with answers; completed tasks go to a fresh-context reviewer per verification topologies. The orchestrator’s context at the end holds the spec, twelve summaries, and the synthesis, not twelve migrations’ worth of diffs.

// sources