Cloudflare OS explained: How it tackles hallucinations, overreach, and errors
- Cloudflare open-sourced its internal AI office platform, Cloudflare OS, where every document is its own isolated app whose code you can modify on the fly.
- The most counterintuitive feature is when an agent asks to merge code, the system replies "done" before you approve, then spins up a fake branch for it to continue working on.
- Jamie Lord read the entire source code and concludes the system's core principle is a total lack of trust in AI.
- After examining all five mechanisms, there's a trade-off: the leash that keeps it safe is the same one that limits how much it can do.
cloudflare/cloudflare-os repository. Performance figures and statements like "AI cannot introduce major security vulnerabilities" are Cloudflare's official claims, and are flagged where they appear.What is Cloudflare OS, and why does it assume AI will fail?
On August 5, Cloudflare open-sourced its internal AI office platform, Cloudflare OS, which has been used company-wide for three months. You can deploy it on your own servers.
What is Cloudflare OS?
Cloudflare employees have been using it internally for three months, creating over 4,000 of these mini-apps in the last 30 days alone. The sales team estimates it has saved them over 10,000 hours.
Jamie Lord, author of Architecting on Cloudflare and a solutions architect at UK-based CDS, has done a deep, source-level analysis of Cloudflare OS. His key insight:
Cloudflare OS is, at its heart, a system built on a total distrust of AI. It treats AI errors—hallucinations, overreach, mistakes—as inevitable facts of life and then works the architecture to make it impossible for AI to break the system.
Try to make AI smarter and less error-prone: write better prompts, give it more permissions.
Acknowledge that AI can confidently spout nonsense and break things. Since 100% correctness is impossible, build the platform as a "canary cage." Let AI think it has unlimited power and work efficiently, but keep real control (the ability to commit) firmly in human hands.
In one sentence: It demonstrates how, in an era where LLMs are still unreliable, you can use capabilities, isolates, and simulations to build a next-gen agent operating system architecture that lets AI automate workflows but can never cause a corporate security disaster.
The core philosophy behind this design can be broken down into these five key mechanisms.
Simulate Success: The System Tells the AI It's Done Before You Approve
This approach is described in the interface documentation for gatekeeper developers:
It is suggested that the gatekeeper "simulate" actions that have not been approved yet, meaning the
Sessioninterface should behave as if all actions have been applied.It is suggested that the gatekeeper "simulate" actions that have not been approved yet, that is, thecloudflare/cloudflare-os · gatekeeper.tsSessioninterface should reflect the state of the resource as if all actions had been applied.
One important detail: simulation is recommended, not mandatory. It's up to each gatekeeper's developer. The real red lines are the other three: every action must go through the approval queue, reads must be authorized, and actions with side effects must never be truly executed before approval. "Simulating success" is just an optional optimization to keep the agent moving.
It's essentially optimistic concurrency applied to real-world actions: assume things will go smoothly, let everyone work ahead, and check for conflicts at commit time. If there's a conflict, the whole batch rolls back. The cost is the same: the agent lives in a fake state for a while, and the things it thinks it accomplished may never actually happen. But that's fine, what it believes doesn't matter. The final write to the system waits for a human.
Sandbox isolation: Every document lives in its own room, so bad code can't spread
tenant_id in a WHERE clause leaks customer B's data to customer A. Security depended entirely on whether the code was written correctly. One bad day for a junior engineer meant a data breach.Kenton Varda, the lead behind Cloudflare OS and creator of Cloudflare Workers, said on launch day: the sandbox is so safe you can tinker freely, and AI cannot introduce major security vulnerabilities. A company's security team can let non-technical colleagues vibe code and still sleep at night.
They didn't try to make AI code more trustworthy. They abandoned that goal entirely. Security no longer depends on writing code correctly. What the agent writes is no longer a security issue.
This "isolate every document" idea comes from Kenton's decade-old startup, Sandstorm, which didn't take off. Two reasons are often cited. First, it was too expensive: containers were the only option, and spinning one up was costly. Second, per Kenton: the world wasn't ready—there wasn't enough skill or patience to adapt software. Both reasons together make sense: it finally became cheap and the skills finally exist.
How much cheaper? Here are the official figures:
An isolate is a lightweight execution environment from the V8 engine (the one that runs Chrome). The analysis article claims containers take "several seconds" to cold-start, which is an order of magnitude off from the official numbers. We've used the official figures.
Withhold keys: The agent never gets secrets, only a few methods
env.PROJECT.listIssues(), but it never sees the token, can't widen its own permissions, and can't reach the network beyond the few methods it has.This "methods, not keys" approach has a formal name: the object-capability model, a concept studied in security circles for decades.
Track Data Lineage: The System Knows What the Agent Read and Checks Permissions Before Sharing
Ultra-safe fallback (lockdown mode): For data too sensitive to be described by existing rules, you can simply flag it as "allow no sharing." Once a gadget reads such data, it immediately enters lockdown mode. It can still read, but it can no longer take any action through any gatekeeper, completely sealing off the leak path. The code comments even admit this is a temporary measure, to be replaced by finer-grained rules later.
Also worth noting: prompt injection is still an unsolved problem in this architecture. The source code's TODO list still has two items: detecting whether free-text content in a read could be a hidden injection, and identifying who has written to these content sources.
Distrust Human Contributors Too: External PRs Over a Few Lines Are Automatically Closed
An unreviewed contribution is untrusted input, whether it came from a careless human or a confident model is almost irrelevant. The system's distrust of AI thus extends to a distrust of human contributors.
The Cost of This Design: The Tighter You Control AI, The Less It Can Do For You
The five mechanisms above are clever. But they share a common cost: the tighter you control AI, the less work it can do for you. This breaks down into two things.
First, an agent that never gets keys can never do the jobs that require keys. It can't renew a service or call an API that no one has explicitly opened for it. The system design just doesn't give it that power. It can only operate within the bounds you've defined. Anything outside that, a human still has to do.
Second, write operations always need human approval, meaning a human is always in the loop. This design certainly means you don't have to watch every step, but that batch of pending actions still needs your review and your click. And the whole point of an agent was to stop needing a human to watch over it. The human is still in the loop, just moved from "present at every step" to "always present for the final step."
To summarize the trade-off: The same leash that keeps it from running amok is the one that stops it from pulling a heavy load. You can't have maximum autonomy and maximum safety at the same time. Cloudflare chose safety, and chose it firmly. Their bet is that a leashed agent you can actually deploy inside your company is more valuable than a free agent you're too scared to use.
One more paradox: It distrusts everyone, except itself
The system's logic is "trust no one": not AI, not user code, not outside programmers.
But there's one exception: Cloudflare itself.
The technologies used for isolation, approval, and tracking (Workers, Durable Objects, etc.) are all Cloudflare's own, some built specifically for this project and available nowhere else. So this "trust no one" system is itself built on the premise that you must trust Cloudflare.
The saving grace is that it's fully open-source, running on the open-source workerd runtime. In theory, you can move it to your own servers, which is more than most similar products. But using it comes with accepting that premise first.
Finally: Even its creators haven't figured out how to define an Agent
In the repo, there's a table mapping Cloudflare OS components to those of a traditional OS: what maps to the kernel, drivers, processes. The first rows all match up. The last one is blank, with three question marks.
| Traditional OS | Cloudflare OS |
|---|---|
| Kernel | workshop-backend |
| Device drivers | Gatekeepers |
| Shell | workshop-frontend |
| Processes | gadgets |
| Executables | blueprints |
| Users | Users |
| Permissions | Share permissions |
| ??? | Agent |
The question marks mean: in a traditional OS, there's no such thing as an "AI agent."
It's not a regular user: user permissions are pre-defined, but an agent answers to a specific person, and its permissions need to be granted and revoked in real-time. It's also not a regular program: program code is written in advance, but an agent writes its own code as it goes.
Cloudflare's answer is that the best way to manage this new thing is via "you can only do the specific things I allow" (the capability model), rather than the traditional "what groups are you in, what permissions do you have" list.
But they didn't fill in that row either. This is a new species, and even its creators haven't figured out how to define it.
Cloudflare's Open-Source AI Office Platform: It Tells the Agent "Done" Before You Approve
Jamie Lord read the entire source code. This system is built on the assumption that AI will make mistakes. Here's all five mechanisms, illustrated.
↓ One page to read it all · includes animated figures
On August 5, Cloudflare open-sourced Cloudflare OS, the AI office platform used across its company for three months. Every employee gets a workspace with an agent, and every slide deck or spreadsheet you create is an isolated app with its own code that you can ask the agent to modify.
Jamie Lord, author of Architecting on Cloudflare and architect at UK's CDS, read the entire codebase and concluded: the system is designed on the premise that AI will fail.
When an agent tries to do something with real consequences—merge code, send an email, write to a production system—it has to go through a service called the Gatekeeper. Before you approve, the gatekeeper lies.
One caveat: simulation is not mandatory. It's up to each gatekeeper's developer. The real red line is the other one: actions with side effects are never truly executed before approval.
The remaining four mechanisms each cover a different angle, but they're four corollaries of the same philosophy. Let's walk through them as xiaohu creates a quarterly report:
The sandbox idea was tried a decade ago by Kenton Varda's startup Sandstorm. Back then, only containers were available for isolation, too expensive. Now it's cheap:
These three figures come from Cloudflare's Dynamic Workers engineering blog and haven't been independently verified. The analysis article describes containers as "cold-starting in seconds," which is an order of magnitude off, so we didn't use it.
With all five locks in place, what does the agent actually have left?
✔ Reads issues, writes code, builds spreadsheets and slides; just ask if you need a new feature
✔ Even terrible code only hurts its own owner; there's no one else in that room to leak to
✘ Can't grant itself more permissions, or reach the network beyond the methods it's been given
✘ Can't touch anything in the outside world without approval
✘ Can't smuggle sensitive data it has read out through a share
auto-approve
was his to
turn off
The system answers instantly.
happened. They're all
in the queue.
to approve all
or discard all
is ~100x faster
than a container,
a few ms, a few MB
(Cloudflare's
figures)
gatekeeper. Not once
handed over.
- × Can't see the token, not even a glimpse
- × Can't widen its own permissions
- × Can't reach the network beyond its methods
see that sheet.
Door closed.
Members can copy or download the full Markdown, and let their AI subscribe and ask.
Found this useful? Leave your email — every new explainer, the moment it's out. Unsubscribe anytime.
