企业级 AI 工作台:每个应用都是可让 AI 改代码的私有沙箱
Cloudflare OS 是 Cloudflare 内部自用、现已开源的企业级 AI 生产力环境,定位是“公司操作系统”兼“AI 工作负载操作系统”。它不是传统 OS,而是一套把办公套件、应用开发与安全管控统一起来的平台:每个文档或工具都是一个由 AI 生成、独立沙箱运行的“Gadget”应用,用户可随时让内置 agent 修改代码;外部服务访问由“Gatekeeper”按能力安全模型逐项授权并审计,还支持把需要人工确认的操作推迟到之后批量审批。整套系统运行在 Cloudflare Workers / workerd 之上,深度使用 Durable Objects、Dynamic Workers 和 Facets,并默认具备实时多人协同。适合关注 AI 智能体基础设施、边缘计算平台与 AI 编程工具的工程师阅读或二次开发。
Cloudflare OS is an AI agent workspace built on Cloudflare Workers, originally developed for internal use at Cloudflare and now open sourced under Apache-2.0. It is not a traditional operating system; it is an "operating system" for both the company and for AI workloads. The project ships an agent chat UI, sandboxed app development for "gadgets", and a security layer called Gatekeepers, so employees from engineering to sales can safely let AI do real work.
Cloudflare OS 是一个构建在 Cloudflare Workers 之上的 AI 智能体工作台,最初在 Cloudflare 内部使用,现已以 Apache-2.0 协议开源。它并不是传统意义的操作系统,而是同时面向“公司”和“AI 负载”的 OS 形态。项目包含三块核心:agent 聊天 UI、可安全开发“gadget”小应用的沙箱,以及名为 Gatekeepers 的安全框架,让从工程到销售的员工都能安全地让 AI 干活。
The project challenges two assumptions of the last 25 years of cloud software. First, centralized SaaS: if every user runs the same hosted instance, a bug can leak everyone's data, and users cannot change the software to fit their needs. Second, human-in-the-loop approvals: traditional synchronous approval forces an agent to stop and wait, which leads users to bypass safety with auto-approve. Cloudflare OS instead gives each user a private, sandboxed copy of an app, and Gatekeepers turn approval into a simulated, asynchronous review flow.
项目挑战了云计算二十多年来的两个默认设定。一是中心化 SaaS:所有用户共用同一个托管实例,一个漏洞可能泄露所有人的数据,用户也无法按需修改软件。二是人工审批:传统的同步 human-in-the-loop 会让 agent 停下来等确认,用户嫌麻烦就改成自动放行,反而更危险。Cloudflare OS 的做法是让每个用户拥有自己独立的沙箱应用副本,并由 Gatekeeper 把审批变成异步、可模拟执行的复核流程。
In Cloudflare OS, the basic unit is the "gadget". When you ask for a slide deck, the system does not call a cloud SaaS; it spins up a private instance of a slide-deck app just for you, running in a separate sandbox. This has two consequences: a security bug in the app cannot leak your data to others, and you are free to ask an agent to modify the code to add missing features. Gadgets are private by default and can be shared like office documents. A "Blueprint" is a template that contains the code for a whole application, so others can spin up their own copy. The experience is meant to feel like an online office suite, except each file type is potentially a custom app written by AI for your exact need.
Cloudflare OS 的基本单元是“gadget”。你让它做一套幻灯片时,它不会去调某个云端 SaaS,而是为你启动一个私有的幻灯片应用实例,跑在独立沙箱里。这带来两个结果:应用的安全漏洞不会把你的数据泄露给别人;你随时可以让 agent 改代码补齐功能。Gadget 默认私有,也可以像办公文档一样安全分享。Blueprint 则是包含整套应用代码的“模板”,别人可以基于它生成自己的副本。整体体验类似在线办公套件,只不过每一种“文件”都可能是 AI 按你的具体需求写出来的定制应用。
Gatekeepers are service-specific workers that sit between a gadget or agent and an external resource. They expose a clean Cap'n Web API, handle authorization such as OAuth, enforce narrow access to exactly the resource the user intended, and log every action. For side-effectful actions, they implement a notable twist on human-in-the-loop: instead of forcing the agent to stop and wait, the gatekeeper simulates the outcome locally, lets the agent continue queueing actions, and shows the user a batch of pending approvals later. This avoids the "auto-approve everything" trap. Every gatekeeper is implemented as a separate Worker, and each package in this repo (gatekeeper-github, gatekeeper-google, etc.) contains its own setup instructions.
Gatekeeper 是位于 gadget/agent 与外部资源之间的、按服务定制的 Worker。它为外部服务提供干净的 Cap'n Web API,处理 OAuth 之类的授权,只放行用户指定资源的窄权限访问,并记录每一次操作。对于有副作用的动作,它把 human-in-the-loop 做成了一种很不一样的方式:Gatekeeper 先在本地模拟执行结果,让 agent 继续往后排队干活,用户之后再来批量或逐条批准。这样大家就不必为了图省事而“全部自动批准”。每个 Gatekeeper 都是独立的 Worker;仓库里 gatekeeper-github、gatekeeper-google 等每个包都附有各自的配置说明。
Cloudflare OS is built by the team behind Cloudflare Workers, and leans heavily on Durable Objects, Dynamic Workers, and Facets. Every workspace is a Durable Object, every gadget runs in a Dynamic Worker Facet, and Gatekeepers install facets into workspaces to manage remote services. The codebase maps nicely to OS concepts: packages/workshop-backend is the kernel, packages/gatekeeper-* are device drivers, packages/workshop-frontend is the shell, gadgets are processes, and blueprints are executables. Because the whole stack runs on workerd, the open source Workers runtime, it can also run on your own servers rather than only on Cloudflare's network.
Cloudflare OS 由 Workers 的同一个团队打造,重度使用 Durable Objects、Dynamic Workers 和 Facets。每个 workspace 是一个 Durable Object,每个 gadget 跑在 Dynamic Worker Facet 里,Gatekeeper 也会往 workspace 里装 facet 来管理外部服务。代码结构与操作系统概念一一对应:packages/workshop-backend 是内核,packages/gatekeeper-* 是设备驱动,packages/workshop-frontend 是 shell,gadget 是进程,blueprint 是可执行文件。整套系统跑在开源的 Workers 运行时 workerd 上,因此不一定要部署在 Cloudflare 网络里,也可以部署在自己的服务器上。
To try the whole stack locally, install pnpm and run:
pnpm run-local
Then open http://localhost:8787. This runs on wrangler/workerd and is for evaluation, not production. For your own Cloudflare account, use the deploy flow at https://os.cloudflare.app/deploy. During development you can run the frontend and backend separately:
pnpm dev-server
pnpm dev-client
and visit http://localhost:3000. Once running, try prompts such as "Make a collaborative whiteboard app" or "Fix the typos in this Google Doc" (the latter requires the Google Gatekeeper to be configured).
想快速体验完整栈,先安装 pnpm,然后执行:
pnpm run-local
打开 http://localhost:8787。这是用 wrangler/workerd 在本地跑起来,适合试用而非生产。要部署到自己的 Cloudflare 账户,用 https://os.cloudflare.app/deploy 的在线流程。开发时也可以分开跑前端和后端:
pnpm dev-server
pnpm dev-client
然后访问 http://localhost:3000。跑起来之后可以试试这些 prompt:“Make a collaborative whiteboard app”,或“Fix the typos in this Google Doc”(后者需要先配置 Google Gatekeeper)。
Cloudflare OS v2 is a complete rewrite and currently an early-access release (as of August 2026). It is capable but has rough edges. The intended model is that you copy and customize it into "Your Company OS", not that you run an off-the-shelf SaaS. Running locally with pnpm run-local is not the right way to serve production; for self-hosting on workerd, documentation and tooling are still "coming soon". Many gatekeepers require obtaining OAuth credentials from each service, which providers deliberately make awkward. Also, the maintainers are not currently seeking outside code contributions: small trivially-verified fixes may be accepted, but larger PRs will likely be closed.
Cloudflare OS v2 是一次完全重写,目前处于 early access 状态(截至 2026 年 8 月)。它已经相当可用,但还有很多毛边。项目的目标不是让你直接当 SaaS 用,而是复制一份改成“你公司的 OS”。用 pnpm run-local 本地跑只适合体验,不适合生产;用 workerd 自托管的文档和工具还在“coming soon”。不少 Gatekeeper 需要去各个服务商申请 OAuth 凭证,而这些服务商往往故意把流程搞得很麻烦。另外,维护者目前不欢迎外部代码贡献:很小且明显正确的修复可能被接受,大 PR 通常会被关闭。