Router/Worker Layering for Super Agents: Design Logic and Boundaries
As super agents move from demos to production, teams often encounter context contention, cross-task contamination, and synchronous blocking. This article explains why Router/Worker layering is fundamentally a resource-governance pattern: isolate private task context, keep the router on low-bandwidth summaries, decouple dispatch from waiting, and enforce clear input/output contracts. It also covers permission scoping, error classification, result aggregation, and the signals that indicate when layering is not worth the added cost.
When a super agent moves from the demo stage to production, many teams follow a similar path: choose a capable model, attach a set of tools, and use a long prompt to ask it to “do everything.” In a demo, this approach provides fast feedback, a short execution chain, and intuitive results. But once tasks become more numerous, longer, and more concurrent, problems gradually emerge: the context window is repeatedly occupied by information from different tasks, the main session cannot respond to new requests while waiting for long-running tasks, and execution details interfere with global coordination.
The value of Router/Worker layering is not to imitate the “manager and executor” structure of an organization chart, nor is greater complexity inherently more advanced. Its more fundamental goal is to govern scarce resources: physically separate the two workloads of global coordination and local execution, then use task contracts to protect the boundary. The following analysis examines context resources, cross-task contamination, synchronous blocking, contract design, and applicability boundaries.
1. The Core Conflict: The Context Window Is a Scarce Resource That Gets Contested
In a super agent, the context window is not merely a capacity question of “how many characters can fit.” It also involves attention budget, state consistency, and information noise. Every additional irrelevant log in the window increases the risk that the model’s attention to key goals will be diluted; every additional abandoned plan increases the chance that later judgments will be misled by old conclusions.
Router and Worker have fundamentally different context requirements.
The Router is the main session or scheduling layer, responsible for global coordination. It must track multiple tasks at the same time and know what stage each task is in, whether it is blocked, who should receive the next assignment, and whether additional user input is needed. It does not need the full details of each task; it only needs the task identifier, goal summary, key state, priority, budget, and blocking reason. Therefore, the Router needs low-bandwidth, short-turn judgment context.
The Worker is an execution sub-agent responsible for advancing a single task. It must modify code, run builds or tests, troubleshoot errors, and read tool-returned results. Stack traces, attempted solutions, raw output, and verification results may each determine the next action. Therefore, the Worker needs high-bandwidth, long-turn execution context.
If one session takes on both roles, the window will quickly be filled by both types of information: global state will be drowned by raw logs, while execution details will be disturbed by summaries from other tasks. Relying on a prompt to tell the model to “forget the previous content” is unreliable, because the window budget will not be automatically released just because of one sentence. A more effective approach is physical isolation: each task has its own sub-session or private context, and cross-task communication passes only structured summaries and necessary references.
2. Cross-Task Contamination: Use Physical Isolation Instead of Prompt-Based Forgetting
Suppose the main session handles Task A and Task B at the same time. Abandoned attempts, large logs, and temporary conclusions from Task A remain in the window. When the session turns to Task B, the model may mistakenly treat an old conclusion from A as a premise for B. This type of problem is not simply a matter of “the prompt not being written well enough”; it is cross-task contamination caused by unclear context boundaries.
The isolation strategy should include three layers:
- Task-private memory: Each Worker loads only the goals, constraints, historical actions, and evidence of its own task, and does not directly read the raw context of other tasks.
- The Router stores summaries only: The Router maintains a task ledger that records status, artifact references, blockers, and next-step decisions, but does not store full logs.
- Evidence is pulled on demand: When the Router needs to judge result quality, it pulls key snippets through structured references instead of loading all raw content back into the main window.
In this way, contamination is blocked by contract boundaries. Tasks can share global safety policies, budget policies, and user preferences, but they cannot share unabstracted intermediate reasoning and discarded conclusions.
3. Synchronous Blocking: Dispatch and Waiting Must Be Decoupled
The second common pitfall is synchronous blocking. If the main session waits synchronously for a long-running command to return, such as a full build, a full test suite, or a long data scan, then before it returns, the main session can neither receive new messages nor judge the progress of other tasks. To the user, the agent appears to be “stuck.”
After layering, the Router dispatches a task to a Worker and can immediately return a task identifier, then continue accepting new requests. The Worker advances in the background and reports progress through events or status updates. The Router aggregates, escalates, or reschedules based on those events. The key point is that the Router should not read the Worker’s full logs; otherwise, the main session will again be blocked and contaminated by long content. It consumes only state events, summaries, and evidence references.
Pseudo-code:
Router:on_user_message(msg):task = classify_and_split(msg)record_task(task.id, task.goal, task.budget)dispatch_to_worker_pool(task)reply_ack(task.id)on_worker_event(event):update_task_state(event.task_id, event.state)if event.needs_aggregation:summary = read_structured_summary(event.task_id)decide_next_step(summary, event.evidence_ref)Worker:run(task):context = load_private_context(task.id)loop:action = model_decide(context, task.contract)result = execute(action, scope=task.allowed_tools)context.append(compact(result))if task.done:emit(SUCCESS, summary, evidence_ref)if task.blocked:emit(NEED_INPUT, reason)
At the same time, timeout, cancellation, retry, and idempotency controls must be in place. Otherwise, asynchronous execution merely moves the blocking from the main session to the task queue.
4. Contract Boundaries: Layering Is Not Just Splitting Things Apart
Whether Router/Worker layering works depends on whether the contracts are clear. The input contract should define the goal, acceptance criteria, constraints, tool permissions, budget, and deadline. The output contract should define status, artifacts, evidence references, error classification, and next-step recommendations. The state machine can include states such as pending, running, waiting for input, succeeded, failed, and canceled.
Permissions should be minimized: a Worker can call tools only within the scope authorized for its task; the Router is responsible for issuing global policies but cannot replace the Worker in execution details. Errors should be classified: retryable errors, requests for additional user input, and unrecoverable errors should be handled separately. Result merging should be based on summaries and evidence references, not by concatenating the raw logs of multiple Workers back into the main window.
5. When Layering Is Not Worth Introducing
Layering has costs: scheduling overhead, state consistency, result aggregation complexity, and observability engineering. For simple single-step tasks, low-concurrency short tasks, and scenarios requiring strong interactive immediate feedback, a single session plus tools may be more direct. To decide whether to introduce layering, look at four signals: whether tasks are concurrent, whether a single task is long-running, whether there is a risk of cross-task contamination, and whether the main session is easily blocked. A more reliable path is gradual: first implement task-private isolation, then asynchronous dispatch, and finally complete contracts and observability.
In short, the essence of Router/Worker layering is resource governance and lifecycle management: keep the Router on low-bandwidth, short-turn global judgment; let the Worker handle high-bandwidth, long-turn local execution; use physical isolation to solve cross-task contamination; use asynchronous dispatch to solve synchronous blocking; and use contracts to protect boundaries. Understanding this is necessary to avoid complexity for its own sake and to realize the real value of layered architecture in appropriate scenarios.
