Glean 拾遗
Daily /2026-07-19 / What we’ve learned building cloud agents

What we’ve learned building cloud agents

Source cursor.com Glean’d 2026-07-19 06:01 Read 11 min
AI summary

Cursor shares one year of lessons from building cloud agents. The biggest takeaway: a cloud agent's output quality depends almost entirely on having a full development environment. Unlike local agents that inherit your laptop's environment, cloud agents need it reconstructed from scratch. This led to building VM hibernation/resumption pipelines, checkpoint/restore/fork mechanisms, secret redaction, network policies, and credential management — essentially enterprise IT for agents. For reliability, early work-stealing architecture managed only one 9 of uptime. Migrating to Temporal's durable execution framework pushed past two 9s, handling over 50 million actions per day across 7 million+ unique workflows, with 40%+ of Cursor's own PRs now coming from cloud agents. Critical architectural decision: decoupling agent loop, machine state, and conversation state allows agents to run across different pod types and subagents to outlive parents. Another insight: as models improve, move logic out of the hardcoded harness into tools the agent controls (e.g., GitHub CLI, Playwright). The post also discusses current harness for computer use and future self-healing environments (autoinstall).

Original · 11 min
cursor.com ↗
§ 1

When we first launched cloud agents a year ago, they seemed like a straightforward extension of local agents. Since then, cloud agent capabilities have expanded considerably.

Cloud agents now run on their own dedicated virtual machines, with their own environments, dependencies, and network access. They can work in parallel, run unattended, and take on longer tasks than a local agent sitting on your laptop.

These capabilities introduce challenges around environment setup, reliability, and orchestration that are less pronounced when an agent is running on your laptop.

In this post, we want to share the biggest lessons we’ve learned building cloud agents, and why the work increasingly looks less like porting a local agent to a server and more like building an operating layer around it.

一年前我们刚推出云代理时,它们看起来只是本地代理的简单扩展。但此后,云代理的能力大幅提升。

如今,云代理运行在专属虚拟机上,拥有独立的环境、依赖和网络访问权限。它们可以并行工作、无人值守运行,并能承接比运行在笔记本电脑上的本地代理更长期的任务。

这些能力带来了环境搭建、可靠性和编排方面的挑战——当代理运行在本地时,这些问题并不突出。

本文中,我们想分享构建云代理过程中学到的最重要的经验,并说明为什么这项工作越来越不像将本地代理移植到服务器,而更像是在它周围构建一个操作系统层。

§ 2

Over the last year we’ve learned that the single biggest factor in cloud agent output quality is ensuring it has a full development environment, like a developer has.

This isn’t something you have to think as much about locally, because local agents inherit your working development environment for free, from your laptop. In the cloud, you have to reconstruct all of that from scratch, and it’s surprisingly hard to tell when you haven’t done it perfectly.

Instead of a crash or an error message, often the only indication is a subtle degradation in output quality. You might not notice it at first, or if you do, you might chalk it up to the model.

But over and over again we've traced it back to the same diagnosis: the cloud agent not having the environment it needs to execute or verify its work. A year ago this mattered less because models couldn't make much use of their environment anyway. But as they've gotten smarter, the environment setup has become the determining factor in whether they execute at their full potential.

过去一年里,我们学到的最大教训是:云代理输出质量的首要决定因素,是确保它拥有和开发者一样完整的开发环境。

本地环境你不太需要操心,因为本地代理自动继承了笔记本电脑上你正在使用的开发环境。但在云端,你必须从零重建一切,而且很难判断是否完美还原。

没有崩溃或错误信息,唯一的信号往往是输出质量的细微下降。你可能一开始没注意到,或者即便注意到了,也可能认为是模型的问题。

但我们反复追溯,最终都指向同一个诊断:云代理缺少执行或验证工作所需的环境。一年前这还不是大问题,因为模型不太会用环境。但随着模型越来越聪明,环境设置成了它们能否发挥全部潜力的决定性因素。

§ 3

Cloud agents architecture

Cloud agents architecture

Today, getting to "full environment" requires rebuilding a surprising amount of infrastructure:

Better user tools for building the agent environment

Methods to efficiently hibernate and resume agent VMs between messages

Pipelines to quickly and durably checkpoint, restore, and fork VM images

Tight harness and client integrations so that agents and humans alike can interpret and interact with the environment

And as cloud agents take on more work they need controlled network access to create PRs, pull dependencies, and do research. Over time, we’ve ended up building what is essentially enterprise IT for agents, complete with secret redaction, network policies, and credential management.

Cloud agents architecture

Cloud agents architecture

如今,要实现“完整环境”,需要重建数量惊人的基础设施:

更好的用户工具来构建代理环境

在消息之间高效休眠和恢复代理虚拟机的方法

快速、持久地检查点、恢复和分支虚拟机镜像的管道

紧密的 harness 和客户端集成,使代理和人类都能解释和交互环境

随着云代理承担更多工作,它们需要受控的网络访问来创建 PR、拉取依赖和进行研究。久而久之,我们最终构建了本质上相当于代理的企业 IT 系统,包含机密编辑、网络策略和凭据管理。

