Recipe · recipe:multi-agent-orchestration

Deciding which agent runs when, without duplicated work or a runaway bill

Curated. Written from research and curation. Not run in our harness yet.

The job

"Let me decide which agent runs when, stop the agents from duplicating each other, stop the token bill, and make it survive a restart."

The approach

Put one lead agent, or a plain deterministic planner step, over a pool of workers, and keep the control flow in your code. The planner returns a JSON plan of subtasks. Your loop decides dispatch order, concurrency, retries and stop conditions. The model never routes. Each worker starts in a fresh context holding three things: the original job statement, the shared decisions log, and its own output contract. Workers return structured results that you validate, retry once, then merge deterministically using a rule declared before the run. Exactly one writer owns the final artifact. An independent agent that did not produce the work verifies it, prompted to refute rather than approve. Add durable execution underneath only when the job outlives a single request: one workflow step per agent turn, idempotency keys on every side effect. This is the orchestrator-worker shape, and it is the shape behind every public ask in the demand evidence.

Gate before all of it: is the job read-heavy or write-heavy? If subtasks mostly gather material that one synthesizing step turns into the artifact, orchestrate. If subtasks mostly produce the artifact itself (code, copy, one document), default to a single agent with a linear context and stop here.

Alternatives, and why not:

The two headline positions are not opposed. Cognition's "share context, actions carry implicit decisions" is about write-heavy work. Anthropic's orchestrator-worker result is about read-heavy work. Classify the job first, then pick.

Two facts the tables below settle. The framework layer is genuinely maintained: every framework shipped within 14 days of 2026-10-14 except AutoGen AgentChat, whose age is the signal that Microsoft moved to Agent Framework. And the licence column is where this recipe can hurt a reader: Inngest's server is SSPL, Mastra's repo has an ee/ carve-out, and several rows say unconfirmed because a missing license_expression on PyPI is not a licence.

What you need

Every URL below is canonical for that component. Version and licence values are what we read on 2026-10-14. unconfirmed means the source did not settle it; it is not an inference.

Orchestration runtimes and frameworks:

Durability and workflow layer:

Protocols and tool plumbing (the assumed layer, not an orchestration component):

