Stanford's new course goes straight into personal agents; a Grok Bot engineer shares how to build an always-on agent

AuthorThonk Circle
Published2026/10/20
SourceThonk Circle
Read the original

Have you ever thought about how the AI coding assistants we use today actually have a big weak spot: the moment you close your laptop, it stops. It only moves when you send it a message; if you don’t speak, it doesn’t exist. So if there were an agent (intelligent agent) that stayed online like a coworker, did work in the background on its own, and only came to you when something truly important came up, how exactly would that be built?

This is a talk by Lee Robinson in Stanford’s CS146S course. He used to be at Cursor and is now at SpaceX, and he talked about the kind of "always-on, proactive" agent they’re building with Grok Bot. Starting from the simplest harness everyone built last week (the runtime layer that drives the model), he went all the way through server design, context saving, and how models and products push each other forward. I picked out a few of the most valuable threads to me. For each section, I first explain how Lee described it, then add my own thoughts, and share them with everyone.

Why build an always-on agent

Lee first reviewed what everyone built in the first week: a model plus a bunch of tools, repeatedly called in a loop. The idea itself is already very powerful. But he said it has an obvious flaw: the moment you close your computer, the process stops. What he wanted to talk about was how to extend that idea into an always-on agent, meaning an agent running on a cloud server. It can restart, recover after a crash, and has its own computer—a cloud Linux machine with a desktop, files, a browser, and storage, so it can gradually build up knowledge of how you work.

The point he most wanted to emphasize is that this kind of agent is more like a coworker than a chat box that answers every question. A chat box responds immediately to every message you send, but a coworker knows when to stay quiet. Sometimes it’s just quietly doing work in the background, and comes back to you only when there’s something important. It isn’t awakened only by your input, either: a Slack message, an email, or some other event can wake it up to get to work. His expectation is that the working time of this kind of agent can stretch from hours and days to weeks or even months.

He divides the relationship between developers and AI into four stages. The first stage is copying code from ChatGPT and pasting it into the editor, which feels like something from decades ago, though it was only a few years ago. In the second stage, the model can edit files and run commands, working directly in the terminal. In the third stage, programming agents get dedicated apps, and people start running many of them at once, even moving them to the cloud, but humans are still the bottleneck because you have to review every single command. Now we are in the fourth stage: agents have their own computers and their own memory, and can learn new skills while working, so you go to sleep and they keep going.

I think the most important change here is that the person's place in the loop has changed. Before, you prompted once and waited once; when it needed to run a command, you clicked approve or reject. Lee says that now you can directly “guide” it: first say “go take a look at this post,” then immediately say “oh, and do this on Thursday.” Older models would get confused by that kind of interruption, but now they can tell, like a friend listening to you ramble, that the two sentences are related. As for things like sending emails or messages, there is a layer of auto review, which is essentially another AI model checking every command. Lee thinks this is actually safer than a person, because a person has to face hundreds of shell commands and gets fatigued; he even says that in a blind test, most of the time the model does the reviewing better.

He also explained why products like this are called bots and suddenly became popular: because everyone sends text messages. They simplified the way you work with AI to feel like texting a friend, but behind the scenes it can really complete a long task that would otherwise need to be handed off to a coworker. I think this explanation is very plain, and very accurate: the stronger the technology, the simpler the interface becomes, and the less users need to learn, the lower the barrier can actually be.

What changes did the model go through that made this possible

Lee talked about six changes at the model level. First, over the past year or two, models have become increasingly able to keep following instructions over long periods of time without getting confused; combined with compaction, they can safely run for hours or even days. Second, the model can hand tasks off to helpers called sub-agents. Because the model's own working memory, that is, the context window, will eventually fill up, handing expensive work to a helper with a fresh memory, and then having it come back and report, is roughly like getting an infinite context.

Third, tool use has gotten much better. He said that a few years ago models basically could not use tools and were constantly hallucinating; now people hardly talk about hallucinations anymore, because it has basically been solved. Fourth, you can give it very powerful tools the way you would equip a new coworker: shell commands, files, even an entire Linux computer, so it can click around the screen and record demo videos like a person; this is computer use. That means any website or software without an open API or MCP server can also be used by it headlessly.

Fifth, information can all live in files, because models are very good at using Linux commands to search through files. The example he gave was: user profiles are placed in every prompt, such as that you like all-lowercase text messages; work logs are saved as files, like a coworker taking notes every day, and when you ask “what did I do last week,” it just looks through them itself. Sixth, if you show it how to do something once, it can turn that into a reusable skill, memory, or routine. A skill means writing the specific process for doing something into a markdown file, while a routine is like a cron job, running a prompt on a schedule.

