Always-on Agents, Asleep Most of the Time
The Claude team published an architecture writeup you can build from. The five pieces—inbox, timer, memory, permissions, and outbox—are not new on their own. What's really valuable is the judgment: always-on is a user experience, not keeping the model online burning tokens.
The Claude team posted a document on its website titled Building always-on agents, by William Hu of Anthropic's Applied AI team, in the Claude Platform best practices guide. It answers a very concrete question: how to build an always-on agent in your own product.
First, the sentence in the whole document most likely to be missed: always-on is a user experience. The model does not need to stay online consuming tokens all the time.
Behind this sentence is a fairly counterintuitive fact. This kind of agent sleeps most of the time. When an event arrives or the time comes, it wakes once, receives the event, does the work, saves state, and goes back to sleep. A single run is short; the loop keeps turning. The underlying core loop is the same as a normal agent's and still follows Anthropic's earlier Building effective agents. The differences are all on the periphery: who decides when it wakes, which state must persist across runs, and how results are delivered to the user.
Below, let's break it down by component. Inbox, timer, memory, permissions, and outbox are not new individually; many teams have already cobbled together similar things with queues and scheduled jobs. What's valuable is how clearly responsibilities are divided.
Inbox: queue all events first, then wake up
Most agents run only when the user sends a message. Always-on agents also need to be triggered by webhooks, scheduled jobs, and background jobs. If every source calls the agent directly, two events arriving at the same time may start two conflicting runs, and if the process crashes, the event is lost.
The document's approach: all sources first write events into an inbox, and then a worker claims them. The simplest version has three parts: a persistent events table, an HTTP endpoint responsible for writing, and a worker that reads events from the table. Each event records its status and is deduplicated by the unique identifier from the source. It recommends starting with one inbox per user and splitting later if higher parallelism is needed.
A few practical recommendations worth copying down:
- The processing endpoint should acknowledge receipt as quickly as possible; some webhooks treat slow responses as failures. Put checks such as prompt injection detection into the run itself.
- The inbox is the single source of truth for events. When a worker wakes up, it first pulls the latest events from it; if it dies midway, a new worker can retry the same event.
- Keep only one active worker per inbox at a time.
- The worker should batch pending events; if the user sends several messages in a row, combine them into one run and reply only once.
A reader in BD said in the comments that she most needs to figure out three things: when to remind me, when to wait for my confirmation, and when it may speak externally. Being able to wake up on its own is convenient, but there must be boundaries before it speaks on my behalf. This comment gets to the heart of both the inbox and permissions at once.
Timers: making the agent seem proactive
Only with an inbox plus timers does an agent seem proactive. Timers fall into two categories. One is follow-up: a deadline the agent sets for itself, and when it arrives, it checks whether the other party has replied. The other is schedules: fixed recurring cadences, such as a daily briefing.
Timers are stored separately, in another table, because the inbox should contain only events that can already be processed. When a timer expires, the scheduler does not start a run directly; instead, it drops an event into the inbox and goes through the same flow. You can write the scheduler yourself or use an existing durable execution engine.
Memory: store only what can't be looked up next time
An always-on agent goes through many disconnected runs, and continuity is maintained by memory. Memory also needs to be stored separately. Claude Code's automatic memory and the Messages API's memory tool are both implemented as file directories; when applied to this kind of agent, the directory maps to a database or object storage, so even if the worker stops, the memory remains.
Four categories of content to save:
- Instructions from the user about the agent's behavior, kept as a separate document and loaded at the start of every run. The user may not be present, so the instructions must take effect in every run.
- Notes about the user: role, preferences, and things they have corrected. You can start with a single file and split it as content grows; load an index first each time, then read specific files when details are needed.
- What has already been told to the user, to avoid repetition.
- Progress on in-flight tasks, one file per task, stating what has been done and what remains.
A rule of thumb: put in memory only what the agent won't be able to look up later. If the information already lives in an issue tracker, store only a link.
There is also a cleanup process called dreaming that reviews past sessions, removes outdated entries, and identifies patterns visible only across multiple runs. The document only touches on it; the specifics are in a companion article about memory.
Every run must load the system prompt, tool definitions, and memory files. That cost is incurred every time, so keep them lean and use prompt caching to control cost. If a session gets too long, you can compress earlier messages or start a new session. Both approaches lose details, so anything that must be retained should be written into memory during the run first.
Permissions: the real gate before launch
Permissions are the riskiest part of this kind of agent. A run holds the user's access permissions, and it is inherently working while no one is watching.
The document emphasizes three approaches. The first is credential custody: put a proxy outside the agent's runtime environment, and have the proxy inject credentials into outgoing requests. Requests the agent sends itself do not carry real credentials.
The second is auto mode. Claude Code uses a classifier to review higher-risk operations, blocks the parts it considers dangerous, and has the model take a safer path; the most important decisions are still left to humans.
The third is deferred tool calls. Use a hook to set a call aside first; the current run ends, and the session stops in the middle of that call and is saved. The request can be presented to the user as an interactive card via MCP Apps, and the user's answer comes back to the inbox as a new event, starting another run and restoring the saved session. While waiting, the worker continues handling other events as usual, and the agent does not get stuck.
A commenter said this is far more practical than suspending the entire agent and waiting idly for the user to click. That judgment holds.
Outbox: speak less at first
A normal agent streams reasoning, tool calls, and the answer all the way to the user. An always-on agent does most of its work in the background; the user sees results and a small amount of detail.
A run has three possible outcomes: send a message to the outbox, decide there is nothing to send, or use a deferred call to request permission. In most cases, one tool that sends messages directly to the user is enough. You need a formal outbox only when you need to control the cadence of sending or want to recover from send failures.
The outbox is a table that stores pending messages, plus a dispatch process responsible for reading pending messages, deciding which ones to send, and delivering them to the user.
Sending frequency needs to be tuned separately. Sending too much disturbs users; sending too little misses things they should know. The document recommends using evals to find the balance; a better approach is to have the agent speak less at first and then earn the user's attention bit by bit.
A reader named ikook put it well: always-on can easily turn into always-interrupting. Whether it should ping someone often matters more than how frequently it runs in determining whether this thing can be used long term.
On cost
The document attributes why this is worth doing now to model progress. First, judgment is better, and the model has a clearer sense of when to stop and confirm; second, intelligence is getting cheaper. One example given is that on a long-horizon coding benchmark, Opus 5.5 costs 78% less than Opus 5 per completed task, and 40% less on typical workloads; both figures are reported by Anthropic itself. The accompanying cost document states that this benchmark is a subset of SWE-bench Pro, that the solve rates of the two generations of models are roughly comparable, and that subset scores cannot be directly compared with the public leaderboard.
If you only implement one piece first
meng shao's post-reading recommendation is to build the inbox first. Making it the single source of truth, keeping only one active worker at a time, and merging rapid-fire messages into one run are the decisions that determine whether the system can withstand webhook retries and concurrent events. If a new event arrives mid-run, whether to put it in the next round, merge it into the current round, or interrupt and start over is a choice the document leaves to the developer. It directly affects how the product feels, so you need to think it through in advance.
There is also a companion piece to read: SpaceXAI's Lee Robinson's lecture in Stanford CS146S, on the architecture, harness, and context engineering of always-on proactive agents. Reading the two side by side makes it easier to distinguish what is essential to the architecture from what is merely beautifully written documentation.
Inbox, timer, memory, permissions, and outbox are not new individually. But some teams really do launch and immediately max out notifications, and users uninstall three days later. Speak less at first—this line may be more useful to product managers than an architecture diagram.
发布时间: 2026-11-15 18:26