§ 4

Cloud agents present a different kind of reliability challenge than local agents. Instead of competing for local resources on your laptop, cloud agents run in their own isolated VMs. This makes it easier for developers to run many agents in parallel and delegate long-running tasks that often take hours instead of minutes.

But, running in a VM creates exposure to disruptions like inference provider outages, pods needing to be replaced, and EC2 nodes going down.

We started building cloud agents with a work-stealing architecture, where worker nodes could pick up agents and loop them to completion. It transplanted what works locally to a server and it was a fragile setup—our early beta of cloud agents often operated at one 9 of reliability.

Original cloud agent architecture

Original cloud agent architecture

As cloud agents matured, we found ourselves on the verge of rebuilding a lot of the durable execution primitives that Temporal already solves (e.g., retry mechanisms, scheduling work across machines, durability across node failures), so instead we migrated there.

Current cloud agent architecture on Temporal

Current cloud agent architecture on Temporal

Our current agent loop on Temporal can survive blips in inference reliability, pod hibernation and resumption, and runs that stretch across days or even weeks. That migration alone took us past two 9s of reliability and today, Temporal handles more than 50 million actions per day across more than 7 million unique workflows. Internally, more than 40% of our PRs come from cloud agents, and growing.

Percentage of PRs merged to the Cursor monorepo from cloud agents over time

Percentage of PRs merged to the Cursor monorepo from cloud agents over time

云代理带来了与本地代理不同的可靠性挑战。它们不争夺笔记本电脑上的本地资源,而是运行在隔离的虚拟机中。这让开发者更容易并行运行多个代理,并委托通常需要数小时而不是数分钟的长时间运行任务。

但是,运行在虚拟机中会暴露于推理提供商中断、Pod 需要替换、EC2 节点宕机等风险。

我们最初采用工作窃取架构构建云代理,工作节点可以拾取代理并循环执行直到完成。这基本是把本地可行方案移植到服务器,非常脆弱——早期 beta 版本的云代理可靠性通常只有一个 9。

Original cloud agent architecture

Original cloud agent architecture

随着云代理逐渐成熟,我们发现快要把 Temporal 已经解决的持久执行原语(例如重试机制、跨机器调度工作、节点故障持久性)重造一遍,于是我们迁移到了 Temporal。

Current cloud agent architecture on Temporal

Current cloud agent architecture on Temporal

我们目前在 Temporal 上的代理循环能够应对推理可靠性的短暂波动、Pod 休眠与恢复,以及跨越数天甚至数周的运行。仅这一次迁移就让我们的可靠性超过了两个 9。如今,Temporal 每天处理超过 5000 万次操作,涉及超过 700 万个独特工作流。在内部,超过 40% 的 PR 来自云代理,而且比例还在增长。

Percentage of PRs merged to the Cursor monorepo from cloud agents over time

Percentage of PRs merged to the Cursor monorepo from cloud agents over time

§ 5

Over time, we've learned how to better architect our Temporal workflows. We've moved from "eternal" agent workflows to multiple shorter ones that exit after completing a single task, which makes version upgrades easier. We’ve also split out activities to better capture timeouts and retries as async tool calls, subagents, and inference provider outages have changed our underlying assumptions.

Temporal actions per day across cloud agent workflows

Temporal actions per day across cloud agent workflows

随着时间的推移,我们学会了如何更好地设计 Temporal 工作流架构。我们从“永久性”代理工作流转向多个较短的工作流,每个在完成单个任务后退出,这使版本升级变得更简单。我们还拆分了活动,以更好地捕获超时和重试,因为异步工具调用、子代理和推理提供商中断改变我们的底层假设。

Temporal actions per day across cloud agent workflows

Temporal actions per day across cloud agent workflows

§ 6

A cloud agent is no longer just one loop running on one machine. Instead, an agent might run on one machine, spawn async subagents across several, or start locally then delegate work to the cloud. A subagent might even outlive its parent, or run on a completely different kind of pod.

Cloud agent loop with decoupled agent, machine, and conversation state

Cloud agent loop with decoupled agent, machine, and conversation state

To make that work, we've found it valuable to keep the agent loop, the machine state, and the conversation state as decoupled components. Because the agent loop lives in Temporal rather than on the VM itself, we can manage pod lifecycles independently and run agents across different kinds of pods — including optimizations like readonly VMs or prewarmed VMs.

On the conversation side, we separated the storage and streaming layer from the core agent workflow. We built an efficient append-only storage mechanism that streams conversation updates out to web and desktop clients. This layer accounts for retries, so that if a step of the agent loop fails after streaming partial output and then gets retried, the client can detect this, rewind its stream, and show the new data instead of the old.

云代理不再只是单台机器上的一个循环。相反,一个代理可能在一台机器上运行,衍生出多个异步子代理散布在不同机器上,或者从本地启动然后将工作委托给云端。子代理甚至可能比父代理存活更久,或者运行在完全不同的 Pod 上。

