Why Super Agents Need Router/Worker Layering
This article explains why scaling a Super Agent requires splitting it into a Router layer and a Worker layer. The core reason is not organizational modeling but resource management: the context window is scarce, and scheduling versus execution consume it in fundamentally different ways. You will see the two failure modes that appear when both roles share one session—cross-task context pollution and synchronous blocking—along with the physical isolation and explicit contracts that resolve them. The article also covers when layering is not worth the cost.
1. The Conclusion First: Layering Protects a Scarce Resource
When many teams build their first multi-task agent, the instinct is to port an org chart into code: one main agent as the manager, a few sub-agents as employees, a neat topology diagram, and the architecture is considered done. The analogy is intuitive, but it hides the real problem.
The reason a Super Agent is split into Router and Worker layers comes down to one thing: the context window is a scarce resource, and the two roles consume it under completely different models. Putting them in the same session means one budget is contested by two conflicting demands. Layering physically separates the parts that compete for the same window, then fixes the boundary with an explicit contract.
So the test for whether to layer is not “is the complexity advanced enough,” but three questions:
- Are multiple tasks advancing concurrently, each needing a large amount of raw detail?
- Does the main flow get held up as a whole by one long-running step?
- Do intermediate artifacts from different tasks interfere with each other’s conclusions?
If two of the three are “yes,” the payoff of layering starts to exceed its cost.
2. Resource Profiles of the Two Roles: Low-Bandwidth Scheduling vs. High-Bandwidth Execution
The Router (main session) handles global coordination: it needs to know which tasks are running, what step each one has reached, where it is stuck, and who should take the next step. It consumes summaries, task identifiers, state machine fields, and key conclusions. Its interaction rhythm is short turns, high frequency, low bandwidth—a single decision often needs only a few hundred tokens of input.
The Worker (execution sub-agent) advances a single task: it actually edits files, runs commands, reads back raw output, and adjusts the approach based on errors. It consumes full stack traces, paths already tried, verbatim tool output, and relevant code context. Its rhythm is long turns, low frequency, high bandwidth—a single task consuming tens of thousands of tokens is normal.
Stacking these two profiles in one window triggers two classes of failure at the same time.
3. Failure One: Cross-Task Context Pollution
Suppose the agent processes task A and task B in parallel. The abandoned approaches, thousands of lines of logs, and rejected intermediate conclusions left behind by A’s trial and error do not leave the window on their own. When B’s turn to reason comes, the model is likely to treat A’s stale conclusions as premises for B and produce a plan that looks plausible but is misaligned.
A common misconception here is instructing the model to “ignore the above” via the prompt. This is unreliable, for a direct reason: the window budget is not released by a single instruction. An instruction can influence attention allocation; it cannot reclaim token occupancy. The longer the context, the harder it is to suppress the interference weight of irrelevant fragments.
The only workable solution is physical isolation: each task runs in its own sub-session, Workers do not share raw context, and they exchange information only through structured results.
Router session (keeps state only, not raw text)├─ task_A → Worker session A (separate window, returns summary only when done)├─ task_B → Worker session B (separate window)└─ task_C → Worker session C (separate window)
What a Worker returns to the Router should be a compressed conclusion, not the raw process:
{"task_id": "task_A","status": "blocked","summary": "Build failure caused by a dependency version conflict","artifacts": ["log_ref_01"],"next_action": "Manual confirmation of the version strategy is needed"}
Note that artifacts holds reference identifiers rather than the content itself. The Router fetches by reference only when necessary, which both controls window occupancy and keeps the audit trail intact.
4. Failure Two: Synchronous Blocking and Fake “Hangs”
The second pitfall is about timing. If the main session synchronously waits for a long command to return—a full test run, a full build, batch data processing—then until it returns, it can neither accept new requests nor judge the progress of other tasks. From the user’s perspective, the agent is “stuck,” even though computation is proceeding normally in the background.
This is where the value of layering shows up most directly: the Router releases immediately after dispatching a task and keeps handling new requests and scheduling decisions; the Worker advances in the background and reports back as an event when done.
# Pseudocode: dispatch and return, so the Router is not occupied by long tasksdef handle_request(req):if req.kind == "new_task":task = register(req) # register statedispatch_async(task, to=worker_pool) # non-blocking dispatchreturn {"task_id": task.id, "status": "accepted"}if req.kind == "worker_report":update_state(req.task_id, req.result) # update state and summary onlyreturn {"status": "recorded"}
Engineering-wise, three things are also needed: a task state machine (explicit transitions among queued/running/blocked/done), timeout and cancellation semantics (to avoid zombie tasks holding resources indefinitely), and idempotent handling of reports (so a Worker retry produces no duplicate side effects).
5. Contracts Are the Real Guard of the Boundary
Physical isolation solves “no mutual pollution”; contracts solve “the boundary is not eroded.” The Router and Worker should exchange only three things: the task description, the acceptable input range, and structured output. Anything out of bounds should be explicitly rejected rather than left to the model’s discretion.
A minimal contract usually includes:
- Input constraints: the range of resources that may be accessed, a whitelist of callable capabilities, and a budget cap per task.
- Output schema: a status object with fixed fields; unstructured long text must not be returned.
- Failure semantics: the distinction between retryable and non-retryable errors, plus a fallback path.
- Permission boundary: Workers do not get read access to global configuration or cross-task data.
The value of a contract is that it is verifiable. When output does not match the schema, the scheduling layer can declare a failure and re-dispatch directly, instead of pushing a vague piece of natural language back into the main session and restarting the pollution.
6. When Not to Introduce Layering
Layering has costs: extra session management, state persistence, result aggregation logic, and the complexity of cross-layer debugging. Layering is basically a net negative in these scenarios:
- A single task with a short flow that can be wrapped up within one interaction;
- Tasks that are tightly coupled and must share a large amount of raw detail to reason;
- Instant conversation that needs very low latency, where an extra dispatch-and-report hop noticeably lengthens the response;
- A team lacking basic capabilities such as state storage, logging services, and monitoring/alerting, where layering makes problems harder to locate instead.
The pragmatic path is to make the monolith solid first, then introduce layering once the two signals actually appear—the window being crowded out, and long tasks holding up the main flow—and to prioritize isolating Workers first while keeping the Router lightweight.
7. Summary
The logic behind Router/Worker layering is not mysterious: the Router needs a low-bandwidth global view, the Worker needs high-bandwidth single-point execution, and mixing the two in one window inevitably produces cross-task pollution and synchronous blocking. The solution is physical isolation plus contract constraints—separate the execution parts that compete for the same resource, and use structured boundaries to guard collaboration. It neither imitates an org chart nor prides itself on complexity; on a single-task short chain, not layering is the right choice.
