Vibe Engines
YouTube

Vibe Engines is free, interactive AI engineering & system design — runs in your browser. Pick a learning path

Handbooks  /  Multi-Agent Orchestration
Handbook~15 min readAgentsworked math + runnable code
The Multi-Agent Orchestration Handbook

More agents,
more problems.

A team of specialist agents sounds obviously better than one — a researcher, a coder, a critic, all working together. So teams reach for elaborate multi-agent architectures, and are surprised when the result is slower, pricier, and worse than a single good agent. The reason is a law you can't argue with: coordination cost grows quadratically with the number of agents, while the useful work only divides linearly. Beyond a point, every agent you add costs more to coordinate than it contributes. This handbook is where that curve turns, and how to stay on the right side of it.

01

The team fantasy

The appeal of multi-agent systems is intuitive: decompose a hard task, assign each part to a specialist agent, run them in parallel, combine the results. It mirrors how human teams tackle big problems, and it promises both parallelism (do things at once) and specialization (each agent focused on what it's good at). So a lot of ambitious AI systems are built as elaborate agent org-charts.

And often they underperform a single well-built agent. The failure isn't that the agents are bad — it's that coordinating them costs more than anyone budgeted. Agents have to share context, reconcile conflicting results, wait on each other, and recover when one goes off-track, and all of that is overhead that a single agent simply doesn't pay. The question isn't "would a team be nice?" but "does the parallel benefit exceed the coordination cost?" — and the coordination cost has a shape that makes the answer "no" more often than you'd think.

The one-sentence version

Coordination overhead grows quadratically with the number of agents while useful work divides only linearly, so past an optimal point more agents make the system slower — often a single agent wins.

02

Coordination isn't free

Here's the cost nobody prices in. When agents must coordinate, the work isn't just "N agents doing their bit" — it's the communication between them. Every pair of agents that needs to share context or reconcile a result is a coordination link, and the number of pairs in a group of N is N(N−1)/2 — it grows quadratically. Two agents: 1 link. Five agents: 10 links. Ten agents: 45 links. The overhead explodes far faster than the headcount.

Meanwhile the useful work only divides linearly: split a job across N agents and each does about 1/N of it. So you're trading a linear speedup against a quadratic overhead. For small N the speedup wins; as N grows, the quadratic term catches up and then overwhelms it. This is the same reason human teams hit diminishing returns — adding people adds meetings faster than it adds output. A single agent, by contrast, has zero coordination overhead, which is why it's such a strong baseline and so often the right default.

03

Where it turns

Put the two forces together and you get a U-shaped cost curve. Total cost falls at first as agents parallelize the work, hits a minimum at some optimal number, then rises as coordination overtakes the shrinking marginal speedup. There's a best N — and it's usually small.

The U-curve: adding agents helps, then hurts
N = 1All the work, zero coordination — the baseline.
Add agentsWork divides (−), coordination grows (+) — net win while parallelism dominates.
Optimal N*The minimum — where marginal speedup = marginal coordination cost.
Too manyCoordination dominates → slower, pricier, more error-prone.

Where the minimum sits depends on two things: how parallelizable the task is (more independent work → more agents pay off) and how expensive coordination is (cheaper coordination → more agents optimal). A tightly-coupled task where every step depends on the last has almost no parallelism, so its optimal N is 1 — a single agent. A task that fans out into many independent sub-tasks with light coordination can profitably use several. The math pins down exactly where.

04

The overhead math

Model total cost as parallelized work plus pairwise coordination. Work W divides across N agents; coordination costs c per pair, and there are N(N−1)/2 pairs:

cost(N)  =  W / N  +  c · N(N−1)/2

First term (work) shrinks like 1/N; second (coordination) grows like N². Their sum is a U-curve with a minimum.

Two consequences fall out. Adding agents past the minimum makes it worse — the quadratic term wins — and the optimal N depends on the ratio of work to coordination cost:

cheap coordination (small c)  ⟹  larger optimal N ;    pricey coordination  ⟹  smaller (often N=1)

Halve the coordination cost and more agents pay off; make it expensive and a single agent wins. The runnable version below computes the cost curve, shows more agents hurting past the optimum, and finds the best N.

RUN IT YOURSELF

Find the optimal team size

Multi-agent cost is a tug-of-war. Work divides linearly across N agents (the speedup), but coordination pairs grow as N(N−1)/2 (the overhead) — 1 pair at 2 agents, 45 at 10. Total cost is work/N plus coordination-cost times pairs, a U-curve: adding agents helps until coordination dominates, then more agents cost more, not less. A single agent has zero coordination overhead. And cheaper coordination shifts the optimal team size larger. Change the work, coordination cost, or agent count and find where the minimum sits.

CPython · WebAssembly
05

Patterns that scale

The way to beat the quadratic wall is to constrain who coordinates with whom. The best patterns route coordination through a hub or a line instead of a full mesh:

PatternHow coordination flows
Orchestrator-workersA coordinator splits the task, dispatches to workers, and synthesizes — coordination is hub-and-spoke (linear), not every-pair.
Sequential handoffA pipeline: each agent does its stage and passes to the next — coordination is a chain, not a mesh.
Specialist routingRoute each request to the single best-suited agent — no ongoing coordination at all.
Free-for-all meshEvery agent talks to every other — the quadratic trap; avoid at scale.

Orchestrator-workers is the workhorse: because the coordinator is the only hub, communication grows with the number of workers, not with the number of pairs, keeping overhead near-linear even as you add specialists. It also composes with everything else — each worker is itself a bounded agent loop, and the orchestrator applies the same agent patterns at the team level. The design lesson is blunt: don't build a democracy of agents that all confer; build a clear hierarchy or pipeline where coordination is deliberately limited, and add agents only where you can point to real parallel work.

06

Pitfalls

The cardinal error is reaching for multi-agent by default — building an agent team for a task a single agent handles fine, and paying the coordination tax for nothing. Start with one agent; add more only when you can name the specific parallelism that will pay for the coordination. A close cousin is the full-mesh design where every agent talks to every other: it hits the quadratic wall fastest, and it's usually a hierarchy or pipeline in disguise that just hasn't been structured yet.

Two more. Error compounding: each agent hand-off is a chance to lose context or propagate a mistake, so a longer chain of agents is a longer chain of failure points — more agents can mean lower reliability, not just higher cost. And context duplication: agents that each carry the full context multiply your token bill, so coordination overhead is a cost line too, not only a latency one. The through-line: multi-agent is a real tool for genuinely parallel, specialized work — but it is not a free upgrade. Respect the quadratic, keep the team small and the coordination structured, and default to one agent until the task demands more.

Worth knowing

"More agents" is not a capability upgrade — it's a coordination cost. Because overhead grows quadratically and each hand-off adds a failure point, a single well-built agent beats a sprawling team on most tasks. Add agents only for real, nameable parallelism, and route coordination through a hub or pipeline, never a full mesh.

By the numbers

Worked example: mesh vs hub, one agent at a time

Take the page’s runnable numbers: W = 100 units of work and c = 5 per coordination link. Price the same team two ways: a full mesh, where every pair talks (N(N−1)/2 links), and an orchestrator hub, where each worker talks only to the coordinator (N − 1 links in this simple model). Add one agent per row.

NWork W/NMesh linksMesh costHub linksHub cost
110001000100
250155155
333.3348.3243.3
425655340
5201070440
616.71591.7541.7

The mesh bottoms out at N = 3. By N = 6 it costs 91.7, almost as much as one agent doing everything, because 15 links eat what the split saved. The hub keeps falling until N = 4 or 5 and then barely rises, because its overhead grows by one link per worker, not by one per pair. That is the page’s “patterns that scale” argument in numbers: the structure, not the headcount, decides how far you can go. Two cautions. First, the hub cost assumes the coordinator itself is never the bottleneck. In practice it reads every worker’s output, so its context and latency grow with N too. Second, halve the mesh’s coordination cost to c = 2.5 and its best N moves only from 3 to 4 (cost 40.8 at 3, 40.0 at 4). Cheaper messages help, but a quadratic term stays quadratic.

Trade-offs

Cost and trade-offs: the patterns side by side

Here Time is coordination links for N agents, and Space is what each agent has to hold in context. The last column is what you give up.

CaseTimeSpaceWhy
Single agent0 linksThe whole task in one contextNo parallelism. Long tasks hit the context window and the agent loses track of early steps.
Orchestrator-workersN − 1 links through the hubWorkers: their sub-task only. Coordinator: the plan plus every resultWall clock ≈ plan + slowest worker + synthesis. The coordinator becomes the context bottleneck.
Sequential hand-offN − 1 links in a chainEach stage: its input plus what the last stage passed onNo parallelism at all: wall clock is the sum of stages. At 95% per hand-off, 5 stages succeed 0.95⁵ ≈ 77% of the time.
Specialist routing0 ongoing links; one routing callOne specialist’s contextOnly works when a request fits one specialist. A wrong route gives a confident answer from the wrong expert.
Full meshN(N−1)/2: 45 at N = 10, against 9 for a hubEvery agent tends to carry everyone’s messagesToken cost grows with the links, and nobody owns the final answer.

Notice that the patterns trade different things. The hub buys parallelism with one overloaded context. The pipeline buys simple, bounded contexts but adds up latency and compounds failure. Routing buys both, but only for tasks that never needed a team. Pick by the shape of the task: independent sub-tasks suit a hub, ordered stages suit a pipeline, and distinct request types suit a router. The bill follows the Space column. If five workers each re-read a shared 8,000-token brief, that is 40,000 input tokens before any of them starts, so hand each worker only its slice and a short summary of the goal.

Self-check

Check yourself

With the page’s formula, W = 60 and c = 10. How many agents should you use?

Two. cost(1) = 60, cost(2) = 30 + 10 = 40, cost(3) = 20 + 30 = 50, cost(4) = 15 + 60 = 75. The third agent saves 10 units of work but adds 2 new links costing 20. When coordination is expensive relative to the work, the optimum sits at 1 or 2.

A research task splits into five questions that do not depend on each other. Which pattern fits, and why not a mesh?

Orchestrator-workers. The sub-tasks are independent, so workers never need to talk to each other. Only the coordinator needs to see all five answers. A mesh would add 10 links (5 × 4 ÷ 2) of chatter that carry no information the task needs. The coordinator’s synthesis step is where to spend your best model.

You add a review agent to the end of a 4-stage pipeline, and each hand-off succeeds 95% of the time. What happens to end-to-end reliability, and when is that still worth it?

It drops from 0.95⁴ ≈ 81% to 0.95⁵ ≈ 77% if the reviewer is just one more stage that can fail. It is worth it only if the reviewer catches more upstream errors than it introduces, by checking against tests or sources rather than re-reading the text. Measure both rates on real traces before you keep it.

A refactor touches one module, and every step depends on the last. A teammate proposes three agents “to go faster”. What do you predict?

It gets slower and more error-prone. The page’s U-curve has its minimum at N = 1 when there is almost no parallel work: W/N saves nothing if the steps must run in order anyway, while every link adds coordination and a hand-off that can lose context. Use one agent, and give it better tools or a plan instead of colleagues. If the context window is the real limit, a sequential hand-off with a written summary between stages beats parallel agents.

Keep W = 100 and c = 5 and scale to ten agents. What do the mesh and the hub cost?

Work drops to 100 / 10 = 10 in both. The mesh has 10 × 9 ÷ 2 = 45 links, so it costs 10 + 225 = 235, more than twice the cost of one agent working alone. The hub has 9 links and costs 10 + 45 = 55, worse than its best of 40 at four or five agents but still cheaper than one agent. So a hub fails gently as you add agents and a mesh fails fast. Past the minimum, though, every extra worker only adds cost, so stop adding them there.

Frequently asked

Quick answers

What is multi-agent orchestration?

Coordinating several LLM agents on one task — e.g. an orchestrator splitting work among specialist workers — for parallelism and specialization.

Why can more agents be worse?

Coordination overhead grows quadratically (N(N−1)/2 pairs) while work divides only linearly, so past a point adding agents costs more than it saves.

When to use multiple agents?

When the task has real, independent parallelism large enough that the speedup beats the coordination cost — otherwise prefer a single agent.

What patterns scale?

Orchestrator-workers (hub-and-spoke), sequential handoff (pipeline), and specialist routing — anything but a full every-pair mesh.

Finished this one? 0 / 209 Handbooks done
NextSelf-Improving Agents Next on the “Building agents” ladder · rung 8 of 10

Explore the topic

See this alongside everything else on the same subject — handbooks, system designs, challenges and tools, in one place.

More Handbooks