Module 14 · Multi-agent systems · Lesson 2 of 5
Topologies: supervisor, hierarchical, peer, debate
Five shapes for several agents (supervisor, hierarchical, peer handoffs, debate, pipeline), each with its control flow, where state lives and how it fails, mapped to the workflow patterns and chosen by the shape of the task.
Why it matters
Once you have decided to split, the next question is the shape: who talks to whom, who decides what happens next, and where the state of the task lives. The shape fixes latency, cost and how far a failure spreads before anything notices it. Interviewers say "draw me the topology" because "the agents collaborate" is not a design, while "supervisor, structured results back, state held in the supervisor" is.
The idea
Supervisor
One agent receives the task, breaks it up, delegates each piece to a specialist and assembles the result. Control flow is a star: every message passes through the supervisor. State lives in the supervisor's context. It fails when that context fills with specialists' output, when the supervisor delegates badly (wrong specialist, vague brief), or when it loops, re-delegating a task a specialist already failed. Example: a support agent that routes to a billing specialist, a technical specialist and an account specialist, and writes the final reply itself.
Hierarchical
Supervisors of supervisors. The top delegates to mid-level supervisors, each owning specialists. Control flow is a tree; state is partitioned per subtree, each supervisor holding only its slice. It fails on depth: every level is a handoff, so results take two or three hops to reach the top, and the top never sees raw evidence. Example: a research system where a lead agent delegates "market" to one supervisor and "technical" to another, each with its own searchers and summarisers.
Peer, or swarm
No fixed boss. Each agent does its part and hands the conversation directly to the next peer, state included. Control flow is a graph that emerges at run time; state travels with the baton. It fails on cycles (A hands to B hands to A), on lost context when the baton is too thin, and on the absence of anyone who can declare the task done. Example: a customer flow that starts with a triage agent and hands to a refunds agent, which hands to a shipping agent.
Debate, or critic
Two or more agents produce answers or argue positions; a judge agent, or a vote, picks or merges. Control flow is parallel, then convergent; state is the set of candidate answers. It fails on cost (n answers plus a judge, every time), on agreement (instances of the same model agree on the same mistake), and on a judge that favours length or confidence. Example: a code change drafted by one agent, attacked by a critic for bugs and security holes, then revised.
Pipeline
A fixed order: extract, then classify, then draft, then check. Control flow is a line; state is the artefact passed along. It fails rigidly: a bad early stage cannot be revisited and nothing adapts to the input. Example: a document-processing line. If the stages do not decide anything it is not multi-agent at all.
Mapping to the workflow patterns
Every topology is a workflow pattern with agents in the boxes. Supervisor is orchestrator-workers. Pipeline is prompt chaining. Debate is evaluator-optimizer, or parallelization with a merge step. Peer handoffs are routing performed by the agents themselves. Ask of each box whether it needs to be an agent, deciding its own next step with tools in a loop, or whether one prompted call would do. Boxes that do not decide should be calls; each one removed is a failure mode removed.
Picking by the shape of the task
A task with one clear owner and separable subtasks is a supervisor. A task with nested structure and large leaf work is hierarchical. A conversation that moves between domains over time is peer handoffs. A task whose answer is hard to check and worth paying twice for is debate. A task with fixed, known steps is a pipeline. When in doubt, supervisor: it keeps a single point of control and a single home for state.
| Supervisor | Hierarchical | Peer | Debate | |
|---|---|---|---|---|
| Control | Central; one agent decides | Central per level, delegated downwards | Distributed; the current holder decides | Parallel, then a judge decides |
| Latency | One hop out, one back per subtask | Two or more hops each way | One hop per handoff; chains grow | Slowest candidate plus the judge |
| Cost | Supervisor tokens plus each specialist | Every level re-explains the task | Lowest overhead per hop; loops are the risk | n candidates plus a judge, every time |
| Failure containment | Supervisor can retry or drop a specialist | Contained per subtree; the top is blind to leaves | Weak; a bad handoff propagates | Good; a bad candidate loses the vote |