How do always-on AI agents work?

Lee Robinson gave a 45-minute lecture on always-on agents at Stanford CS146S. These are his ten points, in order. After each point I add my take as a fractional AI CTO, and at the end what I tell clients to build first.

How Do Always-On AI Agents Work? A Fractional AI CTO's Take

Image: METAHEURISTIC

Alexander Myasoedov

+Alexander Myasoedov Alexander writes about the operational side of shipping production AI - agents, retrieval, evals, and the guardrails that keep them from going sideways.

How do always-on AI agents work? An event wakes the agent. The agent loads its state, does the work, saves its progress and goes back to sleep. Three parts do this. Triggers start the agent. An agent server keeps the reasoning loop, the task queue and the memory. A cloud computer gives the agent a browser, a shell and files. Lee Robinson of the SpaceX AI team explained this design in a 45-minute lecture for Stanford CS146S. He is an engineer on Grok Bot. The timestamps come from notes by Peter Piekarczyk. I add my opinion after each point.

How do always-on AI agents work? The short answer

Wake
Triggers
An email, a Slack message, a schedule or an event starts the agent. Between triggers it sleeps.
Think
Agent server
The reasoning loop, the task queue, the memory and the orchestration stay here. They survive a restart.
Act
Cloud computer
A Linux VM with a browser, a shell, files and applications. You can replace it at any time.

The lecture has one central thesis. AI changes from a tool that you prompt again and again into a persistent digital employee. This employee remembers, plans, delegates, does the work and tells you about the result. The notes put it in one sentence:

The biggest innovation isn’t necessarily a smarter model. It’s the infrastructure, memory, and agent architecture surrounding the model.

Peter Piekarczyk, notes on the CS146S lecture

I agree with this. I wrote the same thing in October, after OpenAI shipped Dots: the model is swappable and the harness is the moat. The lecture gives the engineering details for that opinion.

What changes when an agent is always on?

The first point is at 0:51. Agents change from reactive to proactive. A usual agent stops when you close your laptop. An always-on agent continues to work without you. It wakes up from emails, Slack messages, schedules or other events. It remembers its previous tasks. It tells you only when something important occurs.

Robinson calls this a change in your job. You stop prompting an assistant. You start to manage a digital colleague. I said the same thing in my Dots post. An agent is a process that runs in the background. For two years, we put that process into a chat window. If you know the agent loop, this is the same loop. The difference is that nobody watches it turn.

Does an always-on agent run all the time?

No. The point at 10:11 is that “always on” does not mean “always running.” The agent sleeps for most of the time, and this saves compute. A trigger wakes it. It restores its previous state, does the work, saves its progress and goes back to sleep.

This cycle makes persistent agents economical at scale. The agent uses compute only when there is work to do.

Figure - A trigger wakes the agent; a checkpoint decides where a crash resumes (toy model)
Crash at step 4:
Recovery:
Press Run. An email wakes the agent, it restores its state, and it works through six steps. At step 4 the cloud computer crashes. With checkpoints the agent resumes at step 4. With a plain queue it starts again at step 1. Watch the steps run counter.

What are the three parts of an always-on agent?

At 13:15 Robinson shows the architecture. It has three components. The diagram below is my version of his conceptual drawing.

1
Triggers
Messages, email, Slack, schedules, events. Each one is a reason to wake the agent.
2
Agent server
The reasoning loop, the task queue, the memory and the orchestration.
3
Cloud computer
A Linux VM, a browser, a shell, files and applications. The agent uses it as a person uses a laptop.

The important design decision is to keep the reasoning loop on the server. The loop is separate from the cloud computer. Thus you can restart or replace the computer, and the agent keeps its task state.

In my post on agent sandboxes and microVMs, I said that the isolation is real, but the VM is not the harness. This architecture agrees. The VM is a tool that the agent uses. The agent does not live in it.

What happens when the agent crashes in the middle of a task?

At 16:17 the lecture says that persistent workflows are more important than simple task queues. An agent can crash halfway through a complex task. Then it must resume from its last checkpoint. It must not do all the work again.