Steps

  1. Classify the job as read-heavy or write-heavy. Write-heavy means the subtasks mostly produce the final artifact (code, copy, one document): use a single agent with a linear context, stop here. Read-heavy means the subtasks mostly gather material a single step then synthesizes: continue.
  2. Build and measure the single-agent baseline before any orchestration. Keep about 20 real cases with expected outputs. Record tokens, latency and quality. Without this number you cannot claim orchestration helped.
  3. Write the decomposition rule as data, not prose. For each subtask: a name, its input, its required output schema (JSON Schema or equivalent), and its explicit boundary (what it must not do). This is the highest leverage artifact in the recipe.
  4. Implement the orchestrator as code. A planner call returns a JSON plan. Your loop, not the model, decides dispatch order and concurrency. Validate the plan in code: reject a plan above N subtasks and re-plan, reject a plan with a subtask missing an output contract.
  5. Give every worker a fresh context window containing exactly three things: the original job statement, the shared decisions log (choices already made by the run, not just that worker's subtask text), and its output contract. Sharing the decisions log is what stops two workers making silently conflicting assumptions.
  6. Fan out concurrently with three caps enforced in code: a concurrency cap (max workers in flight), a per-worker budget (tokens and tool calls), and a wall-clock timeout per worker.
  7. Validate every return against the subtask schema. On failure, retry that worker once. If it fails again, mark that branch failed and continue. Never fail the whole job because one branch failed.
  8. Merge deterministically. Dedupe on a stable key (URL, record id, normalized title), because workers will overlap. Resolve conflicts with a rule declared before the run, never by asking a model to pick.
  9. Keep exactly one writer for the final artifact. Parallel writers are where conflicting implicit decisions land.
  10. Verify with an independent agent that did not produce the work. Prompt it to refute, not to approve, and give it explicit evaluation criteria. Without this step orchestration mostly buys more tokens, not more accuracy.
  11. If the job outlives a single request, put durable execution underneath: one workflow step per agent turn, persisted step results, and an idempotency key on every side effect so a replay does not re-send an email or re-charge a card.
  12. Instrument per-worker token spend, tool calls, latency and outcome. Re-run the step 2 case set against the orchestrated version. Ship only if it beats the baseline. Keep a kill switch that stops the whole job, and wire it to the whole-job budget cap.

Traps

Over-spawning. Mistake: a simple query triggers 50 subagents. Why agents make it: the prompt says "orchestrate" and nothing says how far to scale, so the planner spends budget proving thoroughness. Fix: put explicit scaling rules in the planner prompt, roughly 1 agent with 3 to 10 tool calls for simple fact-finding, 2 to 4 subagents with 10 to 15 calls each for comparisons, and more than 10 subagents only for genuinely complex work with divided responsibilities. Enforce the ceiling in code as well as the prompt.

Vague subtask descriptions, producing duplicated work. Mistake: one worker explores the 2021 automotive chip crisis while two others duplicate work on current supply chains, and a fourth gap is left uncovered. Why agents make it: a subtask written as a topic rather than as a contract gives no boundary, so overlapping-but-not-identical interpretations look valid to every worker. Fix: the step 3 output contract. Objective, output format, tools and sources permitted, and explicit boundaries. Without it agents duplicate, leave gaps, or come back with nothing.

Fragmented context on write tasks. Mistake: a build split into a background subagent and a character subagent returns visually and behaviourally inconsistent, because each made implicit decisions the other could not see. Why agents make it: the instruction "orchestrate several agents" is given without first asking whether the job writes, and write-heavy jobs inherit the read-heavy playbook by default. Fix: for write-heavy jobs, use a single-threaded linear agent, or share full agent traces between workers rather than just messages. This trap is what the step 1 classification exists to prevent.

Treating inter-agent misalignment as a prompt problem. Mistake: failures are met with rewording, and the same failures recur. Why agents make it: the symptom (two agents disagreeing) looks like a communication defect, and communication feels like words. Fix: the failure taxonomy clusters into system design, inter-agent misalignment and task verification, and needs structural fixes. Practically: coordination goes in code, verification goes in a separate agent.

No budget cap. Mistake: a runaway agent spends USD 78,000. Why agents make it: budgets are stated in the prompt, where a model can reason its way past them, and no cap is enforced where the spend actually happens. Fix: per-worker and whole-job token and tool-call caps enforced in code, plus a hard stop. Note the measured multipliers: multi-agent systems run at roughly 15x chat tokens, single agents at roughly 4x.

Sequential work wearing a parallel costume. Mistake: the loop awaits each worker, so the job costs like orchestration and takes as long as a sequential run. Why agents make it: sequential code is the easy first implementation, and it produces correct output, so the defect is invisible without timing instrumentation. Fix: spawn and await concurrently with a concurrency cap, and batch independent tool calls. Parallel subagent spawn plus parallel tool calls cut research time by up to 90% on complex queries in the reference measurement.

Non-idempotent side effects under retry. Mistake: an agent sends an email, then the workflow replays the step after a crash and sends it again. Why agents make it: at-least-once execution is the default guarantee of a workflow engine, and side effects are written where they are convenient rather than confined to a step with a key. Fix: idempotency keys on every side effect, and side effects confined to durable steps.

Agents grading their own work. Mistake: the worker that produced the artifact also scores it, and it scores well. Why agents make it: a verification step looks like a prompt, so it gets appended to the producing agent's own loop. Fix: an independent verifier that did not produce the work, prompted to refute, with explicit evaluation criteria. This is the evaluator-optimizer pattern.

Confusing protocol with orchestration. Mistake: the reader wires MCP servers or A2A endpoints and expects a working multi-agent job. Why agents make it: the protocols are the visible, well-documented layer, and the coordination logic is the part you have to write yourself. Fix: state plainly that MCP and A2A standardize the wire format, not the coordination. Neither gives you a decomposition, a budget or a merge rule.

Reaching for a framework before the pattern. Mistake: a dependency is added before a single-agent baseline exists. Why agents make it: frameworks come with quickstarts and the framework layer is well maintained, so it is the path of least resistance. Fix: start with the plain model API, add a framework only when the simple version demonstrably falls short, and be aware that framework abstractions obscure the underlying prompts and make debugging harder.

Scope

We cover deciding whether a job should be split across several agents at all; the read-heavy versus write-heavy test; decomposition into subtasks with output contracts; the orchestrator loop and who owns control flow; context handoff between lead and workers; concurrency and budget caps; deterministic merge; independent verification; when to put durable execution underneath; and the eval that tells you whether any of it helped.

We do not cover: how to build the individual agent a worker wraps (its prompt, its tool loop, its own memory), which belongs to the agent-building recipes. We do not cover retrieval or RAG for the material workers gather. We do not cover evaluation harness design beyond the minimum needed to compare baseline against orchestrated, which is its own recipe. We do not cover running many independent jobs at fleet scale, scheduling, or queueing across tenants. We do not cover agent security: sandboxing, credential scoping, prompt injection between agents, or the topology-dependent leakage question raised in current work at https://arxiv.org/abs/2610.16039 (read 2026-10-14, cited as a pointer only, not verified in depth). We do not cover model selection or routing, or pricing. We do not cover hosting, observability backends, or vendor-specific deployment. We do not cover the protocol specifications themselves beyond naming them.

Sources

The canonical source for every component is the link in its row above. Those are the sources we read on 2026-10-14.

Two further pointers, both quoted as they stand in the brief:

References we settled on rather than collapsed: AG2 carries two versions, 1.1.2 on PyPI and tag v1.2.0, because a reader installing from PyPI does not get the tag. Temporal server stays unconfirmed, because a pushed_at date is not a version. DBOS Transact and Durable Swarm stay unconfirmed, and we did not infer MIT from the sibling DBOS repo. Inngest is split, because the server is SSPL-1.0 and the Python SDK is Apache-2.0, and a self-hosting reader is affected by the server licence. Google ADK's licence comes from an OSI classifier with an empty license_expression on PyPI, so we name the classifier rather than printing a bare SPDX string. MCP and A2A are filed as components, an assumed layer, not as an approach.

All versions, licences and dates were read on 2026-10-14. We do not re-verify them here, and the framework layer moves weekly, so re-check before install.