Anthropic publishes guide on building always-on agents with five core primitives

Anthropic breaks down the architecture behind stateful, proactive AI agents that manage context across sessions and act without direct supervision.

cpaua5 min11
Anthropic publishes guide on building always-on agents with five core primitives

Anthropic has published a detailed guide on building always-on agents, the stateful and proactive systems that maintain context across sessions and take actions without direct user supervision. The guide identifies five core primitives — event inbox, timers, memory, permissions, and outbox — that form the surrounding architecture distinguishing these agents from standard request-response models.

The run cycle: asleep until an event arrives

An always-on agent is not literally always running. It spends most of its time dormant, waking only when an event triggers a run. Each run receives an event, completes its task, saves information about what happened, and then returns to sleep. Runs operate inside a session — the transcript of messages and tool calls — and the cycle repeats indefinitely. This architecture lets the agent handle long-horizon work while keeping compute costs proportional to actual activity.

Event inbox prevents race conditions and lost events

Unlike standard agents that only run on user messages, always-on agents can be triggered by webhooks, scheduled tasks, and background jobs. Routing every source directly to the agent creates failure modes: simultaneous events can start competing runs, and a crash can lose an event entirely. The event inbox solves this with a durable list (typically a database table), an HTTP handler that writes events, and a background worker that reads pending events and starts runs. The inbox tracks event status, supports deduplication via source identifiers, and ensures only one active worker processes events at a time. The handler acknowledges quickly to satisfy webhook providers, while deeper verification such as prompt-injection checks happens during the run. Workers batch pending events — merging several user messages into a single run so the agent replies once.

Timers enable proactive follow-ups and recurring schedules

Timers give agents the ability to act without an external trigger. They fall into two categories: follow-ups, which are deadlines the agent sets for itself such as checking for a reply, and schedules, which are recurring tasks on a known cadence such as a daily newsletter. Timers live in a separate durable store from the inbox. A scheduler service polls this store at a fixed interval, finds due timers, updates them (marking follow-ups done, advancing schedules to the next occurrence), and adds an event to the inbox to wake the worker. Teams can build their own scheduler or use a durable execution engine.

Memory preserves continuity across disjointed runs

Because always-on agents operate across many separate runs, they rely on memory to maintain continuity. Memory should have its own store — typically a database or object store — so memories outlive the worker process. The guide recommends storing only what the agent cannot look up elsewhere; pointers to external systems such as issue trackers are preferable to duplicating data. Four memory types are essential: user instructions that load at the start of every run, user notes capturing learned preferences and corrections, past messages to avoid repetition, and task progress files that let a new run pick up where the last one left off. For large note or progress collections, only an index loads initially, with individual files pulled into context on demand. The guide also mentions dreaming — a background process that reviews past sessions to curate memories and find cross-run patterns.

Permissions manage risk in unattended operation

Permissions carry the most risk because a run holds the user's access and operates unattended. Three components address this: a credential store implemented as a proxy outside the agent environment that injects secrets into outgoing requests; auto mode using classifiers to review higher-risk actions and block dangerous ones while allowing safer alternatives; and deferred tool calls that pause a run mid-call, show the request to the user (for example through an interactive card built with MCP Apps), and resume the saved session when the user's answer arrives as an inbox event. While a deferred call waits, the worker can process other events so the agent remains unblocked.

Outbox delivers outcomes without streaming every step

Standard agents stream responses token-by-token so users watch the reasoning unfold. Always-on agents do most work in the background; the user receives the outcome and a few details rather than the full step-by-step breakdown. A run ends by sending a message to the outbox, deciding nothing needs sending, or using a deferred tool call for approval. Most agents need only a simple send tool, but a formal outbox — a separate table of outgoing messages with a dispatcher service analogous to the inbox worker — becomes valuable when pacing messages or recovering from errors. The guide recommends building evals to tune message frequency: start quiet and earn more user attention over time.

Anthropic's guide complements earlier practical advice on maximizing Claude Code sessions and the infrastructure patterns in Claude Managed Agents. Teams building agentic products can also reference the commerce-agents blueprint for a concrete implementation of these primitives.

Sources

claude.com — content not available without authorization

Building always-on agents | Claude by Anthropic

Share

Author

cpaua

VibeCode blog admin. Writing about vibe coding, AI and open source.

Related news

Comments

To leave a comment, log in
Loading...

Weekly digest

The best of vibe coding, AI agents and open source — once a week, no spam.