Why Multi-Agent Systems Need a Router/Worker Architecture
A practical look at why multi-agent systems hit context contention as workloads grow, and how a Router/Worker split separates coordination from execution. It covers the resource profiles of each role, the structural pitfalls of a single agent handling everything, the contracts that make layering work, and when the added complexity is not worth it.
1. The Problem Is Not a Weak Model, It Is Resource Contention
The default path many teams take when building agents is straightforward: pick a model that is capable enough, attach a set of tools, write a long system prompt, and let the agent handle everything. This works smoothly in a demo because there are few tasks, the turns are short, and the context has not been filled up yet. But as the number of tasks grows and the lifecycle of each task gets longer, problems surface all at once. The root cause is often misdiagnosed as “the model is not capable enough” or “the prompt is not well written.”
A more accurate diagnosis is that this is a resource contention problem. An agent’s context window is a limited and expensive resource. It has to carry both global coordination information and the execution details of individual tasks. When both kinds of demand are packed into the same session, the window budget is consumed quickly, the model’s effective attention is diluted, and behavior starts to become unstable. The essence of a layered architecture is to physically separate the roles that compete for the same window resource, then use explicit contracts to hold the boundaries.
2. The Two Roles Have Completely Different Resource Profiles
The Router (main session / coordination layer) is responsible for global scheduling. It needs to know which tasks are in progress, what state each task is in, what is blocking it, and who should handle the next step. It consumes summaries, task identifiers, state machine fields, and key conclusions. This is a low-bandwidth, short-turn, high-frequency judgment workload. It does not need to see the full output of a build, nor does it need to retain an implementation approach that was rejected three turns ago.
The Worker (execution sub-agent / execution layer) is responsible for advancing a single task: actually modifying files, running commands, reading raw responses, and adjusting strategy based on errors. It needs high-bandwidth context, including full stack traces, paths already attempted, and raw tool responses. This is a long-turn, low-frequency switching workload.
Stacking these two profiles into a single session means forcing one budget to serve two demands that crowd each other out. The benefit of layering is therefore not “a nicer structure,” but giving each layer a context budget that matches its responsibility.
3. Two Structural Pitfalls of a Single Agent Doing Everything
3.1 Cross-Task Context Contamination
Suppose the same session handles Task A and Task B in parallel. The abandoned approach in A, large blocks of logs, and failed attempts keep occupying the window. When the model switches to B, it may treat A’s old conclusions as premises for B, producing reasoning that looks plausible but is actually misaligned.
Relying on a prompt to tell the model to “ignore the above” is unreliable: the instruction does not change budget usage, and the history that has been written still participates in attention computation. A workable approach is physical isolation — each task runs in an independent sub-session and only returns its conclusions.
Router context (stable, low-bandwidth)├─ task_id: A status: blocked summary: dependency interface not ready├─ task_id: B status: running summary: located the parsing layer└─ task_id: C status: queued summary: waiting for resources│ dispatch / collect (contract)┌────┴────┬─────────┬─────────┐Worker A Worker B Worker C (each with its own window)
3.2 Synchronous Blocking
If the main session synchronously waits for a long command to return (a full test run, a full build, batch data processing), it can neither accept new requests nor judge the progress of other tasks until the command returns. From the user’s side, this feels like “it is stuck.” After layering, the Router dispatches and returns immediately, continuing to handle requests and scheduling, while the Worker’s long-running execution is isolated at the lower layer.
4. Contracts Are Where Layering Actually Lands
Layering without contracts only degrades into a call chain that is harder to debug. At least four kinds of agreements are needed:
- Input contract: task goal, constraints, accessible scope, and acceptance criteria, making explicit what must not be done.
- Output contract: structured results (status, conclusions, change summary, evidence pointers), with raw large objects prohibited from being returned.
- Budget contract: maximum number of turns, maximum number of tool calls, timeout, and termination conditions.
- Error contract: distinguishing three categories — retryable, needs escalation, and needs human intervention — to avoid failures being repeatedly swallowed between layers.
An example structure:
{"task_id": "T-102","goal": "Fix parsing exception","constraints": ["Do not change public interfaces", "Do not add dependencies"],"budget": {"max_steps": 30, "timeout_s": 600},"result": {"status": "done", "summary": "...", "evidence": ["log://x"] }}
5. When Layering Is Not Worth It
Layering has fixed costs: extra scheduling logic, state persistence, observability work, and debugging complexity. If tasks are singular, turns are short, no parallelism is needed, or the team still lacks basic capabilities such as logging and tracing, a single agent is the more cost-effective choice first. The signals for judgment are clear: introduce layering when context starts interfering across tasks, long tasks block interaction, or multiple goals need to be advanced in parallel.
When deploying on the cloud, general-purpose capabilities can carry the load: a message queue for dispatch and decoupling, object storage for large evidence, logging services and monitoring alerts for cross-layer tracing, and a container platform for isolated execution environments. The overall goal is always the same: let the scarce context budget be used by the right roles, and let boundaries be guarded by contracts rather than prompts.
