← All writing
AI Engineering / FIELD NOTES

Always-on AI agents need to know when to sleep

What makes an AI agent useful between conversations: durable events, follow-ups, selective memory, clear permissions, and fewer interruptions.

There’s a familiar limitation with chat-based AI: you have to remember to start the conversation. You ask it to check a build, look for a reply, or read a new document, and then tomorrow you have to remember to ask again. An always-on agent promises to take over some of that remembering. You give it an ongoing responsibility, and it comes back when something needs your attention. I find that much more interesting than another chat box, especially for the small things that sit between actual tasks and keep taking space in your head.

Although, a model generating tokens all night sounds like an expensive way to wait for an email.

A Reddit discussion about a local agent setup led me to William Hu’s Building always-on agents at Anthropic. The guide describes five surrounding components: an event inbox, timers, memory, permissions, and an outbox. The model works in separate runs, with saved state connecting them. That helped clarify the idea for me: the responsibility continues between runs, even while the agent is asleep.

What would I give one to do?

Imagine asking an agent to watch a pull request until it’s ready for review. It checks the current state, sees that CI is running, saves what it’s waiting for, and stops. A completion event wakes it later. If a check failed, it can inspect the logs and prepare a useful explanation; if everything passed, it can collect the changes and draft a review brief. Meanwhile, you’ve closed the chat and moved on to something else.

This is a hypothetical workflow, but the underlying pattern is already documented. Cloudflare’s long-running agent guide describes starting external work, persisting its identifier, hibernating, and resuming when a callback or scheduled check brings the result back.

Which responsibility is worth handing over is a product question I’d spend some time on. Watching one PR has a clear scope and an end. “Keep an eye on my whole business” leaves quite a lot for the agent to interpret, and I’d struggle to tell whether it was doing a good job. So I’d start smaller.

The engineering underneath feels familiar: events arrive, workers fail, credentials expire, and the same message sometimes gets delivered twice. For the PR example, I’d want an event saved before a worker starts processing it, along with a record of whether it’s pending, being handled, or finished. If the process crashes, another run should be able to discover the unfinished work. Adding a model gives us more flexibility inside this workflow, but we still have to make it reliable.

Then there’s the awkward case: the agent creates a review comment, crashes before recording success, and retries. Does it create the comment again? I’d design the write operation around a stable action identifier and check the external result before repeating it. Retrying a model run and safely retrying its effects are separate engineering problems.

Timers deserve the same care. A daily review digest and “check this build again in twenty minutes” have different lifecycles. Both need to survive a restart if we expect the responsibility to survive it. And before waking the model, I’d compare event IDs, cursors, or normalized status fields in code. An unchanged build status doesn’t need another interpretation.

There’s still a service running somewhere to receive events or check the clock, of course. Sleeping between model calls saves inference work; it doesn’t remove the infrastructure around it.

Memory should help the next run

“Give it memory” sounds straightforward until you ask what exactly should be remembered. In the PR workflow, “CI is still running for this commit” belongs to the current task, whereas “send routine updates in the morning” is a preference that should carry across tasks. Those have different uses, and I’d want to store them separately.

LangGraph makes a related distinction in its persistence documentation: checkpointers save state within a thread, while stores hold application-defined information across threads. Its in-memory checkpointers also lose their contents when the process restarts. A feature called memory still needs an appropriate storage backend.

There’s another kind of memory I’d care about just as much: what the agent already told me. Without it, each new run can discover the same failing build with fresh enthusiasm. Quite impressive persistence, until you mute it. For duplicate notifications, I’d use structured identifiers and delivery records as the backstop. A model can help judge whether a change is meaningful, but checking whether we already sent an alert for the same repository, commit, and check is a job I’d keep in code.

As for the build itself, I’d save a link and fetch its current state when needed. Yesterday’s summary is useful context. It shouldn’t silently become today’s source of truth.

Permission needs to survive the wait too

I’m comfortable with a background agent reading CI logs within a scope I’ve chosen. Posting a comment, merging a PR, or contacting someone involves a different decision. For an initial version, I’d allow inspection and draft preparation automatically, then require approval for the external actions I haven’t already authorized. Those boundaries should be enforced by the tools and credentials available to the agent.

But what exactly am I approving? The repository, commit, and comment all matter. If the draft changes or the PR moves on while I’m away, I’d want the system to revalidate the action before carrying it out.

Anthropic’s guide describes deferred tool calls: save the session while an action waits for input, end the run, and resume when the user’s answer arrives as another event. That makes waiting a normal part of the workflow.

The local project behind the Reddit post, agy-hq, documents payload hashes for outbound approvals and feedback that returns to the event queue. I like the design idea: rejecting a draft with a correction should give the agent useful work to continue. I haven’t run or security-audited the project, so I’m treating its documentation as an implementation example.

The same principle applies to isolating the environment the agent works in. I’d give it the files and account permissions its responsibility requires, then expand that scope when there’s a concrete reason.

Then there’s the question of how often any of this should reach me. Suppose the agent checks a PR five times and nothing needs my input. I’d like to receive zero messages. A successful run can end with an updated record and silence, which changes what we optimize for when building the product. I’d separate urgent interruptions, routine summaries, and an activity log I can inspect when I want to. Connector health needs to be visible too: “nothing changed” and “I haven’t been able to check since yesterday” require different responses from me.

Before trusting it, I’d try a few deliberately annoying situations: deliver the same event twice, restart the worker mid-task, expire a credential, change a draft after approval, and recover after an outage. Those scenarios would tell me more about this product than a smooth demo. Over time, I’d also look at how often I actually needed its interruptions. An agent can be technically correct and still become another source of work.

What does it cost to leave one running?

The Reddit headline includes a very small background quota share. The author’s full write-up reports 22 background runs using about 6.7 million gross tokens, including cached tokens, and about 983,000 fresh input tokens. That’s roughly 306,000 gross tokens and 45,000 fresh input tokens per run.

I’d be careful about applying those numbers elsewhere. They’re self-reported figures from one workspace, rather than an independently reproduced benchmark, and the share of a busy workspace’s total quota doesn’t establish a price for your workload. Gross tokens aren’t interchangeable with fresh input or a monetary bill either. For my own evaluation, I’d track absolute usage by token category, tool charges, hosting, and the time I spend reviewing or correcting the output, then compare that with the useful work completed. A low background percentage wouldn’t answer that question for me.

I’m optimistic about this direction. There are plenty of small responsibilities I’d happily stop carrying around in my head, provided I can see what the agent is doing and trust it to ask at the right moment. The first one I’d build would have a narrow job, a clear end condition, and permission to stay quiet. Then I’d see whether I actually miss checking on it.

What’s the first ongoing responsibility you’d feel comfortable handing over?

Have a different perspective? Let’s compare notes.

Email me ↗