Cloud agent loop with decoupled agent, machine, and conversation state

Cloud agent loop with decoupled agent, machine, and conversation state

为了实现这一点,我们发现将代理循环、机器状态和会话状态保持为解耦组件很有价值。由于代理循环存在于 Temporal 而非 VM 本身,我们可以独立管理 Pod 生命周期,并在不同类型的 Pod 上运行代理——包括只读 VM 或预热 VM 等优化。

在会话方面,我们将存储和流式传输层与核心代理工作流分离。我们构建了一个高效的追加式存储机制,它会将会话更新流式传输到 Web 和桌面客户端。这一层处理了重试,因此如果代理循环的某个步骤在流式传输部分输出后失败并重试,客户端可以检测到这一点,回滚流,并显示新数据而不是旧数据。

§ 7

Cloud agent conversation flow

Cloud agent conversation flow

Building a cloud agent harness means constantly reevaluating how much behavior is deterministic and how much gets handed to the agent.

Early on, we didn't trust the agent very much, so the harness would double-check its work after every task, force a commit, and push. As models got smarter, we started moving logic out of the harness and into tools the agent controls. A year ago, multi-repo setups required hardcoded harness behavior. Now, we can give the agent the repo layout, expose tools for branches and PRs, and let it decide how to do the work.

The same thing happened with CI Autofix, where earlier versions of our cloud agent harness contained logic for grabbing job failure logs and writing them to the VM. Now, we just give the agent access to the GitHub CLI and automatically write large outputs to files it can search through. The notification to the agent got much simpler, and we expect that trend to continue.

The harness isn’t going away so much as what it contains is changing. Computer use is a good example right now. Our cloud agent harness has a dedicated subagent type for computer use, with its own model routing, custom prompting, and screen recording. The VNC and Chrome belong to the environment, which is shared between the parent agent and the subagent. This lets the parent make use of them directly, for example, by running a Playwright script. We use this scaffolding because models aren't quite ready to handle computer use on their own, but the agent still controls when to invoke it.

Cloud agents also need different kinds of prompts in the harness than local agents do. We encourage them to be more autonomous, because the cost of blocking is much higher. Locally, you know when an agent has stopped and is waiting for permission, but in the cloud, it could sit there for hours before you go back and check on it.

Cloud agent conversation flow

Cloud agent conversation flow

构建云代理的 harness 意味着不断重新评估多少行为是确定性的,多少行为交给代理处理。

早期,我们不太信任代理,所以 harness 会在每个任务后双重检查其工作,强制提交并推送。随着模型越来越智能,我们开始将逻辑从 harness 移出,交给代理控制的工具。一年前,多仓库设置需要硬编码 harness 行为。现在,我们可以给代理提供仓库布局,暴露分支和 PR 相关工具,让它自己决定如何工作。

CI Autofix 也经历了同样的过程,早期版本的云代理 harness 包含抓取作业失败日志并写入 VM 的逻辑。现在,我们只给代理提供 GitHub CLI 访问权限,并自动将大输出写入它可搜索的文件。给代理的通知变得简单得多,我们预计这一趋势会持续。

Harness 并不会消失,只是其包含的内容在变化。计算机操作(computer use)就是一个很好的例子。我们的云代理 harness 有一个专门的子代理类型用于计算机操作,具有自己的模型路由、自定义提示和屏幕录制。VNC 和 Chrome 属于环境,由父代理和子代理共享。这让父代理可以直接使用它们,例如通过运行 Playwright 脚本。我们使用这种脚手架是因为模型尚未完全准备好独立处理计算机操作,但代理仍然控制何时调用它。

云代理在 harness 中需要的提示也与本地代理不同。我们鼓励它们更加自主,因为阻塞的成本更高。在本地,你知道代理何时停止并等待许可;但在云端,它可能在那干等几个小时你才会回去检查。

§ 8

Looking forward, we're focused on moving past the binary choice between holding the agent’s hand and getting out of its way. A better pattern is to give the agent tools for understanding the system around it.

We want cloud agents to be able to report when secrets are missing, network access is blocked, or when their environment is otherwise preventing them from making progress, and to then be able to act in a self-healing way. In a recent research blog we talked about one path for achieving this which we call “autoinstall.”

Cloud agents have improved immensely in just the last few months, and we expect the rate of change to only accelerate from here. Cursor cloud agents let teams take advantage of this expansive surface without building or maintaining the infrastructure underneath it.

展望未来,我们专注于超越在“手把手指导”和“完全放手”之间的二元选择。更好的模式是给代理提供理解周围系统的工具。

我们希望云代理能够报告密钥丢失、网络访问被阻止或环境阻碍进展的情况,然后以自我修复的方式行动。在最近的一篇研究博客中,我们讨论了一种实现路径,称之为“autoinstall”。

云代理在过去几个月里取得了巨大进步,我们预计变化速度只会从这里加速。Cursor 云代理让团队能够利用这一广阔领域,而无需构建或维护底层的 infrastructure。

Open source ↗