Multi-Agentmulti-agenttopologysupervisorpipelinehierarchical

Multi-Agent Systems Overview

Multiple agents with distinct roles can be arranged as supervisor, pipeline, hierarchy or swarm; a role buys separate context, tools and evals, at the price of coordination.

▶ InteractiveInterview question
Progress

You have not marked these as done yet. Read on anyway if they feel familiar; come back to them if something here does not land.

Key points

  • A role = separate context + separate tools + separate evals + separate prompt; nothing else.
  • Supervisor centralises control; pipeline fixes order; hierarchy scales breadth; swarm decentralises.
  • Every hand-off is lossy serialisation plus latency plus a new failure point.
  • Pipelines are the easiest to eval and to partially replace with deterministic code.
  • Choose the topology from the task's shape, not from what a framework demos.
  • Ask When Not to Use Multi-Agent before choosing any of these.

Multi-agent architectures

Multi-agent architectures
Four shapes. Before choosing any of them ask: can one agent, or a deterministic workflow, do this reliably?
SupervisorResearchCodeReview
Use when
Distinct specialities with different tools and context; the supervisor decides who works next and merges results.
Avoid when
When the supervisor becomes a serial bottleneck relaying everything, or when one agent with all tools would do.
Coordination cost
Every hop is a model call: expect 2–3× the tokens of a single agent and added latency per delegation.

What a role actually buys you

A "second agent" is not magic. It is a second LLM loop with its own system prompt, own context window, own tool set and own evaluation suite. Those four separations are the entire value proposition; if you would not use any of them, you do not need a second agent.

Separate context prevents a 60k-token research transcript from crowding out the writing instructions (Context Ordering & Lost in the Middle). Separate tools let the reviewer agent have zero write access while the executor has some (Tool Permissions and Least Privilege). Separate evals let you measure "did research find the right sources" independently of "was the prose good" (Evaluating Agents: Testing Probabilistic Systems).

The cost is coordination: every hand-off is a lossy serialisation of state into text, another model turn of latency, and another place for errors to compound. When Not to Use Multi-Agent makes the full case; this lesson maps the shapes.

The four topologies

Supervisor: one orchestrator decomposes a task, delegates to specialists, merges results. Central control, central bottleneck.

Pipeline: fixed stages, each agent transforms the previous output — Research → Analyze → Write → Review. Predictable, easy to eval per stage, no dynamic routing.

Hierarchical: supervisors of supervisors. A manager assigns to team leads who assign to workers. Scales breadth; each level adds latency and summarisation loss.

Swarm / peer: agents hand off to each other directly based on capability; no central controller. Flexible, hardest to trace and bound.

Supervisor
User taskSupervisorResearcherCoderTesterMerge + answer
UserLLMAgentToolDataDecisionHumanGuardrail

Pipeline and hierarchy

A pipeline is a DAG of agents where edges are data. Because each stage has a typed input and output, you can replace any stage with deterministic code or a cheaper model without touching the others — the strongest argument for starting here when a task really is sequential.

A hierarchy is a tree. Information flows down as tasks and up as summaries; every level compresses. Three levels means the top agent sees a summary of a summary — fine for status, dangerous for details like "the migration drops a column".

Pipeline
ResearchAnalyzeWriteReviewOutput
UserLLMAgentToolDataDecisionHumanGuardrail

Hierarchy and swarm

In a swarm, control moves with the conversation: a triage agent hands the thread to billing, billing hands to refunds. Each hand-off transfers a bounded context plus the active tool set. Without a hop limit, two agents can hand off to each other forever (Budgets, Limits and Termination).

Hierarchical and swarm
handoffhandoffhandoffManagerPeer: triageLead: backendLead: frontendPeer: billingWorkerWorkerWorkerPeer: refunds
UserLLMAgentToolDataDecisionHumanGuardrail

When to use — and when not to

Use it when
  • Subtasks need genuinely different tool sets or permission levels.
  • A single context cannot hold all necessary material without degrading.
  • You need independent, per-role quality metrics.
  • Subtasks are parallelisable and wall-clock latency matters.
Avoid it when
  • One well-prompted agent with good tools already hits the quality bar.
  • The task is a fixed sequence a workflow graph can express (Workflow State Graph).
  • You cannot yet evaluate the single-agent version — you will not be able to evaluate the multi-agent one either.

Failure modes

Reference · show
  • Context lost at hand-off: the writer never sees the caveat the researcher found.
  • Supervisor becomes a serial bottleneck (supervisor-bottleneck).
  • Agents disagree and loop; no termination condition.
  • Cost multiplies: 4 agents × 3 turns each ≈ 12 model calls for one user request.
  • Blame is diffuse; traces span agents and nobody owns the regression.

Tradeoffs

Complexity
low → high
Latency
low → high
Cost
low → high
Reliability
poor → strong
Debuggability
hard → easy

Ratings for a generic multi-agent system; pipelines score better on reliability and debuggability than swarms.

Check yourself

Answer out loud or on paper first, then compare. These come from the interview questions linked to this lesson.

  1. When does splitting a system into multiple agents improve it, and when does it make the system worse?

    Show a strong answer

    A split helps when the parts have genuinely different responsibilities that would otherwise crowd one prompt, need independent context (a reviewer should not see the drafter's reasoning, or a worker needs 50k tokens of documents the coordinator does not), need different capabilities (different tools, permissions, or models, such as a cheap model for extraction and a strong one for judgement), or can run in parallel on independent sub-tasks. The boundary between agents must be a clear, typed contract. See Multi-Agent Systems Overview and When Not to Use Multi-Agent.

    It makes the system worse when the agents share most of their context (you now pay to transmit it), when the task is sequential and one agent could do it with a longer prompt, when coordination requires many round trips (each is an LLM call plus latency), or when nobody can say what each agent is responsible for. Information is lost at every hand-off because agents summarise for each other, and errors compound across hops.

    The precondition is always: can this be solved reliably with one agent or a deterministic workflow? If yes, the split is cost without benefit. If not, I introduce the smallest number of agents with the clearest boundaries and evaluate the whole system end-to-end, not each agent in isolation.

    Full interview question, with follow-ups and red flags →
  2. A team split a single agent into a supervisor with four workers and quality dropped. What are the likely causes and what would you do?

    Show a strong answer

    The usual causes: the supervisor loses information when summarising the task for workers and their results for itself; workers lack context the single agent had (the user's original phrasing, earlier tool results); hand-offs use free-form prose so details drift; the supervisor makes extra round trips and hits iteration or budget caps; and errors compound because a worker's mistake is taken as truth by the supervisor. See Supervisor Pattern and Agent-to-Agent Communication.

    I would pull traces for the regressions and compare the single-agent run with the multi-agent run on the same input: where did the needed fact disappear? Then fix the boundary: pass structured messages including the original request, make workers return typed outputs with confidence and citations, cap supervisor rounds, and give the supervisor the raw worker outputs rather than its own summaries when they fit the budget.

    If after that the multi-agent version is not measurably better on the golden set, revert. The single agent was a working baseline; the split has to earn its place.

    Full interview question, with follow-ups and red flags →
  3. How do you evaluate a multi-agent system?

    Show a strong answer

    End-to-end golden set against the baseline, plus per-hop checks for information loss; cross-agent trace correlation to attribute failures.

    Full interview question, with follow-ups and red flags →