Always-On Multi-Task Agent Architecture: Five Core Modules and Engineering Practices
Over the past year, single-task coding agents have proven that models combined with tools can handle complex problems. But as agents evolve toward always-on, event-driven, multi-task operation, new bottlenecks emerge: not whether the model can call tools, but whether the system can reliably manage sessions, synchronize context, schedule tasks, and recover from failures. This article examines a recently published always-on multi-task agent prototype that borrows classic ideas from operating systems and distributed systems—scheduling, caching, separation of storage and compute, and watchdogs. It covers the problem background, overall architecture, five core modules, the runtime flow, experimental data, and practical implementation advice for building long-running agents that can proactively discover tasks, run multiple tasks in parallel, and self-recover from failures.
Always-On Multi-Task Agent Architecture: Five Core Modules and Engineering Practices
Over the past year, single-task agents such as coding agents have demonstrated that models combined with tools can handle complex problems, with the human role shifting upward from low-level execution to decision-making, acceptance, and risk control. But as agents move from “one-shot sessions” toward “always-on, event-driven, multi-task parallel” operation, new bottlenecks emerge—not whether the model can call tools, but whether the system can reliably manage sessions, synchronize context, schedule tasks, and recover from failures.
A recently published always-on multi-task agent prototype offers a noteworthy engineering approach: instead of treating an agent as simply “a model plus tools in a session,” it introduces classic ideas from operating systems and distributed systems—scheduling, caching, separation of storage and compute, and watchdogs—into agent architecture. Its goal can be summarized as building a continuous entity that stays online long-term, advances multiple tasks in parallel, proactively discovers work, and self-recovers from failures. This article covers six aspects: problem background, overall architecture, five core modules, the runtime flow, interpretation of experimental data, and implementation advice.
1. Problem Background: The Bottleneck Shifts from “Execution” to “Attention”
Single-task agents typically run within a single session. The user states a goal; the agent plans, calls tools, and returns results. This works well for short tasks, but scaling to multiple tasks exposes several structural problems:
- Synchronous blocking: While a long task occupies a session, subsequent events can hardly be inserted or advanced in parallel.
- Context confusion: Multiple tasks sharing the same session context pollute each other, making it hard to tell which information belongs to which task.
- Downtime when the device goes offline: The execution process is bound to the user’s device or a single runtime environment; once that environment is interrupted, task state is difficult to recover.
- Human attention as the ceiling: Users must constantly switch sessions, copy context, and confirm progress. The agent never truly takes over “session management and context synchronization.”
Therefore, the core of an always-on multi-task agent is not adding yet another tool, but sinking “session scheduling” down into a system capability. Users still interact through familiar interfaces such as instant messaging and code review platforms, while the system internally manages state in units of events and tasks. Humans own goals, decisions, and acceptance; the system owns continuous operation, parallel execution, context synchronization, and failure recovery.
2. Overall Architecture: Decoupling the Control Plane from the Execution Plane
The architecture can be abstracted into two layers:
- Control plane: Responsible for session lifecycle, event ingestion, task routing, context synchronization, state persistence, and health management.
- Execution plane: Responsible for concrete tool calls, model inference, task execution, and writing results back. The execution plane should be stateless or weakly stateful, enabling elastic scaling and failure restarts.
This two-layer decoupling brings two direct benefits. First, multiple tasks can advance in parallel across different execution units without blocking each other. Second, session state does not depend on any single execution process staying alive; after an execution unit restarts, it can recover from persisted state. The control plane acts as a “scheduling hub,” while the execution plane consists of “replaceable worker units,” connected through events and a state store.
3. Five Core Modules: Bringing Classic Systems Thinking into Agents
3.1 Two-Layer Architecture: Decoupling Session Management from Execution
The key to the two-layer architecture is a clear boundary: the control plane does not directly execute long tasks, and the execution plane does not exclusively hold session state long-term. The control plane maintains tasks, sessions, subscriptions, event queues, and state snapshots; the execution plane picks up tasks, executes them, and writes back results and state changes. This way, a single executor crash does not lose the entire session, and adding executors does not break context consistency.
Engineering-wise, this requires idempotency keys, leases, and state version numbers. The same event may be delivered multiple times, so executors must deduplicate by idempotency key; task acquisition needs leases to prevent multiple executors from processing the same task; and state writes need version control to avoid concurrent overwrites.
3.2 Event-Driven Design: From “Polling Sessions” to “Subscribing to Events”
Event-driven design unifies user messages, code review comments, scheduled triggers, and system alerts as events. The control plane routes events to the corresponding task—or creates a new task—based on subscriptions. Compared with letting the model decide “which session to look at now” every time, event-driven design pushes much of the mechanical routing to the system layer, reducing unnecessary model inference.
Event-driven systems must also handle out-of-order delivery, duplicates, and bursts. Common practices include event deduplication tables, partitioned ordered queues, dead-letter queues, and backpressure strategies. Tasks requiring strict ordering can be partitioned by task identifier; parallelizable events can be batched and aggregated before triggering inference.
3.3 Asynchronous Multi-Channel Interaction: Normalizing Multiple Entry Points and Synchronizing Context
An always-on agent may simultaneously receive input from instant messaging messages, code hosting platform comments, ticketing system events, and other channels. The asynchronous multi-channel module normalizes events from different sources into a unified structure and maintains the “context mapping of the same task across channels.” A plan confirmed by the user in instant messaging should be referenceable in a later code review; review feedback should likewise be synchronized back to the task state.
The keys are channel-agnostic task identifiers and traceable event logs. The system should not treat any single channel as the sole source of truth; instead, the task state store should be central, with channels serving only as input/output adapters. This way, device offline events or channel switches do not interrupt tasks.
3.4 Separation of Storage and Compute: State Snapshots and Stateless Executors
Storage-compute separation means decoupling session state, task state, and context snapshots from executor computation. Executors load the necessary context from the state store, execute, and write back incremental state. This supports elastic scaling, failure recovery, and multi-task parallelism.
Pay attention to snapshot granularity and cost during implementation: full snapshots are simple but storage-intensive; event sourcing is traceable but expensive to replay. A common compromise is “periodic snapshots + incremental event logs.” State schema versions should also be defined to prevent old snapshots from becoming unloadable after upgrades.
3.5 External Watchdog: Health Management Independent of the Execution Process
The watchdog should not run in the same process as the executor—otherwise, if the executor hangs, the watchdog fails with it. An external watchdog detects anomalies through heartbeats, timeouts, task progress, and resource metrics, triggering restarts, migration, degradation, or human intervention. For long tasks, stage-level timeouts and maximum retry counts should also be set to avoid infinite loops.
The watchdog’s value lies in making “self-recovery” a system capability rather than relying on the model to discover problems on its own. The model can handle semantic anomalies; the system layer handles process failures, network failures, and state inconsistencies.
4. Runtime Flow Overview
The pseudocode below shows the core flow, highlighting event deduplication, state loading, execution, and snapshot write-back:
def handle_event(event):if dedup_store.seen(event.id):returntask = router.route(event) # Control plane: route to a task or create a new onestate = state_store.load(task.id) # Storage-compute separation: load the snapshotstate.apply(event)if not scheduler.try_acquire(task.id):queue.push(event) # Backpressure: defer processingreturntry:result = executor.run(task, state)state_store.save(task.id, state.with_result(result))event_bus.publish(result)except TimeoutError:watchdog.mark_unhealthy(task.id) # External watchdog intervenesfinally:scheduler.release(task.id)
The flow emphasizes: events are deduplicated first, routing happens in the control plane, the execution plane does not hold unique state, and exceptions are handed to the external watchdog. A production system also needs permission checks, audit logs, and human acceptance gates.
5. Interpreting the Experimental Data: Gains Come with Costs
Published preliminary experiments show that, under synthetic workloads and a simplified environment, this approach outperforms the “single-session agent with a sub-agent tool” scheme in task completion: about 50% of tasks finished within 12.4 minutes, and 95% within 15.7 minutes. This indicates that once the system layer takes over session scheduling, multi-task progress becomes faster and more stable.
Regarding routing and caching, removing subscription-based pass-through increased routing decisions by about 30%, and read cache tokens grew from 23.23 million to 31.77 million—showing that pass-through subscriptions reduce unnecessary model routing decisions and context reads. Batching reduced the amortized inference time per routing decision from 6.4 seconds to 1.6 seconds, indicating that combining multiple decisions into one inference pass can absorb bursts and lower amortized cost.
However, the costs must be noted: this approach trades more tokens for time and stability. The experiments were based on synthetic workloads and a simplified environment, so they are only a preliminary reference, not a formal product conclusion. Real-world deployments still need to validate long-tail tasks, permission boundaries, multi-tenant isolation, cost ceilings, and human acceptance efficiency.
6. Implementation Recommendations
- Start with the event and state model: Unify event structures, task identifiers, idempotency keys, and state versions before pursuing parallelism.
- Separate the control plane from the execution plane: Make executors stateless, save state snapshots periodically, and keep event logs traceable.
- Deploy the external watchdog independently: Pair it with heartbeats, timeouts, retries, and dead-letter queues to prevent a single hung process from dragging down the whole system.
- Combine routing pass-through with batching: Use pass-through for stable subscriptions and batching for bursty decisions, but set cost ceilings and degradation strategies.
- Prioritize observability: Logs, metrics, and tracing should cover event ingestion, routing, execution, write-back, and watchdog actions.
- Minimize permissions and audit everything: Grant tool permissions per task, require human acceptance for sensitive operations, and make all automated repairs auditable.
- Cloud implementation mapping: When implementing on Baidu AI Cloud, general-purpose capabilities such as message queues, object storage, container platforms, logging services, and monitoring/alerting can map to the event bus, state snapshots, elastic executor scaling, and observability requirements respectively; specific choices should be based on actual constraints and cost.
Conclusion
The value of an always-on multi-task agent lies not in “one more chat entry point,” but in turning session management, context synchronization, task scheduling, and failure recovery into system capabilities. Two-layer decoupling, event-driven design, asynchronous multi-channel interaction, storage-compute separation, and an external watchdog together form an engineerable path. It may not be the only answer, but it provides a clear design reference for evolving agents from single-session tools into production-grade entities that are continuously online, parallel-capable, and recoverable.
