Topology is a control-flow question, not an org chart
Ask most candidates to design a multi-agent system and you get an org chart. A researcher agent, a writer agent, a critic agent. That is the wrong level of abstraction, and interviewers notice, because roles are the easy part and roles are not what breaks.
There is exactly one question that generates every other property of the design: who holds the loop, and what crosses the boundary when work is delegated. Three answers, three topologies. In a pipeline, control flows one way through stages your code fixed in advance. In a supervisor, one agent holds the loop and calls workers that return to it. In a swarm, control transfers: whoever holds it runs until it hands off, and nothing returns.
Cost, debuggability, and failure mode all fall out of that one choice. So do the three sentences you actually need in an interview.
Pipeline owns rigidity, and that is usually a fair trade
Anthropic's own taxonomy in Building Effective Agents draws the line that most multi-agent discussions skip: a workflow orchestrates LLMs through predefined code paths, while an agent keeps control over how it completes a task. A pipeline is a workflow. Prompt chaining, routing to a specialist prompt, and parallelization by sectioning or voting are all pipelines, and none of them is a lesser design.
The failure mode a pipeline owns is rigidity. A stage that produced garbage still feeds the next stage, and no stage has standing to decide the plan itself was wrong. In exchange you get the one thing a single agent turn cannot give you: a programmatic checkpoint between steps. Validate the extracted schema, assert the retrieval returned something, reject before you pay for the next call.
The practical test is simple. If you can draw the stages on a whiteboard before you see the input, the model does not need to choose the order at runtime, and paying it to choose is paying for variance you did not want.
Supervisor owns the bill
Anthropic's research system is the best-documented supervisor in production. A lead agent on Opus 4 analyzes the query, spawns three to five subagents on Sonnet 4 in parallel, each with its own context window and its own tools, and synthesizes what they return. It beat single-agent Opus 4 by 90.2% on their internal research eval, and parallelization cut research time by up to 90% on complex queries.
Read the cost numbers in the same paragraph or you have misread the result. Agents use roughly 4x the tokens of a chat interaction; multi-agent systems use roughly 15x. On BrowseComp, three factors explained 95% of performance variance, and token usage alone explained 80% of it. That reframes the headline: a large part of what the topology bought was permission to spend fifteen times as much. Anthropic also found that upgrading the model beat doubling the token budget, which is the cheaper lever to try first.
The failure mode a supervisor owns is delegation ambiguity. The task description is the entire interface between lead and worker, and it is prose. Anthropic's own example: vague instructions sent one subagent to research 2021 chip shortages while two others duplicated work on 2025 supply chains. Nobody crashed. The system just paid three times for two answers.
# The only diagram that matters: where does the loop live.
# PIPELINE - your code owns the order. Deterministic, checkable.
def pipeline(task):
plan = llm(PLANNER, task)
assert plan.steps, "planner produced nothing" # gate between stages
draft = llm(WRITER, plan)
return llm(EDITOR, draft)
# SUPERVISOR - the lead owns the loop. Workers are calls that RETURN.
def supervisor(task):
ctx = [task]
while not done(ctx):
calls = lead.decide(ctx) # may be 3-5 at once
results = parallel_map(run_worker, calls) # each own context
ctx += [compress(r) for r in results] # lead stays the author
return lead.synthesize(ctx)
# SWARM - control TRANSFERS. Nothing returns. There is no 'after'.
def swarm(task, agent="triage"):
state = {"messages": [task], "active_agent": agent}
while state["active_agent"]:
state = AGENTS[state["active_agent"]].step(state) # may hand off
return state["messages"]
# Supervisor and swarm are not two flavors of the same thing.
# One has a caller. The other does not.Swarm owns the decision nobody wrote down
In a swarm, peers hold handoff tools instead of a boss. The mechanics in langgraph-swarm are worth knowing precisely because they expose the semantics: create_handoff_tool returns a Command with goto set to the target agent and graph set to Command.PARENT, and it writes an active_agent key into shared state. The target becomes the new owner. There is no stack frame to come back to.
Cognition's Don't Build Multi-Agents is the clearest argument against doing this with decomposed work, and it rests on two principles. Share context, meaning the full traces of prior agents and not just their final messages. And actions carry implicit decisions, so conflicting decisions carry bad results. Their example is the one to remember: split build a Flappy Bird clone into a background and a controllable bird, and you get a Super Mario-style background from one subagent and a bird that matches neither the visual style nor the movement from the other. The final agent inherits two incompatible artifacts.
That is the failure mode swarm owns, and it is the nastiest of the three because nothing errored. No instruction said eight-bit pixel art; the first action implied it, and the implication never crossed the boundary. There is also a mundane trap: in a swarm the topology lives in state, so without a checkpointer you lose both the active agent and the history, and the second turn starts over with the wrong agent.
# Two ways to delegate. They differ in ONE property: does control return.
# 1. AGENT-AS-TOOL (supervisor). The lead stays the author of the answer.
@tool
def research_pricing(question: str) -> str:
"""Research competitor pricing. Returns findings as text."""
out = Runner.run_sync(pricing_agent, question)
return out.final_output # <- returns. Lead decides what is next.
# 2. HANDOFF (swarm). Ownership moves. The caller is gone.
def make_handoff(target: str):
@tool(name=f"transfer_to_{target}")
def _handoff(task_context: str, state: Annotated[dict, InjectedState]):
return Command(
goto=target,
graph=Command.PARENT, # route in the swarm graph
update={"messages": state["messages"] # full trace, not a summary
+ [ToolMessage(f"-> {target}: {task_context}")],
"active_agent": target}, # topology lives in state
)
return _handoff
# Requirement people miss: the swarm schema AND each agent schema must both
# declare every key the Command writes, and the graph needs a checkpointer,
# or turn two resumes with no active agent and no history.The line that actually decides this: reads versus writes
Strip the topology names away and one rule survives every production account of this: reads parallelize, writes do not. Anthropic fans out search across subagents but keeps the report in the lead agent, with citations as a separate pass. LangChain's guidance says the same thing plainly, that read-heavy multi-agent systems are substantially easier than write-heavy ones, because parallel writes create conflicting decisions nobody can merge afterward.
The strongest evidence is Cognition reversing itself. Their follow-up, Multi-Agents: What's Actually Working, no longer rejects the pattern wholesale. The class that works is the one where writes stay single-threaded and extra agents contribute intelligence rather than actions. Devin Review finds about two bugs per Devin-written PR, roughly 58% of them severe, and it works best with a clean context that does not inherit the coding agent's.
That detail is worth sitting with, because it looks like a contradiction of share context and is not. Share context when an agent continues work. Withhold it when an agent verifies work, because a reviewer handed the author's context inherits the author's blind spots. Cognition's delegation pattern lands in the same place: a manager splits and synthesizes while children execute, which they describe as map-reduce-and-manage, and they call unstructured agent swarms mostly a distraction.
# The gate that keeps a supervisor honest. Capability, not a role name.
READ_ONLY = {"search_web", "read_file", "query_db", "grep_repo"}
def delegate(subtasks: list[Subtask]) -> list[Result]:
writers = [t for t in subtasks if set(t.tools) - READ_ONLY]
readers = [t for t in subtasks if t not in writers]
# Reads: fan out. Separate context windows are the whole point.
results = parallel_map(run_worker, readers, max_workers=5)
# Writes: one at a time, in the caller's context, so later writes
# see what earlier writes decided about style, naming and edge cases.
for t in writers:
results.append(run_worker(t, context=shared_ledger))
shared_ledger.append(summarize_decisions(results[-1]))
return results
# Verification is the one place to WITHHOLD context on purpose:
review = run_worker(Subtask(tools=["read_diff"]), context=None)
# a reviewer given the author's trace inherits the author's blind spots.What actually breaks, once it is running
The coordination failures are duller than the architecture diagrams suggest, and they are mostly about time. Execution is synchronous in the common implementations, so the lead cannot steer a subagent that is already running, subagents cannot coordinate with each other, and the whole turn stalls on the slowest one. A pattern sold on latency routinely loses to a pipeline on p99.
Then there is emergent behavior, which is the real tax on debuggability: a small edit to the lead agent's prompt changes subagent behavior in ways you did not predict, because the prompt is the only specification of the delegation contract. Anthropic's list of observed misbehavior is a good test suite — agents spawning fifty subagents for a trivial query, searching endlessly for sources that do not exist, emitting status updates that distract other agents, continuing after they already had enough.
Notice how the three topologies fail differently under a debugger, because that asymmetry is the practical argument. A pipeline failure localizes to a stage. A supervisor failure localizes to a task description, which is at least a string you can diff and re-run. A swarm failure localizes to nothing: you hold an inconsistent artifact and there is no single trace that chose it.
Instrument the boundary, not the agents
Whatever topology you pick, the thing worth logging is the boundary crossing, not the individual turn. For every delegation record the task text sent, the tools the worker was allowed, tokens spent, whether the output was used or discarded, and whether another worker produced an overlapping result. Those five fields catch the expensive failure that no exception reports: paying twice for the same answer.
This is also what lets you retire a topology on evidence. If discarded-output rate is high, the lead's decomposition is wrong and you probably want fixed stages. If overlap is high, your task descriptions are vague in the way Anthropic's supply-chain example was vague. If a single worker dominates wall-clock, you bought parallelism and did not get it.
# Five fields that make a topology decision falsifiable.
from dataclasses import dataclass, asdict
@dataclass
class Delegation:
task: str # the whole interface. diff it when quality moves.
tools: list[str] # capability granted -> read or write (see gate)
tokens: int # multi-agent runs ~15x a chat. prove it is earned.
used: bool # did the lead use this output, or discard it?
overlap_with: str | None # another worker that answered the same thing
def report(runs: list[Delegation]) -> dict:
n = len(runs) or 1
return {
"discard_rate": sum(not d.used for d in runs) / n, # bad decomposition
"overlap_rate": sum(d.overlap_with is not None for d in runs) / n,
"tokens_per_useful": sum(d.tokens for d in runs)
/ max(sum(d.used for d in runs), 1),
}
# discard_rate high -> use a pipeline, the plan was knowable in advance.
# overlap_rate high -> the task descriptions are the bug, not the model.
# tokens_per_useful not beating a single agent -> there is no system here.The default, and the interview answer
Default to a supervisor with read-only parallel workers and exactly one writer. It is the shape both of the best-documented production systems converged on, from opposite directions and opposite priors. Reach for a pipeline whenever the stages are knowable before you see the input, which is more often than architecture enthusiasm admits. Reach for a swarm almost never, and when you do, reach for it as bounded routing — support triage where a handoff is a genuine transfer of ownership — never as a way to decompose one artifact across peers.
The interview answer is three sentences. Topology is a control-flow decision, not an org chart: a pipeline fixes the order in code, a supervisor keeps one agent holding the loop with workers that return, and a swarm transfers ownership with no return path. Each owns a failure mode — pipelines are rigid, supervisors are ambiguous at the delegation boundary and cost around fifteen times a chat, swarms diverge on implicit decisions nobody wrote down, which is why Cognition's Flappy Bird came back as a Mario background and a mismatched bird. So the rule I design to is that reads parallelize and writes do not, which is why Anthropic fans out search but writes the report in the lead agent, and why Cognition's working multi-agent systems keep writes single-threaded and add agents for intelligence rather than actions.
If you want the one-line version for a design doc: add an agent to read, add a stage to write.
Work the same ideas as a full interview case study, with pressure questions and model answers.