He summed this up in one sentence: “Everything is a computer.” I think that sentence is interesting, because it points to the underlying logic of this whole thing: instead of inventing a new mechanism for every capability, put everything into files, commands, and a real computer, because the model is already very good at those. This is very different from our traditional imagination of AI, where AI is a special system; here, it is more like a person who knows how to use a computer.

How does an always-on agent wake up and go to sleep

Lee broke down “always on” and explained that it actually is not always running. The server and the computer the agent can use are usually asleep. When you send a message, or some trigger wakes it up, the system loads all of that agent's state and starts it; only when it needs to use a browser or click around on the screen does it start that computer too; once it is done, both can go back to sleep. The reason is very practical: keeping everyone's computer on all the time is expensive, and there are not that many computers in the world. The state is stored in a database, including conversation history, memories, and routines.

There are many ways to wake it up. You can of course send it a message directly, but what he thinks is more interesting is when something else wakes it up in the background: someone messages you in Slack, there is a call or meeting, or a background task that has been running for hours needs to give you a summary. He also mentioned that in SpaceX, a common situation now is that an employee could go to a meeting, but instead chooses to have their bot attend, take notes, and report back later, which he himself also finds kind of funny.

All of these events first go into a router, where they are deduplicated and then added into the conversation, while a set of heuristic rules determines whether this thing needs to bother the user. Lee's analogy is very direct: if a coworker comes to you every time they make a tiny bit of progress saying “look, I made progress,” you would definitely be annoyed; for most tasks, one status update a day is enough.

The computer, he said, runs a Firecracker virtual machine, which has the advantage that it is very easy to snapshot the entire machine's state, shut it down, and bring it back up. You can connect to it and watch the live screen, and take over manually if needed. It has files, can run commands, has Chrome, and can have a virtual desktop, so you can run five or ten bots at the same time, each with its own screen. I think the key here is that you do not want to run these commands on your own laptop, but in a locked-down environment isolated from you. No matter how the agent messes around there, it will not dirty your computer.

Why agents should run on servers, and what keeps them from falling apart

The core of this architecture is thin client, thick server: the client is thin and the server is thick. Lee gave several reasons: updating the agent's code is much faster with a server-side deployment than pushing an App Store update; heavy computation like transcription and image generation is usually faster on the server; and server-side scaling already has mature practices. But the most important point is that if the agent's loop runs inside the virtual machine, then you cannot independently shut down that virtual machine. For example, if you need to apply an urgent Linux zero-day patch to the VM, you want to be able to rebuild the VM directly, without wiping out the entire agent loop and taking the application down. So everything lives on the server, and the machine can be rebuilt at any time.

He also talked about an infrastructure concept I think is very worth remembering: the difference between a job queue and a durable workflow. You ask the agent to do a complex task, and it goes through step one, step two, step three, but then runs into infrastructure failure in the middle. After a normal queue crashes and restarts, it has to replay steps one, two, and three, and that creates all sorts of problems; a durable workflow, on the other hand, can be safely retried, and after failure it will continue directly from step three. They use an open-source tool, Temporal, and did not build all of that complexity from scratch themselves.

Message priority also matters. When you tell your own bot, “actually change the date of that event,” the system needs to stop the current agent loop immediately; your message has priority over everything else. But messages from group chats, Slack threads, or background routine tasks go to the back of the queue, and if three or four come in within a short time, they can even be merged into one round of processing.

I think this section made me realize that underneath a product that looks like chat, the real engineering focus is actually “not losing state.” What users feel is reliability, and behind that is an entire design for making tasks interruptible and resumable. When an agent has to work for weeks or even months, that kind of reliability is not a nice extra; it is the prerequisite.

What's different about this harness?

This is the most interesting design in the whole talk, in my view. Lee said that the biggest difference between Grok Bot's harness and similar tools on the market is this: between the client and the server, there is only one tool, which is send to user. Heavy tools like running shell commands, reading files, calling cloud agents, recording the screen, and doing presentations all live on the server. The benefit is that the architecture is extremely simple: no matter whether the client is a mobile app, a desktop app, email, or Slack, they all use this one tool to communicate back and forth. And once the client receives something, it can decide how to present it in a richer way, such as popping up a login form, integrating with a password manager, or calling a payment service when payment is needed. For irreversible things like sending email or Slack messages, it first lets you edit and approve a draft; sometimes an emoji reaction is enough, and you do not need to send a message at all.

The second key point is dynamic tool discovery. Lee explained that the model's context window is its working memory, with a token limit. If you stuff in all the tool definitions for connectors like Google Drive, Gmail, and YouTube, including their names and parameter schemas, the window is already more than half used up, and the model has less room left to actually do the work. A lot of mainstream harnesses now only put the tool names in each message; the model decides which one to use, and then reads the detailed info from a file. That saves both context and cost.

