💸 Token & latency blow-up
Every extra agent re-reads context and adds a round-trip. A five-agent mesh can cost 10× a single agent for the same result. Prefer the smallest topology; pass compact structured results between agents, not raw transcripts.
Once you have more than one thing doing work — an agent, a tool, another agent — you have to decide how they're wired together: who talks to whom, who decides what happens next, and where state lives. That wiring is the system's topology, and it matters more than the model choice. The same online-shopping assistant is a different product depending on whether one agent holds everything, agents form an assembly line, a manager delegates to specialists, or peers negotiate freely.
This page is about the shapes. For the decision logic that runs inside them — chaining, routing, orchestrator-workers, evaluator-optimizer — see Anthropic's agent patterns and Google's design patterns; for two frameworks that implement these shapes, AutoGen vs CrewAI.
Borrowed from networking, topology just means the arrangement of parts and their connections. For agents, three questions define it:
Agents (LLM + instructions + memory), the tools they call, and any shared memory the system reads and writes.
The allowed message paths and tool calls. A missing edge is a design decision — it's how you keep a peer from going rogue.
Fixed in code (deterministic), owned by one boss (centralised), or emergent from peers (decentralised).
Everything below is a different answer to those three questions. The running example: a user says “find me running shoes under $120 with good reviews and get them here by Friday.” That single request needs product search, review analysis, price/shipping comparison, cart, and checkout — and how you split and wire those jobs is the topology.
One agent sits at the centre; tools radiate out like spokes. The agent reads the request, decides which tool to call, loops on the results, and answers. There are no other agents — just an augmented LLM with a toolbox.
Best for Most tasks, honestly. Start here. If one agent with clear tools and a good prompt can do the job, adding agents only adds cost and failure modes.
Breaks when The single prompt has to juggle too many unrelated responsibilities, the tool list grows past ~10–15 and the model picks wrong, or you need genuinely parallel work. That's the signal to split.
Fixed stages in a line: each agent (or step) does one job and hands its output to the next. Control is hard-coded — the order never changes. This is the agentic version of an assembly line, and the same idea as prompt chaining.
Best for Well-understood workflows with a natural order and no branching — ingest → transform → deliver. Deterministic, trivial to trace, cheap to reason about. Each stage can be tested in isolation.
Breaks when The task needs to loop back (“no shoe met the budget — search again with wider criteria”) or branch on content. A pure pipeline can't revisit an earlier stage without you bolting on control flow — at which point you're really building the next shape.
A supervisor (orchestrator, manager, router) owns the goal and delegates to specialist worker agents, then synthesises their results. Unlike a pipeline, the order isn't fixed — the supervisor decides at runtime who to call, how many times, and in what order. This is the workhorse of production multi-agent systems and matches orchestrator–workers and Google's coordinator/hierarchical patterns.
Best for Complex goals that decompose into distinct specialties, where you want central control and clean accountability. Workers can run in parallel (find products while another checks shipping windows), each with its own focused prompt and tools — smaller contexts, fewer wrong turns.
Breaks when The supervisor becomes a bottleneck or single point of failure, coordination overhead (its own tokens and latency) outweighs the parallel gains, or you stack too many layers of managers-managing-managers.
No boss. Agents are peers that message each other directly and decide among themselves what to do next. The review analyst can ping the deal-finder without asking permission; control is decentralised and behaviour is emergent. This is the shape behind agent-to-agent protocols like A2A and “swarm” patterns.
Best for Open-ended, exploratory problems where the path can't be planned up front, and — increasingly — systems built by different owners: your shopping agent negotiating with a merchant's agent it has never met, discovered and called over A2A.
Breaks when You need predictability. Meshes are the hardest to debug (any path is possible), prone to chatter and infinite loops, costly (every hop is tokens), and hard to secure — a peer with a bad edge can drag the whole system off course. Most single-team products do not need a full mesh.
Agents don't message each other at all — they read from and write to a shared workspace (the “blackboard”): the current cart, candidate products, budget, constraints, deadlines. Each agent watches the board, contributes when it has something to add, and the board is the coordination. It decouples agents completely — they only need to agree on the shape of the shared state.
Best for Parallel contributors to one evolving artifact, and long-running or resumable sessions — the board is durable state you can persist, inspect, and pick back up. Great when many agents each own a slice of the same “shopping basket.”
Breaks when Concurrent writes collide (two agents editing the cart at once), the board grows into an unbounded dumping ground, or nothing decides the session is done. You've traded message-routing for state-management problems.
These five are primitives, not rival religions. Real systems compose them:
Match the shape to the work along a few axes — chiefly how much control vs autonomy the task needs, and whether the path is known in advance.
| Topology | Control | Best when | Main cost |
|---|---|---|---|
| Single (star) | Total, one prompt | One agent + tools can do it — the default | Overloaded prompt if scope grows |
| Sequential | Hard-coded order | Fixed, well-understood, no branching | Can't loop or branch on content |
| Hierarchical | Central, dynamic | Decomposable goals, parallel specialists | Supervisor bottleneck & overhead |
| Network / mesh | Decentralised | Unplannable paths; cross-owner agents | Hard to debug, secure & bound |
| Blackboard | Via shared state | Parallel edits to one artifact; resumable | Concurrency & state management |
Every extra agent re-reads context and adds a round-trip. A five-agent mesh can cost 10× a single agent for the same result. Prefer the smallest topology; pass compact structured results between agents, not raw transcripts.
Decentralised shapes can ping-pong forever (“you decide” / “no, you decide”). Always set a turn/message budget and an explicit stop condition — the loop disciplines apply to every topology.
Split work across agents and no one holds the whole picture; decisions get made on partial views. Keep a source of truth (a supervisor's summary or a blackboard) and give each agent exactly the slice it needs — see context engineering.
The more autonomous the shape, the more an errant or injected agent can do. Scope each agent's tools to least privilege, and gate irreversible actions — placing the order, spending money — behind a human or a hard check, exactly as the self-restocking fridge gates auto-purchasing. Prompt injection travels between agents too; see AI/agent security.
Watch the topology grow only as the problem forces it — the healthy path.
“Find running shoes under $120 with good reviews, delivered by Friday.” One agent, four tools, a loop. Ships in an afternoon and handles the happy path.
# Single agent (star) — one loop, four tools
agent = Agent(
instructions="You are a shopping assistant. Find items matching the "
"user's budget, quality and delivery constraints, then buy.",
tools=[search_products, get_reviews, compare_prices, checkout],
)
agent.run(user_request) # model decides which tool, when, how often
Users now want the assistant to weigh dozens of products, cross-check reviews, and compare shipping across sellers — all at once. One prompt juggling everything picks the wrong tool and blows its context. Split the specialties and let a supervisor delegate, in parallel.
# Hierarchical — supervisor delegates to focused workers (parallel)
finder = Agent("Find candidate products for a query", tools=[search_products])
analyst = Agent("Summarise review sentiment for given products", tools=[get_reviews])
deals = Agent("Compare price + shipping ETA per product", tools=[compare_prices])
supervisor = Supervisor(
instructions="Plan the search, delegate to workers, synthesise a shortlist.",
workers=[finder, analyst, deals],
)
shortlist = supervisor.run(user_request) # finder → (analyst ∥ deals) → merge
Sessions now span days (“keep watching for a price drop”). Workers write candidates, prices, and the cart to durable shared state so the session survives restarts and multiple agents build one basket.
| Concern | Choice | Why |
|---|---|---|
| Shape | Supervisor + blackboard | Central control, but state outlives any single turn |
| Shared writes | Versioned cart, per-field locks | Two agents editing the basket won't clobber each other (concurrency) |
| Stop condition | Budget met & in stock & ETA ok | Something must decide the session is done |
| Irreversible step | Checkout gated on confirmation | No agent spends money without a hard check |
To negotiate with a merchant you don't control, your supervisor talks peer-to-peer to the merchant's agent over A2A — a mesh edge bolted onto an otherwise tidy hierarchy. Internally you stayed centralised; you only went decentralised where ownership actually splits.
| Question | Short answer |
|---|---|
| What's an agent topology? | The graph of a system — nodes (agents, tools, shared state), edges (who reaches whom), and where control lives. |
| Where do I start? | A single agent with tools. Add agents only when it visibly strains. |
| Fixed order, no branching? | Sequential pipeline — deterministic, easy to trace. |
| Dynamic order, one owner? | Hierarchical supervisor + workers — the production workhorse. |
| Parallel edits to one artifact? | Shared-state blackboard — decoupled agents, one durable workspace. |
| Unplannable path / cross-owner? | Network / mesh (A2A) — powerful but hardest to control & secure. |
| Biggest hidden cost of more agents? | Tokens & latency — every hop re-reads context and adds a round-trip. |
| Universal guardrails? | Turn budget + stop condition; least-privilege tools; gate irreversible actions. |
| How should topology evolve? | Grown to fit the problem, not pre-built. Stop at the first shape that fits. |
Six questions. Pick an answer for each, then check your score.
The logic inside the shapes — chaining, routing, orchestrator-workers, evaluator-optimizer.
Predetermined vs dynamic routing — coordinator, hierarchical & swarm topologies.
Two frameworks that implement these shapes — conversable agents vs role-based crews.
The mesh edge — how agents discover and delegate to each other across owners.
Safe shared state — the blackboard's real problem: concurrent writes & idempotency.
A topology in the wild — a device event triggers an agent that reasons and buys, with guardrails.