Always-On Agent Architecture: Multi-Task Scheduling and Reliability in Practice
This article examines what changes when AI agents move from single-session execution to continuous operation. It proposes a two-layer architecture that separates control-plane task management from execution-layer workspaces, and explains how event-driven resumption, explicit task state machines, duplicate and out-of-order event handling, asynchronous multi-channel interaction, and storage-compute separation support reliable multi-task execution. The article also covers independent supervision of liveness, progress, and resource usage; performance optimizations such as deterministic routing, bounded batching, concurrency limits, and backpressure; and evaluation metrics that include quality, cost, and human effort. It concludes with a phased adoption path: establish a reliable closed loop first, then improve concurrency and context handling, and only later expand proactive task discovery under clear authorization, risk grading, and audit controls.
Always-On Agent Architecture: Multi-Task Scheduling and Reliability in Practice
1. Moving from Single Execution to Continuous Operation: What Changes
Traditional agents usually work around a single session: the user states a goal, the model plans steps, calls tools, and returns a result. This model fits tasks with clear boundaries and short execution times, such as analyzing a program, organizing a document, or generating test cases.
When an agent must track multiple requests at the same time, wait for external feedback, and continue work across different interaction channels, however, the limits of the single-session model become apparent.
The first issue is synchronous waiting. A task waiting for approval or an external system response should not block other tasks. The second is context interference. Multiple tasks sharing an ever-growing conversation history can introduce irrelevant information and even confuse execution goals. The third is lifecycle. A user closing a page or a terminal disconnecting should not mean that a background task stops.
An always-on agent is therefore not simply a model that keeps running. It is a software system that embeds model execution within scheduling, persistence, communication, and recovery capabilities.
From an engineering perspective, its goals can be summarized as four capabilities:
- Continuous existence: Task state is stored independently of front-end connections and can continue when later events arrive.
- Parallel progress: Different tasks have relatively independent execution contexts, and waiting does not spread without reason.
- Controlled proactivity: The system can recognize events within authorized scope and act on them, rather than searching for work indefinitely on its own.
- Failure recovery: The system can detect anomalies, preserve execution progress, and retry or request human intervention according to explicit rules.
Together, these four capabilities determine whether a system can move from a demo prototype to an operable service.
2. Two-Layer Architecture: Separate Scheduling from Execution
One practical design divides the system into a control layer and an execution layer.
2.1 The Control Layer Manages Tasks, Not All Reasoning
The control layer mainly addresses what happened, who should handle it, and when to continue. It receives events, identifies task ownership, maintains task state, applies priority policies, and handles resource quotas.
Not every routing decision requires model involvement. For information with an explicit task identifier, subscription relationship, or resource ownership, deterministic rules can dispatch it directly. The model is called only when event meaning is unclear, multiple tasks may be involved, or user intent must be interpreted.
This reduces inference cost and lowers the randomness of scheduling behavior. Models are suitable for resolving semantic ambiguity, but they should not replace system rules that can be encoded explicitly.
2.2 The Execution Layer Builds a Workspace Around Each Task
The execution layer handles planning, tool calls, result validation, and staged output. Each task should have an independent working context containing its goal, constraints, relevant materials, execution records, and pending items.
Task isolation does not mean prohibiting information sharing. Sharing should occur through explicit material references, structured results, or controlled messages, not by directly concatenating the full history of other tasks.
For example, two tasks may need the same requirements document and can reference the same read-only material. However, one task’s temporary assumptions, unverified conclusions, and tool failure records should not automatically enter another task’s context.
Logical context isolation is not the same as security isolation. When sensitive data or high-privilege operations are involved, real isolation boundaries should also be established through identity permissions, runtime environments, and resource access policies.
3. Event-Driven Resumption: Resume Tasks When Needed
Always-on operation does not require the model to reason continuously. A more reasonable approach is to let events trigger task state changes and release computing resources when there is no new information.
Events may come from user messages, scheduled checks, tool execution results, approval decisions, file changes, or external business status updates.
A unified event envelope should record at least the following information:
- Event identifier and source;
- Associated task or resource identifier;
- Event occurrence time and receipt time;
- Payload or payload reference;
- Permission scope and necessary tracing information.
These fields are general design recommendations, not a mandatory interface specification. Their core purpose is to let the system determine whether an event is duplicated, which task should receive it, and how it should be audited later.
3.1 Manage Tasks with an Explicit State Machine
Tasks can use states such as pending scheduling, executing, waiting for external input, waiting for human confirmation, completed, failed, and canceled.
State transitions must have explicit grounds. For example, executing a tool does not necessarily mean the task continues to occupy the model. After a tool submission succeeds, the task can enter a waiting state until a result event arrives.
The absence of new messages also does not mean the task is complete. Completion should be determined by acceptance conditions, such as a target file being generated, tests passing, approval being completed, or the user explicitly accepting the result.
3.2 Prepare for Duplicate, Out-of-Order, and Late Events
In systems with retries and reliable delivery, events may arrive more than once. Events from different sources may also arrive out of order, so task progress cannot rely only on receipt order.
Common measures include event deduplication, task version validation, and rejection or revalidation of stale results. For a canceled task, a late tool result should not automatically trigger follow-up write operations.
If an event corresponds to an irreversible action such as payment, publication, or deletion, message deduplication alone is not enough. Business-level idempotency constraints and execution credentials are also required.
4. Asynchronous Multi-Channel Interaction: Unify Tasks Without Mixing Permissions
The same task may be raised in a group chat, discussed on a code review page, and finally delivered through a notification channel. The system needs to maintain task continuity rather than treating every entry point as an unrelated new session.
This requires distinguishing three concepts:
- Interaction channel: Where messages enter and where results are sent;
- Task entity: The goal to be completed and its state;
- Identity and permission: Who may view information, modify goals, or approve operations.
Contexts across channels can be associated as needed, but permissions cannot be inherited directly. Being able to participate in a public discussion does not mean a person has the right to read internal materials associated with a task. Being able to receive progress notifications does not mean a person can approve a release.
Output should use a layered notification strategy:
General progress changes can be summarized, avoiding interruptions for every tool step. Key decisions should explain options, impact, and recommendations. Actions with external side effects should require confirmation according to risk level.
What asynchronous interaction really optimizes is not the number of messages, but the attention cost users pay to move a task forward.
5. Storage-Compute Separation: Decouple Context from Processes
If task memory exists only in model invocation context or process memory, service restarts, execution node failures, or session termination can cause progress loss.
The core of storage-compute separation is to place persistent task state in external storage while compute nodes read, execute, and write back results as needed. It does not mean eliminating local caches; it means caches must not become the only source of truth.
Information can be divided by purpose:
5.1 Persistent State
Store task goals, state, permissions, acceptance conditions, key decisions, and execution progress. This content supports recovery and auditing and should have explicit data structures.
5.2 Process Records
Store events, tool requests, tool returns, and state transitions for troubleshooting and reconstructing execution. Records may contain sensitive information, so access control and retention periods are required.
5.3 Working Context
Prepare necessary materials for the current step, including task summaries, recent events, relevant evidence, and the current plan. It should be a selected working set, not an undifferentiated accumulation of all history.
Summaries can reduce context size, but they are lossy compression. When amounts, versions, approval decisions, or execution results are involved, structured facts and references to original evidence should be retained rather than relying on natural-language summaries alone.
In addition, checkpoints should be placed at recoverable action boundaries where possible. For operations with external side effects, record stages such as planned execution, submitted, and result confirmed so that after a restart the system can determine whether to query status or execute again.
6. External Supervision: Distinguish Process Liveness from Effective Task Progress
A model semantically believing it is still working does not prove that the task is making progress. Supervision should therefore be as independent as possible from the execution flow being monitored.
It should monitor at least three types of signals:
- Liveness signals: Whether the working process can still respond;
- Progress signals: Whether the task produces valid state changes within a reasonable time;
- Resource signals: Whether call counts, execution time, and cost exceed budget.
Checking process liveness alone is insufficient. An executor may keep emitting logs while repeatedly calling the same tool and never satisfying acceptance conditions.
Recovery actions should differ by anomaly type. Temporary network errors can be retried within limits. Insufficient permissions should pause the task and request authorization. Ambiguous goals require user clarification. When duplicate external side effects are suspected, the system should verify results first rather than immediately replaying operations.
Automatic recovery must have boundaries. Retry limits, backoff strategies, task budgets, and human takeover conditions should be set to prevent supervision from amplifying one failure into a series of errors.
7. Performance Optimization: Reduce Ineffective Scheduling, Not Just Increase Concurrency
The performance of a multi-task system depends not only on model speed but also on scheduling frequency, context construction cost, external tool latency, and resource contention.
7.1 Deterministic Direct Routing
When a reliable subscription relationship already exists between an event and a task, the event can be delivered directly to the target task, avoiding repeated semantic routing. However, subscriptions must support cancellation, permission checks, and lifecycle management so that completed tasks do not continue receiving irrelevant events.
7.2 Bounded Batching
For low-risk scheduling requests that can tolerate a short wait, processing can be combined within a controlled time window to amortize invocation overhead.
Batching does not necessarily reduce overall latency. Waiting for a batch adds queueing time, so urgent events, interactive requests, and background events should use different strategies.
7.3 Concurrency and Backpressure
Adding more executors does not necessarily increase throughput. If multiple tasks compete for the same external resources, excessive concurrency may cause rate limiting, conflicts, and retry storms.
The system should set global concurrency limits, per-user quotas, and resource-level limits. When queues continue to grow, apply backpressure by delaying low-priority tasks, merging duplicate events, or rejecting excess requests.
8. How to Evaluate Whether the Architecture Is Truly Effective
Evaluation should not rely only on average completion time. Quality, cost, and human burden should also be observed.
At minimum, the following metrics should be covered:
- Task success rate and acceptance pass rate;
- Median and high-percentile end-to-end completion time;
- Queue time, execution time, and external wait time;
- Model invocation volume and resource consumption per successful task;
- Duplicate execution rate, recovery success rate, and permission violation count;
- User confirmation count, human intervention time, and number of ineffective notifications.
When comparing different approaches, use the same task set, model conditions, tool permissions, concurrency load, and success criteria. Otherwise, a shorter completion time may simply come from more resources or looser acceptance conditions.
The preliminary experiments in the source material involved synthetic workloads and simplified environments. They are therefore better suited to proposing architectural hypotheses than to serving as direct performance commitments for real business workloads. Production adoption still needs validation through historical task replay, fault injection, and small-scale trial runs.
9. Recommended Adoption Path: Build a Reliable Closed Loop First, Then Increase Proactivity
In the first phase, prioritize task identifiers, persistent state, event ingestion, log tracing, and human takeover so that tasks are observable, pausable, and recoverable.
In the second phase, introduce independent working contexts and limited concurrency to address cross-task interference and synchronous waiting, and verify that duplicate events do not cause duplicate side effects.
In the third phase, add deterministic direct routing, batching, and context compression, using actual metrics to judge optimization benefits and avoid stacking complex mechanisms too early.
Only then should the ability to proactively discover tasks be opened gradually. Proactivity should be built on explicit authorization, trusted data, risk grading, and audit mechanisms. External text should be treated only as data to be analyzed; it must not automatically gain operational permission simply because it contains instruction-like content.
The key to an always-on agent is not to make the model responsible for the entire system, but to place uncertain semantic reasoning inside a controllable execution framework: the scheduling system manages pace, persistence preserves facts, permission mechanisms constrain behavior, supervision handles anomalies, and users retain key decisions. Only when these foundational capabilities work together can a multi-task agent become efficient, stable, and trustworthy at the same time.