The third is a principle he summed up: start with the cheapest, most reliable method, and then climb upward step by step. The first level is what the bot already knows from the conversation history; if it does not know, check whether there is a plugin, an MCP server, or an API you can pull from, like pulling bank information from Plaid; if that does not work, search the web, like the Cubs' score from last night; if that still does not work, open a browser on that computer and search; only then do you use the whole desktop, write scripts on a Linux machine, and build things. Only when all of those methods fail do you bother the user and ask them to input something or approve something.

Reading information on a computer also has levels. A screenshot is the most direct, but a cheaper way is to read the page's HTML, or read the accessibility tree, which can dramatically reduce tokens and help you find buttons and links. Only when you really have to do you click pixels, like when a website pops up a dialog box that must be clicked. When you run into two-factor verification or CAPTCHA, you go back to the user.

I think this whole idea of a "ladder of capabilities" is actually more worth learning than any specific technique: at every step, ask yourself whether there is a cheaper way. It is also the quality of a good colleague: not handing everything up to your manager, but first ruling things out yourself. For an agent to be something people want to use long term, users need to feel, "it rarely bothers me, and when it does come to me, it really needs me."

How to save context

Lee sees context engineering and harness engineering as almost the same thing. The goal of both is to use as little context as possible, so things are more efficient and cheaper. The main agent is the one you have a long-term conversation with, so it needs to stay sparse; the heavy lifting is handed to sub-agents. Let the sub-agents run lots of shell commands and make many expensive tool calls, and none of that will bloat the main agent's conversation; they only bring back a result. That is why the product looks like it has "infinite context," he said. Of course infinite context does not really exist; every model has a limit, but with these techniques, plus specially trained models, users will not feel like they are hitting the limit, and they will not feel like the quality gets worse as the conversation goes on.

Each sub-agent itself is also a durable workflow: if it crashes or runs out of memory, it restarts and keeps going without losing progress. The main agent is like a colleague managing a to-do list; you can check the progress, send messages, or stop a particular helper. He said that to a large extent, this was designed according to the ideal of "how to scale up an engineering team to solve complex problems."

Then he talked about prompt caching. When you use an agent, each time you are actually sending the whole conversation again, with only one new message added, so ideally most of the tokens are cached, and model providers give a big discount on cached tokens. That is why tool definitions and system prompts should stay unchanged across different calls as much as possible, so you do not break the cache. He put it bluntly: "A cache miss is really a bug in the system." He also recalled that when OpenClaw was hot this January, people were using it in subscription plans; that was a new use case the model providers had not seen before, and the harness had not yet been optimized for this kind of always-running workflow, so there were many cache misses, and later they added a lot of fixes.

He shared a few small tricks: hash each segment of the prompt and keep the order fixed, so if you A/B test and add a new prompt segment, you do not disrupt everyone else's prompt order; when the user starts typing in the input box, the server can prepare the prompt and warm up the cache in advance, just like prefetching the next page when the mouse hovers over a link. Another one I really like: when the cache is still warm, take the chance to compress the long conversation. Because the conversation has already exceeded 100,000 tokens, when the user comes back half an hour later, they continue from a much cheaper summary.

As for compression itself, he said that all compression loses information, and how to compress well could be worth several PhD theses. His memory is split into several layers: core facts that must always be included, such as the user's request to use all lowercase; past conversation logs recorded by date; and draft-style notes that only live for half an hour or an hour; everything else is kept in files, so the model can look it up itself when needed. He also said this is actually a bit like the human brain: the things relevant right now stay in your head, and, for example, you would not be thinking about a soccer match at this very moment.

I think the biggest insight from this section is that the "intelligence" of large models is, to a large extent, achieved by managing attention. It is not about making the model remember more; it is about letting it see only what it should see at each moment, while putting the rest somewhere it can be found when needed. This way of thinking is very useful for product builders: do not try to stuff all the information into the model; think about how to make it find it.

How models and products push each other forward

Lee described a loop he called a flywheel. Training a large language model happens in several steps: pre-training gives the model a general understanding of the world from massive amounts of text; supervised fine-tuning teaches it to behave in a certain way, such as becoming a chat assistant or an agent; and finally reinforcement learning, like teaching it to play a game and get better through play. For always-on agents, it is very helpful in the fine-tuning stage for the model to have seen what the harness looks like and know what tools it has; in the reinforcement learning stage, the goal is to train it to follow instructions better, such as choosing the right one from hundreds of skills or clicking the right spot in a browser.

Inference can also be optimized separately. The main agent you are chatting with should have as low latency as possible and reply quickly; for the long tasks handed off to helpers, whether they take ten minutes or twelve minutes does not matter much. The "inner loop" that product teams do every day is this: if the agent makes a mistake, turn it into an eval, fix the harness, fix the prompt, or investigate inference issues, confirm in the eval that it is fixed, and then ship it. Every few months there is an "outer loop": train a new model, let it learn from these failures, climb on the evals, and then put it into the product. New models often bring new leaps in capability.