Robinson’s team uses Temporal for workflow persistence and recovery. This is necessary for tasks that continue for days or weeks. A plain queue only knows that a job started and that a job finished. It does not know which steps are done. Use the figure above to see the difference. Set the crash to “on” and compare checkpoints with plain queue.

Persistence first For an agent that works for days or weeks, a restart is a normal event. The agent must resume from its last checkpoint and not do the work again.

This is the boring software engineering that I mentioned in the Dots post. Queues, retries, permissions and tests are the work that we did five years ago. LLM output alone is not reliable enough for an agent system. The workflow engine gives the reliability.

Why use one orchestrator and many subagents?

At 23:30 Robinson describes the agent as an organization. One model does not do all the work. A main agent coordinates the work. Specialized subagents do the individual tasks. Each subagent has a separate context window. Only the relevant results go back to the main agent.

The main agent is a manager. It is not an individual contributor that does every task. In my post on the blackboard pattern, several agents share state on one board and do not need to know about each other. Both designs keep each agent’s context small. The main agent sees only the results.

Where does agent memory live?

At 32:50 the lecture says that memory must live in files. Robinson describes four layers of memory:

Memory typePurpose
Core factsStable preferences and important user details
Daily logsHistorical activities and decisions
ScratchpadTemporary information about current tasks
SkillsReusable instructions for how to do work

These layers can be Markdown files. The agent searches them when it needs them. Thus the agent does not load all of the conversation history again and again.

How do you keep the context small and cheap?

At 27:26 Robinson says that context engineering is a large competitive advantage. More context is not always better. Effective agents do five things. They keep the system prompts and the tool definitions stable, which gives the most prompt cache hits. They load tool details dynamically. They put long outputs in files. They send context-heavy operations to subagents. They compress the conversation before the context becomes too large.

One optimization is very useful. Summarize the conversation while the prompt cache is still warm. Do this even when the user is away. This can decrease inference costs by a large amount.

Figure - Tokens spent before the first instruction, as you add tools
Connected tools: Tokens / tool schema:
Drag Connected tools and watch the MCP bar climb past 100k while the CLI entrypoint stays flat near the floor. MCP loads every schema up front; a CLI advertises an ~80-token entrypoint and discovers the rest on demand via --help. Switch the per-tool weight to see how fast the tax grows.

The figure shows the tool-loading part. When the agent loads all tool schemas at the start, the context fills before the first instruction. When it loads tool details on demand, the context stays small. I wrote about the same problem in how to learn AI agents. The smallest tool set that does the job is the best tool set.

Measure cost per task Measure the cache hit rate, the tokens per task and the cost per completed task. A team that runs millions of agent tasks can improve its margin with these three numbers.

Which method should the agent try first?

At 21:32 the lecture gives an escalation order. The agent uses the cheapest reliable method first. It goes up one step only when the lower step does not work.

1
Context and memory
The answer is already in the context or in a memory file. This has the least overhead.
2
APIs, plugins, MCP
A structured call to a system that has an interface.
3
Web search
Public information that the agent does not have.
4
Browser automation
A web page with no API. The agent clicks and types.
5
Full computer control
A desktop application with no web access. This is slow and expensive.
6
Ask the human
The last method. Human attention costs the most.

The principle is to get the most autonomy for the fewest tokens, the least compute and the least human attention. Sensitive actions still need safeguards and approval.

Figure - The agent climbs from the cheapest method and stops at the first one that works
Task:
Pick a task. The agent tries each method from the bottom and stops at the first rung that works. Each rung up costs more tokens, compute or human attention. The order is from the lecture. The example tasks are mine.

Where does safety go in the architecture?

At 26:30 the lecture says that safety must be a part of the architecture. Robinson lists four controls. The system reviews shell commands automatically. It protects against prompt injection. It runs the agent in an isolated environment. A human approves irreversible actions, for example sending a message.

