R084 · Agent principles and patterns › Long-running agents and durable execution

Building always-on agents: five primitives for agents that sleep, wake and act

Read the original

agent-architecturedurable-executionagent-memoryhuman-oversightagent-authasync-review

Source: Anthropic, Building always-on agents (William Hu, 13 Nov 2026), surfaced by Elvis Saravia (DAIR.AI). Audience: staff engineers designing proactive or background agents.

TL;DR

An "always-on" agent is a UX claim, not a runtime property. The agent is asleep almost all the time and wakes for short runs: receive an event, act, persist what changed, sleep. What makes it feel continuous is five pieces of ordinary infrastructure around the same agent loop: an event inbox, timers, memory, permissions (including deferred tool calls), and an outbox. The guide's argument is that each of these should be its own durable store or service, not something the agent improvises inside its context window. The economics changed too: the guide cites one long-horizon coding benchmark where cost per solved task fell 78% between model generations, versus about 40% on typical workloads.

Architecture

Run and session. A run is one wake-up: events in, work done, state saved. A session is the transcript a run executes inside. A reply to earlier work resumes the existing session; anything else starts a new one. Sessions that grow too long are compacted or replaced, so anything that must survive goes to memory during the run.

1. Event inbox. Every trigger (user message, webhook, scheduled job, background job) writes to one durable list instead of calling the agent directly. Minimal form: a table of events, an HTTP handler that appends rows and wakes the worker, and a worker that reads pending rows and starts a run. Rules:

2. Timers. Two kinds: follow-ups (one-shot deadlines the agent sets for itself, e.g. "check if they replied") and schedules (recurring cadence). They live in their own store, separate from the inbox, because the inbox should only hold work that is ready now. A scheduler polls on a fixed interval, marks follow-ups done or advances a schedule's next due time, and enqueues an event. A timer never starts a run directly; it goes through the inbox like everything else. A durable execution engine can replace the hand-built scheduler.

3. Memory. A directory of files mapped to durable storage (database or object store) so it outlives workers. Store only what the agent cannot look up again; for anything in another system, store a pointer. Four kinds:

4. Permissions. The highest-risk primitive, because runs act unattended with the user's access. Three parts: a credential proxy outside the agent's environment that injects secrets into outbound requests (the agent never holds them); an auto mode where classifiers review risky actions and block dangerous ones so the agent finds a safer path; and deferred tool calls, where a call needing approval ends the run, saves the session mid-call, shows the user a request (for example an interactive card), and the answer arrives as a new inbox event that resumes the session. The worker keeps serving other events meanwhile.

5. Outbox. A run ends one of three ways: send a message, decide nothing needs sending, or defer for input. A simple send tool is enough at first; a formal outbox table plus a dispatcher is for pacing messages and recovering from send failures. The guide's tuning advice: build evals for message volume, and start quiet, earning attention over time.

The cycle. Event in, run in a new or resumed session, read memory, act within permissions, write memory, push to outbox, optionally set a timer. The user's reply or the timer becomes the next event.

Tradeoffs

DecisionOption AOption BWhen to pick which
Event deliverySources call the agentSources write to an inboxInbox as soon as there is more than one event source or any chance of concurrent events
Mid-run arrivalsQueue for next runFold in / interruptQueue by default; interrupt only for cancellations or corrections that make the current run wrong
Memory contentCopy facts inStore pointersPointers for anything with an owning system (tickets, docs, CRM); copy only what cannot be re-fetched
Session lengthCompactNew sessionNew session when the task changes; compact when continuity of reasoning matters more than detail
ApprovalsBlock the runDeferred tool callDeferred whenever a human may take minutes or more
OutboundDirect send toolOutbox + dispatcherOutbox when you need pacing, quiet hours, dedupe of near-identical messages, or retries
SchedulerOwn polling serviceDurable execution engineEngine when timers must survive deploys at scale or when steps already run there

Failure modes

Review checklist

  1. Is there exactly one durable path by which anything wakes the agent?

  2. Does each event have a source ID, status, and dedupe rule?

  3. Is there a single-worker lease per inbox, and a stated policy for events that arrive mid-run?

  4. Are timers in their own store, with follow-ups and schedules distinguished and an owner task for each?

  5. Is every external side effect idempotent under retry?

  6. Does memory hold pointers for anything owned elsewhere, and a separate always-loaded file for user instructions?

  7. Does the agent keep a record of what it already told the user?

  8. Are credentials injected by a proxy the agent cannot read?

  9. Which tool calls are auto-approved, classifier-reviewed, or deferred, and is that list written down?

  10. Do deferred calls expire, and what happens when they do?

  11. Is there an eval for how often the agent messages the user, with a quiet default?

  12. Is the per-run fixed context small and cached?

Connections

See R084 on the knowledge map

Part of the Research notes on nowucca.com. Figures and claims are the source's own unless the summary says otherwise.