Lee uses Grok Bot to explain what it takes for an AI agent to become a digital coworker that keeps working in the cloud beyond responding to requests. The foundation is a simple loop in which a model calls tools repeatedly. The loop is paired with durable workflows, an independent computer, memory, security, context management, and evaluation. Lee expects agents to work for longer stretches while emphasizing that safety, long-horizon evaluation, and knowing when to intervene are still open problems.
1. From a Terminal Tool to a Digital Coworker
Lee asks students to recall the simple agent they built in their first week. At its center was a loop in which the model repeatedly called tools. This simple structure lets a model work with files, run commands, and do much else. Close the laptop and the work stops.
An always-on agent extends that structure to a server or the cloud. Work can continue when the user's computer is off, and state can be recovered after an outage. The agent also gets a cloud Linux computer with a desktop, files, and a browser. Through files it creates and memories it accumulates, it can learn how the user works over time.
This makes it more like a coworker than a chatbot that responds immediately to every message. It can work in the background and alert the user only when something important changes.
"It doesn't always message you straight away. It knows when to be quiet."
Direct user input is only one way to wake an agent. A Slack message, email, meeting, scheduled job, or other event can start work. Lee hopes agents will work for weeks or months rather than hours or days. That will take a different infrastructure and way of executing tasks.
2. Four Eras of Developers Working with AI
Lee divides developers' work with AI into four eras.
- Copying and pasting code. Get code from ChatGPT and transfer it into an editor.
- Terminal agents. The model becomes more active once it can edit files and run system commands.
- Dedicated apps and parallel agents. Run several coding agents at once, sometimes in the cloud. People still become the bottleneck when they review each command.
- Always-on agents. Give agents a computer and memory of their own. They learn skills and work in the background while the user sleeps or does something else.
Previously, users issued a command, waited, and then issued another one or approved execution. They can now change direction naturally while a task is underway. For example, a person can ask an agent to check something and immediately follow up with "Actually, do that on Thursday." The model and execution tools can combine the two instructions.
For safety, automatic review can have a separate AI inspect commands. Lee argues this can be safer than having a tired person approve hundreds of commands one at a time. In Lee's experience, AI reviewers often did better in blind tests.
"As the models got better, the interface actually became much simpler."
That's also why Lee calls the product a bot. Users message it as they would a friend. Beyond answering a question, it actually carries out extended work the way a coworker would.
3. What Made These Agents Possible
Lee points to several improvements in models and their environments.
Models can follow instructions for longer. With appropriate context compression and scaling, they can work for hours or days. They can also delegate to subagents. Each one uses separate working memory and returns only key results to the parent agent when a complex task is done.
Tool use improved too. An agent can use a whole computer, including a browser and desktop, in addition to shell commands and files. Lee sees major progress in tool calling and hallucinations, without claiming that errors have disappeared.
Computer use gives agents a way to work with websites that don't expose a programmatic connection such as an API or MCP server. The agent uses the browser and clicks on what it sees, as a person would.
Agents also save and search information in files and turn ways of working into reusable skills, memories, and routines. The user can show a bot how to do something once, and the bot can put it into a procedure to follow later.
4. How Files Become Memory and Skills
An agent can learn about a user through a relatively simple file structure. If someone wants all their messages written in lowercase, for example, store that preference in their profile and include it in each prompt.
Records accumulate in files as the agent works. If asked "What did I do last week?" the agent searches the relevant files. Models are good at Linux commands and shell search, so they don't need all the information in memory at once.
A skill is a Markdown file that says how to do a particular task and what matters for success. It might explain how to write a good email or create an API. An ecosystem of companies and developers is creating and sharing skills. In Grok Bot, users can install plugins to connect skills or servers.
A routine runs a prompt on a schedule, much like a cron job.
"You turn the user's knowledge into a way to perform a particular task and write it to a file."
Profiles, work records, skills, and routines do different things. All rely on the agent's ability to read and search files as needed.
5. How Agents Sleep and Wake Up
Always-on agents don't need every resource running all the time. The agent server and computer can sit idle until a message or event restores saved state and starts work. The computer can wake when a browser or graphical action is needed and sleep again afterward.
This saves money and resources. Running a computer continuously for each user would be expensive and resource-intensive. Conversations, memories, routines, and other state can be stored in a database and restored when needed.
A Slack message, a call or meeting, or completion of a long background task can wake the agent. Lee says that at SpaceX it is increasingly common for a bot to attend a meeting in an employee's place, take notes, and report back.
When an event arrives, a router deduplicates it and decides how to put it into the conversation. The agent then judges whether the event is important enough to notify the user.
"If a coworker came over and said 'Look at this' every time they made a little progress, it would be very annoying."
The agent should take initiative while avoiding interruptions for every update. Some work may call for a status update once a day.
6. Why the Cloud Computer and the Server Are Separate
The agent's Linux computer is a Firecracker virtual machine. Snapshots make it easy to save state, shut it down, and restart it. It has files and Chrome, and users can view the screen live or take control.
Running system commands in a separate environment reduces the burden of running them on the user's device. If several bots need browsers, they can use virtual desktops or separate displays. These computers are part of shared infrastructure the bots call on.
A simplified overview looks like this.
- Input. Messages and events arrive from apps, Slack, email, and other sources.
- Server. Queues requests and runs the agent loop that repeatedly calls tools.
- Computer. Supplies files, commands, a browser, and a desktop when needed.
- Storage. Saves task and conversation state so it can be restored.
Lee sees keeping the agent loop on the server and separating it from the computer as important. Server code can ship quickly without an app store update. Heavy work such as audio transcription and image generation can run on the server, using established techniques for scaling it.
Most importantly, the virtual machine can be stopped or rebuilt independently of the agent loop. A critical Linux security update, for example, could be applied by rebuilding the VM without stopping the entire agent.
7. Synchronizing Messages and Keeping a Workflow Running
When the user sends a message, the client displays it immediately as though it were received. The server saves the agent's processing state and results in a database. The client subscribes to change notifications and fetches current data when it receives a signal. Deduplication prevents a retransmission from showing the same message several times.
Lee distinguishes an ordinary task queue from a durable workflow. Suppose infrastructure fails in the middle of a multistep job. With a simple queue, a restart might mean repeating earlier steps. A durable workflow saves completed progress and helps resume safely from the failure point.
The team uses the open-source tool Temporal for this. It avoids rebuilding all the machinery of a complex distributed system, though the team still has to operate the tool's infrastructure.
Messages have priorities. If the user directly asks "Change the date of this event," the system can interrupt the current task and handle the request first. Inputs from group chats, Slack threads, or background routines queue behind it. Three or four messages arriving close together can be grouped into one processing cycle.
8. The Grok Bot Harness and Thin Clients
A harness brings together tools, execution rules, and connections so a model can do real work. Grok Bot adds capabilities to the basic model-and-tool loop while keeping a thin client and a powerful server.
Lee highlights that the server uses just one tool to communicate with the client, "send to user." Heavier functions such as running commands, reading files, calling cloud agents, recording the screen, and generating demonstrations stay on the server.
The same protocol works across mobile and desktop apps, email, and Slack. Each client can present what it receives in the form most useful to the user.
A login can show a form or a 1Password connection. A payment can use a service such as Stripe Link or X Money. For hard-to-reverse actions like sending Slack messages or email, the client can show a draft and request approval. If a reply isn't needed, the agent can leave an emoji reaction instead.
9. Load Tools Only When Needed
The model's context window is the working memory it can refer to at once. Sending the names, formats, and descriptions of every connected tool leaves less room for conversation and work. Connecting more services and MCP servers, such as Google Drive, Gmail, and YouTube, makes the problem worse.
Dynamic tool discovery helps. Give the model only tool names at first. When it chooses the one it needs, it reads the details from a file. This reduces context usage and cost.
When looking up information or getting something done, Lee also recommends starting with cheaper or more reliable methods and escalating only when necessary.
- Check whether the conversation already contains the answer.
- See if a plugin, MCP server, or API can supply it.
- Search the web if needed.
- If that is insufficient, open a browser on the computer.
- For more complex cases, use the whole desktop to run commands or scripts.
- If those methods don't resolve it, ask the user for information or approval.
"A good coworker wouldn't interrupt you every time something like this happens. They'd try a few things first."
Even in the browser, begin with a lighter method. In addition to screenshots, the page's HTML or accessibility tree can reveal buttons and links with relatively few tokens. Direct pixel clicks are available if that isn't enough. When two-factor authentication or a CAPTCHA appears, the user may ultimately need to help.
10. Subagents and Lessons from Building the System
The main agent coordinates the work. It talks to the user, manages the to-do list, and hands work off to specialized subagents when needed.
A subagent can run many shell commands or call expensive tools without filling up the main agent's conversation with intermediate activity. Only the result the main agent needs comes back.
"Context isn't really infinite. But with methods like these, you can make the limits of the context window less apparent."
Subagents can also run as independent durable workflows. If a video agent crashes or stops after using too much memory, for example, it can resume without losing progress. The main agent can inspect status, send a message, or stop a subagent. Lee compares this to managing engineers working together on a difficult problem.
The team learned several practical lessons.
- Keep tool definitions small and stable. Long descriptions and schemas use context and increase cost. Adding or removing tools frequently during a conversation also hurts caching.
- Use specialized tools when warranted. A shell command can express a lot. If a model spends 90% of its time issuing commands of a particular kind, a dedicated tool can be clearer.
- Make error messages helpful to agents. Explain what failed and what to try next so the agent can recover.
11. Safeguards for Autonomy
Delegating long-running work requires trust that both information and execution are safe. Even when work runs on a separate computer, Lee recommends automatic review of system commands by a different model before execution.
Incoming content needs care as well. Email and webhooks can carry untrusted input. Following instructions in a phishing email as though the user supplied them would be dangerous. Defending well against prompt injection, Lee says, remains unfinished work across the industry.
Confirm hard-to-reverse actions such as sending an email with the user first. Sensitive information such as a password can also go through a separate product flow, keeping it out of the conversation with the model.
Greater autonomy calls for automatic review, isolation, approval, and separate handling of sensitive information together, rather than handing over every permission.
12. Manage Context for Longer Conversations
Long-running agents need context management for quality and cost. Lee calls this context engineering, or an important part of harness engineering.
Start with prompt caching. Agent conversations often append a message and resend the entire history. If the earlier portion is cached, it is usually cheaper to process. Keep repeated material at the beginning, such as the system prompt and tool definitions, as stable as possible across calls.
Even when experimenting with tools or prompts, preserving a stable order can avoid unnecessarily breaking other users' caches. A server can also prepare a prompt and warm the cache when a user opens a chat and starts typing, like preloading the next page when they hover over a link.
Save long outputs to files instead of pushing everything into context, and read them when needed. Hand expensive tasks such as screenshots to subagents. Summarize older material and remove unnecessary parts to control cost and improve retrieval and model performance.
Lee recalls that when coding agent usage increased sharply around January 2026, providers' infrastructure was poorly optimized for the new usage patterns and missed caches frequently. Such cache misses matter especially for an always-on agent and deserve to be treated as system defects.
Balance Compression and Memory
Even a model with a 200,000-token context window eventually needs to summarize an ongoing conversation. Summarization loses some information.
"All compression inevitably loses data. The hard part is deciding how to compress without losing important details."
If a conversation exceeds 100,000 tokens and the user steps away, the agent can compress it proactively while the old conversation is still in the cache. When the user returns after 30 minutes, the conversation can resume from a shorter summary at lower cost.
Memory is layered by importance and lifetime. Core facts, such as persistent user preferences, are needed each time. Past conversations can be stored with dates. Temporary notes may matter for only another 30 minutes or an hour. Other information can be retrieved from files. Keeping important facts and clearing out those that are no longer useful resembles the way people focus on information they need now and recall the rest later.
13. Iterating on Model Training and the Product
A better agent product requires the model and product to improve together. Lee outlines three stages of training a large language model.
- Pretraining. Learn a general understanding of the world from large amounts of text and data.
- Supervised fine-tuning. Learn examples of the desired behavior, such as acting as a conversational assistant or agent.
- Reinforcement learning. Improve behavior based on the outcomes of actions.
For agents, fine-tuning can show the actual harness and examples of tool use. Reinforcement learning can improve instruction following, choosing a skill from hundreds of options, or clicking the right place in a browser.
How the model runs at inference time can also be tuned to a role. Low response latency matters for the main agent the user speaks to. For a long-running subagent, 10 minutes versus 12 may matter less, leaving room for a different optimization.
Product improvement happens in two loops. In the inner loop, turn mistakes into evaluation cases, fix harness bugs, instructions, or inference behavior, then rerun the evaluations. In the outer loop, use accumulated failures and evaluation results to train a new model, put it in the product, and see what improves.
New model capabilities also open up new uses. Having several bots talk to one another in a group chat is a new setting with little training data. Lee mentions events involving Moltbook or Hugging Face and emphasizes training models to behave appropriately in multi-agent environments.
14. Simplify the Product for the Next Model
At Cursor and SpaceX, Lee has emphasized the principle "delete the product." Something that now needs a complicated feature or interface might not need it with the next model generation. Avoid building around today's limits as if they were permanent.
"Today's model is the worst model you'll ever use."
Improved models may require a complete interface redesign in six months. Lee recommends designing with the next generation of models in mind, giving the model as few tools and as simple an interface as possible to think and act on its own.
Lee's outlook for the next six to twelve months includes:
- Agents working for weeks or months, beyond a few hours or a day.
- Better retrieval of past conversations and information, with improved memory representations in files, graphs, and other forms.
- Companies giving digital coworkers more of the tools a human employee would need.
- Easier interfaces and more conversations that continue by voice throughout the day.
- Models learning skills as they work and capturing them as files and instructions.
- Companies and people documenting procedures more clearly so agents can understand and use them.
These are Lee's predictions. The work is still ahead.
15. Open Research and Building Blocks for New Products
Evaluating long-running agents is one of the hardest problems. If an agent works for a month and a new model comes out each month, the model could change before an evaluation finishes. The field needs faster and better evaluations or a different approach to how they relate to release cadence.
Other research areas include memory algorithms, safe execution environments, and infrastructure that keeps attackers from taking control of agents. Knowing when to stay quiet and when to speak up also remains unresolved. Finding a recording of a class the user missed and making notes could be helpful to one person and intrusive to another.
"You need to find the right balance between an agent being proactive and bothering the user."
As usage grows, token efficiency matters more. Lee expects optimization of models, inference, and the harness so the same work takes fewer resources.
Lee compares today's similar-looking AI apps, with their sidebars, agents, and chat boxes, to the early web. Many products then shared servers, databases, and interfaces for creating, reading, updating, and deleting data. Many products may gain agent features in the future or become data sources used by other agents.
Durable workflows, isolation, cloud computers, memory and skills, external service connections, voice, payments, identity, evaluation, and monitoring are all building blocks for a new generation of products. Companies and investment are gathering around each area, and the work of integrating them into real systems remains.
16. Three Pieces of Advice for Developers
First, Lee tells students to think about the broader system and its architecture beyond a single line of code. Agents may generate much of the code, but design decisions accumulate into big effects. Lee still reads and reviews code and finds that especially helpful in understanding the structure of what actually gets deployed.
Second, build your own harness or bot using ideas from the lecture. Study similar public projects and connect a user interface, sandbox, and virtual machine to learn how the pieces work.
Third, you don't have to become a machine learning researcher, but develop an intuition for how language models work and how they're trained. Just as web developers benefit from understanding databases, builders of agent products make better product and execution decisions when they understand the model.
"If you have a feel for how models work, you'll be at a much greater advantage in whatever role you take."
