Always-On Agents: Anthropic's Five Primitives, Shown Working
An always-on agent mostly sleeps. Anthropic's five primitives wake it, carry its memory, guard its actions and deliver its work. Costs and limits included.
Published

An always-on agent is not a program that runs all day: it sleeps, wakes when something happens, does one short run, saves what it learned and sleeps again. Anthropic's guide Building always-on agents, published 13 November 2026, names the five primitives behind that cycle: an event inbox, timers, memory, permissions and an outbox. Here is each one in the guide's order, shown working, with what it costs and where it stops as of November 2026.
What an always-on agent is
Anthropic calls always-on agents stateful and proactive: they manage context across sessions and take actions without direct supervision. Underneath, they run the same core loop as other agents. The difference is the architecture around that loop: pieces that decide when the agent wakes up, what carries over between runs, and how its work reaches you.
The name describes the experience, not the machine. In the guide's words, an always-on agent "is not actually 'always on.'" It spends most of its time asleep. Each stretch of work is a run: the agent receives an event, completes its task and saves what happened. A run works inside a session, the transcript of messages and tool calls. Then the agent sleeps again, and the cycle repeats indefinitely.
How it differs from one long session
Why now
The guide gives two reasons. The latest models judge better: they are more reliable at understanding what the user wants and at knowing when to check in. And intelligence is getting cheaper, with long-horizon tasks gaining most. On a subset of the SWE-bench Pro coding benchmark, Claude Opus 5.5 cost 78% less per solved task than Claude Opus 5 at about the same score, against 40% less on typical workloads (Anthropic's cost guide).
Here is the cycle from the user's side. The agent wakes four times; you only see what it decides to tell you.
wake · schedule fired · new session · memory read
Morning brief: one item needs you. The supplier contract is still unsigned, day 3.
Chase them for the signed copy.
wake · your reply · session resumed · email drafted · send deferred for your OK
Approve.
wake · your answer · email sent · follow-up timer set for 14:00
wake · follow-up due · progress/contract.md read
Signed copy received and filed. Nothing else needs you today.
Every line in that scene is one of the five primitives at work. The rest of this page takes them one at a time.
The five primitives, in the guide's order
Each primitive is a small, durable piece that lives outside the model. Three of them are usually database tables. None of them is exotic; the craft is in how they hand work to each other.
1. Event inbox: one door for everything that wakes the agent
Most agents run only when you send a message. An always-on agent can also be woken by webhooks, scheduled tasks and background jobs. The tempting design lets each source call the agent directly. The guide names two ways that fails: two events arriving at the same time start competing runs, and a crash can lose an event entirely.
The answer is an inbox. Every source sends its event there, and a worker picks it up. The simplest version has three parts:
- a durable list of events, usually a database table;
- a handler, usually an HTTP endpoint, that writes events to the list;
- a worker, usually a background service, that reads from it.
The inbox tracks each event's status and drops duplicates using the source's own IDs. Anthropic recommends one inbox per user to start, split further only when you need more parallelism. An event that continues earlier work, such as your reply, resumes the existing session. Anything else starts a new one.
A webhook and your message arrive together: two runs start and compete.
The process crashes mid-run: the event is gone.
You send three messages in a row: three calls to the agent.
Both land as rows. The one worker takes them into a single run.
The worker dies mid-run: a new worker pulls the same event and retries.
The worker batches them into one run, so the agent replies once.
The guide's four rules for the inbox:
- Answer fast. Some sources, such as webhook providers, treat a slow response as a failure. The handler can run light checks; deeper ones, such as checking for prompt injection, belong in the run.
- The inbox is the source of truth. A woken worker pulls the latest events from the inbox first, so a replacement can retry what a dead worker left.
- One active worker per inbox. Two runs would duplicate or overwrite each other's work. When an event lands mid-run, push it to the next run, fold it into this one, or interrupt and restart.
- Batch what is pending. Several messages in a row become one run and one reply.
2. Timers: how the agent becomes proactive
The inbox lets the agent react. Timers let it start things on its own. They come in two kinds:
Timers live in their own durable store, usually another table, kept apart from the inbox: the inbox holds only events ready to be worked on. A timer never starts a run by itself. A scheduler, usually a background service, polls the store at a fixed interval, and on each pass it:
- finds the timers that are due;
- marks a follow-up done, or moves a schedule to its next occurrence;
- adds an event to the inbox and wakes the worker.
You can build the scheduler yourself or use a durable execution engine. If you rent it, Claude Managed Agents has scheduled deployments: a cron expression, an IANA time zone, minute-level granularity, and a new session each time it fires. That page describes recurring schedules; a follow-up the agent sets for itself mid-run is still yours to build.
3. Memory: what carries over between runs
Runs are disjointed, so memory is what holds the agent's continuity. It gets its own store too. Anthropic's products implement memory as a directory of files: Claude Code's auto memory and the Messages API's memory tool. For an always-on agent, that directory should map to durable storage, usually a database or an object store, so memory outlives the worker.
The guide's rule of thumb: memory holds only what the agent can't look up again. If something already lives in another system, such as an issue tracker, save a pointer to it. Four kinds earn a place:
- User instructions. How the agent should behave, in their own file, loaded at the start of every run. You won't always be there to steer.
- User notes. Your role, preferences and corrections. Start with one file; as it grows, split it into small files and load only an index.
- Past messages. What the agent has already told you, so it never repeats itself. Either a file loaded every run, or the worker loads the last few messages.
- Task progress. One file per open task: what is done and what is left. The next run reads it and picks up where the last one stopped.
The guide's example setup, as a directory:
instructions.md loaded at the start of every run
index.md loaded at the start of every run
reported.md loaded at the start of every run
notes/ read when needed
progress/ read when neededOn the Messages API, the memory tool is one entry in your request, {"type": "memory_20250818", "name": "memory"}. It runs client-side: Claude asks for file operations under /memories, and your application performs them against storage you choose. That also makes the safety checks yours: the docs say to restrict every operation to the /memories directory.
You can add dreaming: a pass that reviews past sessions to curate memory, replace outdated entries and find patterns that only show across many runs. In Anthropic's research on agent memory, Claude checked a wrong note against the original session transcript, caught the error and rewrote it.
Inside the context window
Before any work, every run loads the system prompt, the tool definitions and the memory files. That overhead is paid on every run, so the guide says to keep it lean and use prompt caching. A new session starts with only that overhead and the events that triggered the run. A resumed session also brings back its earlier messages and tool calls.
When a session grows too long, compact the older messages or start a new session. Both lose detail, so anything that must last goes into memory along the way. Claude Code keeps its own loaded layer small in the same spirit: auto memory loads only the first 200 lines or 25 KB of MEMORY.md, which works as an index.
4. Permissions: what it may do while you are away
This is where the risk sits. A run holds the user's access and, by design, works unattended. For every tool call, the agent must proceed on its own, block it, or wait for approval. The guide names three components.
A credential store. The recommended pattern is a proxy outside the agent's environment. The agent sends requests without credentials; the proxy adds the real ones and forwards them. Anthropic's secure deployment guide lists what that buys you: the agent never sees the credentials, the proxy can enforce an allowlist of endpoints and log every request, and the credentials live in one place.
Auto mode. Claude Code's auto mode uses classifiers to review higher-risk actions and block the dangerous ones, so Claude looks for a safer approach. The guide still keeps your review for the most important decisions, and Anthropic's write-up of auto mode shows why. On 52 real overeager actions, the full pipeline let 17% through; on 10,000 real internal tool calls, its false-positive rate was 0.4%. A session that collects 3 denials in a row, or 20 in total, is stopped; in a headless claude -p run, the process ends. Anthropic's own words: "It is not a drop-in replacement for careful human review on high-stakes infrastructure."
For a run with nobody to answer, Claude Code's headless docs give this command. The classifier reviews each action, and anything that would have needed a person is denied:
claude -p "Update the dependency pins and run the tests" --permission-mode auto --permission-prompts noneDeferred tool calls. When an action does need a person, a hook can defer the call. The run ends and the session is saved mid-call. The request reaches the user, for example as an interactive card built with MCP Apps, and the answer comes back as an event in the inbox. That event starts a new run, which resumes the saved session with the answer. While the call waits, the worker can take other events, so the agent is never stuck.
claude -p "$TASK" --output-format json --permission-prompt-tool "$HOST_TOOL"
"stop_reason": "tool_deferred",
"session_id": "abc123",
"deferred_tool_use": { "id": "toolu_01abc", "name": "AskUserQuestion", ... }
claude -p --resume abc123 --permission-prompt-tool "$HOST_TOOL"
Between the two runs, the hook returned "defer", so the tool did not run and the pending call stayed in the transcript. Your process read deferred_tool_use and showed the question in its own interface. On resume, the same call fires the hook again; this time it returns "allow" with the answer in updatedInput, and Claude carries on.
Know its edges. Claude Code honors "defer" only in non-interactive -p runs, and only when Claude makes a single tool call in the turn. There is no timeout: the session waits on disk until the retention sweep deletes it, after 30 days by default.
The two commands above are opposite answers to one question. --permission-prompts none says nobody is there, so deny, and it removes tools that need a person, such as AskUserQuestion. A deferred call says somebody will answer later, so wait.
5. Outbox: how the work reaches you
A normal agent streams its work as it goes. An always-on agent works in the background, so you get the outcome and a few details instead. A run ends in one of three ways:
- it sends a message to the outbox;
- it decides nothing needs sending;
- it defers a tool call to ask for permission or more input.
Most always-on agents can get by with a single "send" tool that delivers straight to the user. You need a formal outbox only to pace the agent's messages or to recover from errors. It mirrors the inbox: a table of outgoing messages, and a dispatcher, usually a background service, that reads what is pending, decides what to deliver and sends it. A deferred request can go through the outbox or appear directly in your own interface.
The harder part is volume. An agent that sends too much becomes noise; one that sends too little misses what you needed to know. Anthropic recommends building evals to find the balance, and says it is better for the agent to start quiet and earn more of your attention over time.
Anthropic's reference daily-brief agent shows the delivery discipline. It counts a Slack post as sent only when Slack returns "ok": true and a message timestamp, updates its records only after that, and marks an unclear result "maybe posted", so nothing is lost and nothing goes out twice.
How the pieces fit into one loop
An event arrives
A user message, a webhook or a due timer lands in the inbox.
The worker starts a run
It wakes the agent in a new session, or resumes the existing one when the event continues earlier work.
The agent reads its memory
Its instructions, the index of its notes and what it has already reported give it a baseline.
It acts within its permissions
Safe calls run, dangerous ones are blocked, and the ones that need you are deferred.
It writes back what it learned
Notes and progress files are updated before the run ends.
It pushes a row to the outbox
The dispatcher delivers the message. The run may also set a timer, and your reply comes back as a new event.
As of Nov 19, 2026 · Source: Anthropic, “Building always-on agents”
As the guide puts it: "Each run is brief, but the cycle keeps going indefinitely, and that's what makes the agent feel like it's always on."
Three uses for a business
These come from Anthropic's own pages, as Anthropic reports them. Each leans on a different mix of the primitives.
The brief is the one to copy first. Anthropic published its code and six rules from building it: read each source from a bookmark, not a fixed window; report a failed read as unreadable, never as a quiet day; re-check every item right before posting; count a post as sent only when Slack confirms it; re-read your preferences every run from a store the agent can't edit; and give it read-only access wherever it only reads, with a spending cap per run.
Follow-through is where follow-up timers pay. A person forgets to chase a reply; an agent with a follow-up timer and a progress file does not. Keep anything that goes out to another person behind a deferred call until you trust it.
Watching is where a quiet outbox matters most. The guide's warning applies in full here: an agent that sends too much becomes noise. Let it speak when the numbers move.
A plain test before you build: the work recurs or waits on events, its inputs are reachable without you, and a missed or wrong message costs less than checking by hand. If one of the three fails, a scheduled task or a script is the better tool.
How to start
Three routes, from least to most building.
No code: a scheduled task in Claude
If you want the behavior and not the build, "hand off and schedule tasks" is part of Claude's Pro, Max and Ultra plans on Anthropic's pricing page. Our Claude Cowork guide covers how scheduled tasks work and which inputs they can reach. You get the schedule and the delivery; you do not design the inbox, the memory or the permissions.
Rented: Claude Managed Agents
Anthropic hosts the loop. A scheduled deployment is your timer, memory stores are your memory, vaults are your credential proxy, and a budget caps each run. These are Anthropic's commands from its reference implementation.
Let Claude Code set it up
Update Claude Code, then run Anthropic's onboarding. The claude-api skill reads Anthropic's post, proposes a setup, writes the files to an
agents/folder and creates the resources withant apply.Bashclaude updateText/claude-api managed-agents-onboard https://claude.dev/blog/building-effective-agent-automations/Or apply the files by hand
Create the vault that holds the credentials, add each credential, then create the deployment with its agent, environment and memory stores. Our guide to ant apply explains the lockfile it writes.
Bashant apply vault.yaml ant apply deployment.mdRun it once without waiting for the schedule
Use the deployment ID that
ant applyrecorded inclaude-lock.json.Bashant beta:deployments run --deployment-id <id>Set the budget from real runs
Start the cap at three to five times the cost of a normal run, then tighten it. A run that hits the cap pauses with
budget_reached, so a cap set too low looks like a brief that went quiet.
The reference deployment file shows a schedule and two memory stores side by side: your preferences, which the agent may only read, and its own state.
---
name: Daily brief
agent: ./agent.md
environment_id: ./environment.yaml
schedule:
type: cron
expression: "32 7 * * 1-5"
timezone: America/New_York
vault_ids: [vlt_...]
resources:
- path: ./memory_store_preferences.yaml
access: read_only
instructions: The reader's preferences. Re-read them every run. Never write here.
- path: ./memory_store_state.yaml
access: read_write
instructions: Your state. Bookmarks, ledger, notes, proposals, and run records.
---
Write today's brief.Built: your own loop on the Agent SDK or the Messages API
Build it yourself when the agent is your product. Our Agent SDK guide covers installing it and hosting it. Then add the primitives, each in the smallest version the guide describes:
- An inbox table, a handler and one worker, with one inbox per user.
- A timers table and a scheduler that writes due timers into the inbox.
- A memory directory on durable storage: an instructions file, one notes file, and a progress file per task. The memory tool gives you the file interface.
- A credential proxy outside the agent's environment. Claude Code and the Agent SDK can route through one with
ANTHROPIC_BASE_URLorHTTPS_PROXY. - A send tool. Add a formal outbox and a dispatcher only when you need pacing or recovery.
- Deferred calls for anything that needs your yes.
What it costs and where it stops
What it costs
For a real number per run, Anthropic's daily-brief README reports its own tests: on a busy day, with two channels and two repositories holding around 140 messages and 25 pull requests, a run cost about $1.50 on Claude Opus 5 and about $1.00 on Claude Sonnet 5. A run that found every source unreadable cost $0.15 to $0.30. Those tests predate the move of its default model to Claude Sonnet 5.5, and its deployment caps each run at $5.00.
The cache rule that matters for an agent that sleeps: a cache only saves money if the next run starts before it expires. Anthropic's caching page recommends the 1-hour cache for prompts used less often than every 5 minutes but more often than every hour. An agent that wakes every few hours finds both expired and writes its overhead again, which is one more reason to keep that overhead small.
Where it stops
- Managed schedules are in beta. Scheduled deployments run on cron at minute-level granularity, with jitter of up to 15% of the interval between runs (at least 5 seconds, at most 9 minutes). An organization can have up to 1,000 of them.
- Missed runs stay missed. Unpausing a deployment resumes from the next occurrence; missed triggers are not backfilled. A start refused by a rate limit is recorded as a failed run and tried again only at the next occurrence.
- Data rules. Managed Agents is not eligible for zero data retention, except self-hosted Managed Agents, and not eligible for HIPAA. Session transcripts persist until you delete them.
- A budget is per run, not per month. The deployment copies its cap onto each session it starts.
- Defer has narrow conditions. It works only in
claude -pruns with a single tool call in the turn, and a waiting session is deleted after 30 days by default. - Auto mode misses some things. In Anthropic's own test it let 17% of real overeager actions through. Keep your review for what cannot be undone.
- Compaction forgets. Compacting a session or starting a new one loses detail; only what was written to memory survives.
- The memory tool's storage is yours. It runs client-side, so path checks, size limits and expiry are your code.
What people get wrong about always-on agents
- That "always on" means always running. It mostly sleeps. The value is in what wakes it and what it remembers, not in uptime.
- Wiring every source straight to the agent. It works in a demo and fails on the first two simultaneous events or the first crash. One inbox, one worker.
- Reading "the last 24 hours". A late run leaves a gap and an early one repeats items. Keep a bookmark per source.
- Treating a failed read as a quiet day. When a source is down, the agent sees nothing and can report "nothing new". Have it say what it could not read.
- Baking preferences into the prompt. The prompt keeps applying rules you have already changed. Have the agent re-read them every run from a file it cannot edit.
- Remembering everything. In Anthropic's memory research, Claude Sonnet 3.7 wrote 413 memory files across 225 folders and earned one badge in Pokémon; Claude Fable 5 wrote nine files in two folders, plus one
global.md, and earned four. Store only what cannot be looked up again. - Reading auto mode as review. It is a filter that catches most dangerous actions. The guide still keeps you in the loop for the decisions that matter most.
- Sending more to look useful. Start quiet and earn attention.
What is an always-on agent?
An AI agent that is stateful and proactive: it keeps context across sessions and acts without direct supervision. It wakes on events such as messages, webhooks and timers, does a short run, saves what it learned and sleeps again.
Does an always-on agent run all the time?
No. Anthropic's guide says it "is not actually 'always on.'" It spends most of its time asleep and spends no tokens while it sleeps. The cycle of short runs is what makes it feel always on.
What are the five primitives of an always-on agent?
An event inbox for everything that wakes it, timers for follow-ups and schedules, memory for what carries over, permissions for what it may do unattended, and an outbox for how its work reaches you.
Do I need Claude Managed Agents to build one?
No. You can build every primitive yourself with the Agent SDK or the Messages API and a database. Managed Agents rents you some of them: scheduled deployments, memory stores, vaults and a budget per run. It is in beta.
How much does an always-on agent cost to run?
Model tokens for each run, plus $0.08 per session-hour of active runtime if you use Claude Managed Agents. Asleep, it spends no tokens. Every run pays for its starting context, so a lean, cached prompt is the main lever, and a per-run budget caps the worst case.
Where to go next
The 8 best AI agents in 2026
If you would rather use an agent than build one, start with the shortlist by job, with real pricing.
Claude Agent SDK: a first agent
Install it, run a first triage agent and choose a hosting pattern for your own loop.
Claude Managed Agents config in review
How ant apply and its lockfile put agents, schedules and memory stores through code review.
Building always-on agents
Anthropic's guide to the five primitives and how they fit together.
- Published
- Category
- AI








