AI Agents Beyond the Repository: Running Always-On in the Cloud
This article explains why session-bound coding agents fall short and how to evolve them into always-on cloud agents with native messaging and self-growing memory. It breaks down five required modules—scheduling and execution, layered memory, tool permissions, a messaging gateway, and observability—then outlines a four-step rollout path, common pitfalls to avoid, and key design tradeoffs for building controllable, auditable automation.
1. Where the Problem Starts: Agents Trapped by Three Boundaries
Over the past two years, the capability of AI agents has expanded quickly, but their deployment shape has been constrained by three walls.
The first wall is where they run. Many AI coding tools operate inside a developer’s repository context: reading directory structures, retrieving symbol definitions, generating patches, running tests, and iterating on fixes based on failure output. This shape is highly efficient in “human-in-the-loop” coding scenarios, but it is naturally tied to a single interactive session. When the session ends, the process ends.
The second wall is lifecycle. In engineering practice, many tasks are asynchronous: nightly regression runs, dependency upgrade checks, log anomaly aggregation, and scheduled data reconciliation. These tasks do not need someone watching them; they need to “wake up on their own when the time comes.” Session-based agents cannot take on this responsibility.
The third wall is how results are delivered. A result only counts as delivered if it comes back to the window in front of the developer. If the output requires people to actively go and check it, then “automation” degrades into “another to-do item.”
So a second shape emerged in the industry: deploying agents on servers, connecting them to messaging platforms, and allowing them to execute terminal commands, manage schedules, and drive browsers. This step solved the “leaving the laptop” problem—agents moved from the chat box into real workflows. But it exposed a more fundamental weakness: memory is static.
2. Why Static Memory Is Not Enough
Static memory means the agent loads the same fixed context every time it starts: a documentation file, a block of long-term instructions, and a few manually maintained entries. The problem is not that it “cannot remember,” but that “what it remembers does not grow with experience.”
This shows up in four ways:
- No feedback loop. Yesterday a build failed because the cache was mistakenly deleted; today, in a similar situation, it repeats the mistake, because the lesson was never structured into a retrievable constraint.
- Context bloat. Once all experience is piled into one long block of text, retrieval precision drops, token costs rise, and conflicting rules cannot be arbitrated.
- Not auditable. Experience is written in mixed natural language, so you cannot answer “which execution did this judgment come from.”
- Cannot be shared. With multi-person, multi-machine deployments, each maintains its own documentation file, and behavior gradually diverges.
To cross this gap, an agent’s memory must be upgraded from “a single file” to “a layered mechanism.”
3. Target Shape: Three Capabilities Stacked
Placing the three shapes in the same coordinate system reveals a clear capability evolution line:
| Shape | Where It Runs | Lifecycle | Delivery Channel | Memory Characteristics |
|---|---|---|---|---|
| In-repository coding agent | Local / within session | Ends with session | Single window | Current repository context |
| Always-on agent | Server-side | 24/7 always-on | Messaging platform | Static, manually maintained |
| Self-evolving always-on agent | Server-side | 24/7 always-on | Native instant messaging integration | Layered, retrievable, auditable |
The third row is the practical target of this article: cloud always-on + native messaging integration + self-growing memory.
4. Architecture Breakdown: Five Required Modules
1. Scheduling and Execution Kernel
Being always-on requires a scheduler that does not depend on interaction. In engineering terms, it usually consists of two paths—scheduled triggers and event triggers. After triggering, tasks enter a unified task queue, and an executor spins up the agent runtime. The key design is idempotency: repeated triggering of the same task must not produce duplicate side effects.
# Example: scheduling skeleton with idempotency key and timeout controldef run_scheduled(job_id: str, payload: dict):if not lock.acquire(job_id, ttl=1800):return "skipped: already running"try:result = agent.run(payload, timeout=1800)audit.write(job_id, result) # full audit trailreturn resultfinally:lock.release(job_id)
2. Layered Memory System
It is recommended to split memory into four layers, each with its own role:
- Instruction layer: hard constraints that cannot be self-modified, for example prohibiting write operations on production data.
- Knowledge layer: relatively static facts such as project structure, interface conventions, and environment differences.
- Experience layer: entries automatically distilled from execution results, tagged with labels, timestamps, and hit counts.
- Session layer: short-term buffer, archived or discarded according to policy after the task ends.
Writes to the experience layer must be filtered to avoid noise drowning out the signal:
{"id": "exp_20260826_017","trigger": "build failed and the error points to the cache directory","action": "verify cache integrity before retrying, retry limit 1","source_run": "run_9f3c","hit_count": 4,"confidence": 0.82}
At retrieval time, entries are weighted and sorted by “label similarity + confidence + most recent hit,” and only the Top-K are injected into the context, suppressing bloat at the source.
3. Tools and Permission Boundaries
The biggest risk of an always-on agent is not weak capability, but overly broad permissions. A workable approach is to converge permissions across three layers:
- Network layer: default outbound whitelist, opened on demand;
- Execution layer: distinguish read-only commands from change commands, with the latter forced through approval or manual confirmation;
- Data layer: sensitive fields are masked before entering the model, and keys are managed by a key management service and never enter the context.
4. Messaging Gateway
The engineering meaning of “native instant messaging support” is that the message channel is not a bolt-on script but a first-class citizen of the runtime. It needs session routing, message deduplication, streaming chunked push, structured card rendering, and failure re-delivery. In enterprise scenarios, it must also handle identity mapping to ensure that “who asked and who can see the result” can be verified.
5. Observability
At minimum, cover three categories of metrics: task success rate and latency distribution, memory hit rate and conflict rate, and clustering of tool-call failure reasons. Without this data, self-evolution has nothing to calibrate against.
5. Rollout Path: Four Steps
- Always-on first, intelligence second: move low-risk, read-only tasks such as scheduled checks and daily report aggregation to the server, and validate the scheduling and alerting chain.
- Then connect messaging: push results proactively to everyday communication tools, forming a “verify without logging in” loop.
- Then enable memory: start with a single point in the experience layer, recording only “failure—handling” pairs, and observe the hit rate over two weeks.
- Grant permissions last: after auditing and rollback mechanisms are complete, gradually open change operations while keeping a one-click circuit breaker.
6. Common Pitfalls
- Treating long context as memory. Context length solves “can it fit,” not “does it remember accurately.”
- Letting the agent modify its own hard constraints. The instruction layer must be externally controlled, otherwise the security boundary is meaningless.
- Only pushing, not archiving. Messaging is a notification channel, not a data warehouse; results still need to land in object storage or a logging service.
- Ignoring the cost model. Always-on means continuous billing, so resource quotas and concurrency limits should be set by task tier.
7. Conclusion
From a “coding assistant in the repository” to an “always-on colleague on the server,” the main line of agent evolution is not model parameters but the coordination of four things: where it runs, lifecycle, delivery channel, and memory mechanism. If an enterprise wants to build such a system on top of general cloud products like Baidu AI Cloud’s container platform, message queues, object storage, and monitoring and alerting, it is advisable to make boundaries and auditing solid first, then talk about autonomy—only controllable automation has the potential for large-scale deployment.