Autonomy is useful only when you can trust the permissions and the actions of the agent. I agree, and I add one control. Put the checks in the request path and make them fast. In my guardrails post I put the classifiers in front of the model, at the gateway. An agent that runs while you sleep needs the same gate on each tool call. Also, when an agent repeats the same call, stop it with a loop guard. A tool call cycle is the most frequent way for an agent to turn a task into a runaway bill.

Will always-on agents need a user interface?

At 37:45 Robinson says that the best AI product can have almost no interface. Models become more capable, so complex interfaces become less necessary. He tells teams to build for the capability that models will have. Do not engineer too much around the limits of the current models.

He expects three changes in the next 6 to 12 months. Agents will operate for weeks or months. Long-term memory will become better. Conversational interfaces will become simpler. These are forecasts. They are not established results.

I made a similar forecast after Dots. I expect the always-on agent to become a new form of app that lives on your phone next to the other apps, within a few years.

What does this mean for an AI product?

The notes give three conclusions for product and business.

1
The model is a component
Durable execution, integrations, memory, security and context management can give most of the customer value.
2
Context sets unit economics
Caching, selective tool loading and subagents directly change the cost of each task.
3
Workflows over chat
The value comes from delegating an outcome. Research competitors, monitor opportunities, prepare reports.

The third conclusion is the one that I tell CEOs. Do not ask AI to do isolated steps. Give it an outcome and a process to run in the background. Reconcile the invoices. Chase the follow-up. Keep the CRM correct. Nobody needs a new app for this work. They need a process that does it.

What is my take as a fractional AI CTO?

I work with teams as a fractional AI CTO. The lecture describes the system that I see teams try to build, often without a plan. Three parts of it decide whether a client project succeeds.

The first part is the step from prototype to production. In my post on when to hire a fractional AI CTO, the frequent sign is a product that works for a small group of users. It does not scale to the full user base, the data volume, the latency, the cost or the security that production needs. An always-on agent makes this step harder. The agent runs without a user, so nobody sees the failure at the time it occurs. Checkpoints, file memory and cost per task are the parts that make the failure visible.

The second part is the model. A CEO often asks me which model to choose. My answer is the same as in my Dots post. You can make almost any model compatible with the OpenAI API and change it in an afternoon. Your proprietary data, your process knowledge and your integrations are the difficult part. The lecture puts the same value on the infrastructure around the model.

The third part is security. An always-on agent acts while nobody watches. Before a team adds more autonomy, I inspect the pipeline against the frequent gaps for its use case. This is a first pass. It tells the team if it also needs a penetration test of the agent.

What would I build first?

The notes give five priorities for a team that builds an AI product. I agree with all five, in this order, and I add my reason for each.

1
Persistence
Tasks must survive restarts and failures. Without this, the other four do not matter.
2
File memory
Store decisions, knowledge and repeatable skills in files that a person can read and correct.
3
Subagents
Keep coordination separate from execution. The manager keeps a clean context.
4
Context economics
Measure cache hit rate, token use and cost per completed task. Do this from the first week.
5
Guardrails
Let agents act alone on reversible tasks. Send high-risk decisions to a person.
6
The model
Last. You will change it at least once before the product ships.

My order Build the workflow engine, the memory files and the approval gate first. Then choose the model. The model is the easiest part to change.

So, how do always-on AI agents work?

How do always-on AI agents work? A trigger, such as an email, a message or a schedule, wakes the agent. The reasoning loop on the agent server loads the task state and the memory files. Then it does the work through subagents and a replaceable cloud computer. It tries the cheapest method first and asks a person only for irreversible actions. A workflow engine saves a checkpoint after each step, so a crash resumes where it stopped. Then the agent saves its progress and goes back to sleep until the next trigger. If you build one, start with the checkpoints and the memory files. If you want help with the design, talk to me.

Follow in Google

Make Metaheuristic a preferred source.

One tap and posts like this one surface higher in your Top Stories.

Work with us

Production AI, with guardrails.

Start with a fixed-scope AI Workflow Audit. We map the opportunity and quote a build.

Start a Discovery Sprint →