He mentioned a principle they used at Cursor and now at SpaceX: "delete the product." What that means is you have to assume today's models are the worst they will ever be in their lives, and six months from now you may need to redesign the entire interface. He said today's talk, compared with six months ago or even a year ago, is already a major update, because they have learned a lot of new harness and context engineering practices. So the strategy is to build for the next generation of models: build as little as possible, keep the interface simple enough, and let the model think and act on its own.

I think "delete the product" is the most counterintuitive and most honest sentence in the whole talk. In traditional software, value accumulates in code and features; the more the better. But when models are improving at breakneck speed, the scaffolding you carefully built today may well become a drag tomorrow. What you can keep is your understanding of the problem and your evaluation system; everything else should be ready to be torn down at any time. That is a reminder for anyone who wants to build AI products: do not fall in love with your own implementation.

What changes and challenges will there be over the next six months to a year?

Lee made a few bets about the next six to twelve months that he felt were fairly safe. Agents can now work for a few hours or a day, and he thinks it is very likely that soon this will become weeks or even months, which will create new problems. Models’ memory of past conversations will keep getting better, and the underlying representation could be graphs or files; there are many different approaches in research. In the ideal case, you give your digital colleague all the tools you would give a new employee, though he said organizations are still adapting to that idea. The interface may become simpler, and some people will be willing to talk directly to the bot. Models and products will also get better at learning skills on the job, writing them into files and instructions, and companies will become better at documenting all kinds of customized workflows so agents can understand them.

He also raised several research questions worth taking away. The first is very interesting: if an agent is supposed to run for a month, but the model gets a new version every month, how do you evaluate it? You can’t fully assess whether its behavior matches expectations, so either you build better evaluations or slow down the pace of model releases; he thinks this is a problem the industry must solve in the next six months. The second is memory algorithms. The third is safety: how do you build a safe harness, and how do you keep the infrastructure around agents from being taken over by bad actors? When talking about safety, he said that an email in your inbox may be a phishing email, and a webhook may also come from an unknown source; you can’t just pass them to the model as user instructions. There is still a lot of work for the industry to do here, and prompt injection is only one part of it.

The fourth is the set of heuristics for when an agent should stay silent and when it should interrupt you. He frankly said this is not yet perfect. For example, it notices that you skipped class yesterday, has the recording, and has taken notes, and proactively tells you; that could be very helpful, or it could be annoying. How to walk the tightrope between being proactive and being disruptive is an unsolved problem.

He quoted a remark Alex from OpenRouter made on X: right now every app looks the same, with a sidebar, an agent, and a chat box, but this is like 2005, when everyone was making one server, one database, and one CRUD interface. Every new product needs to have an agent side to it, either by integrating one or by becoming “headless data” for another agent to use. Lee also listed a string of new infrastructure pieces, from sandboxes and cloud computers to memory, payments, identity, and evaluation; there are many startups working on each of these areas.

I think there is a very practical meaning in this passage: an agent is not a single feature, but the infrastructure layer of the next generation of software. Just as servers plus databases became standard equipment for every application back then, every product will have to figure out what role it plays in the world of agents: whether it builds the blocks for agents or becomes data called by agents.

A bit of my own thinking

After listening to this talk, my biggest takeaway is that the truly new thing about always-on agents is not that they are smarter, but that their “mode of existence” has changed. In the past, AI was a tool that only appeared when you spoke up; now, AI is a colleague with its own computer, its own memory, and its own work rhythm. Almost all of the designs Lee described—sleep and wake, heuristics for not interrupting users, trying the cheap approach first and then climbing the ladder—are all built around what a reliable colleague should be like.

The second point is that the whole architecture has a very restrained kind of beauty. Between client and server there is only one tool; everything is files, everything is computers; the main agent stays sparse, and the heavy lifting is handed to helpers. They did not invent a new mechanism for every new capability; instead, they repeatedly reused the same few simple building blocks. This is consistent with what he said about “building for the next generation of models, and building as little as possible”: the stronger the model becomes, the more the scaffolding should step back.

The third point is trust. Lee spoke very plainly in the safety section: to get people to hand over long stretches of work to a bot, the prerequisite is being able to trust it. That is why there are separate machines, automatic review for every command, asking the user in advance for irreversible actions, and things like passwords kept outside the model conversation. Maybe whether an agent can really be used comes down, in the end, not to how much it can do, but to whether you dare to go to sleep and leave things to it.

It can work for weeks, on the condition that you dare to let go; and you dare to let go because it knows when to ask you.