Skip to content
AI Tools·8 min read·

Cloudflare Computer: Give Your AI Agent a Real Virtual Computer on the Edge (2026 Guide)

Cloudflare Computer is a free, open source virtual filesystem that lives inside Durable Objects. Give AI agents a real computer with container, shell, and JS execution backends. MCP server included. 8K+ stars.

By Abdul Rauf Azhar

AI agents need a workspace. When you ask an agent to "write a script, run it, and show me the output," most agents cannot actually do that. They generate code in chat, but they have no filesystem to write to, no shell to execute in, and no persistent state between turns. The agent writes code, you copy it, you run it, and you paste the output back. That is not autonomous. That is manual labor with extra steps.

Cloudflare Computer is a free, open source virtual filesystem that lives inside a Durable Object. It gives your AI agent a real computer with three execution backends: a full Linux container with real binaries, a shell running in a Dynamic Worker, and a JavaScript module evaluator. The agent can write files, run commands, execute code, and persist state across turns, all on Cloudflare's edge. 8,100+ stars on GitHub, MIT license.

In this guide, you'll learn what Cloudflare Computer is, how it works, and how to give your agent a workspace.

What is Cloudflare Computer?

Cloudflare Computer is a virtual filesystem that lives inside a Durable Object. The Durable Object holds the authoritative state in SQLite and exposes one pluggable execution surface through workspace.runtime. Three backends ship today:

  1. Container: Projects the SQLite state into a sandbox container as a real FUSE mount. A sandbox-side daemon (computerd) mounts the state as a filesystem and syncs changes back over a capnweb RPC channel. Full Linux userland, real binaries, real network.

  2. Isolate shell: Runs just-bash in a Dynamic Worker. It reaches the authoritative Workspace over Workers RPC, so there is no second store or sync round trip. No container needed.

  3. Isolate JavaScript: Runs an ECMAScript module in a fresh Dynamic Worker with structured input/results, durable relative imports, configured libraries, Workspace-backed node:fs/promises, and trusted ws:git and ws:artifacts modules.

A Workspace may register multiple backends under stable IDs. workspace.runtime.exec(source, { backend }) is the single execution entry point. The selected backend defines whether source is a shell command or an ECMAScript module. Backends connect lazily on first use.

Who is it for?

  • AI agent developers: Builders creating autonomous agents that need to write files, run code, and persist state between turns. Computer gives your agent a real workspace instead of a chat window.
  • MCP tool builders: The examples include a deployable Computer MCP server that exposes a code tool backed by a durable workspace, a Worker shell, and a full Linux container. Your MCP-compatible agent can use Computer directly.
  • Cloudflare Workers developers: If you already build on Cloudflare Workers and Durable Objects, Computer gives you a filesystem abstraction that persists across requests, with pluggable execution backends.
  • AI automation teams: Teams building agents that need to run real binaries (pandoc, ffmpeg, python scripts) as part of their workflow, with the container backend providing a full Linux userland.

What makes Cloudflare Computer different from a sandbox or a VM?

  • Durable Object backed: The filesystem state lives in SQLite inside a Durable Object. It persists across requests, survives restarts, and is globally consistent. This is not a temporary sandbox that disappears when the request ends.
  • Three pluggable backends: Choose between a full Linux container (real binaries, real network), a shell in a Dynamic Worker (no container, instant startup), or a JavaScript module evaluator (structured input and results). Same filesystem, different execution models.
  • FUSE mount beats real disk on metadata-heavy work: computerd's FUSE mount outperforms real disk on metadata-heavy operations and trails it on large sequential I/O. The benchmarks are published and reproducible.
  • MCP server example: A deployable Computer MCP example ships in the repo. It exposes one code tool backed by a durable workspace, a Worker shell, and a full Linux container. Your MCP-compatible agent (Claude Code, Cursor) can use Computer directly.
  • Cloudflare edge: Runs on Cloudflare's global edge network. Your agent's workspace is close to your users, with Cloudflare's security, DDoS protection, and observability built in.
  • Free and open source: MIT license. 8,100+ stars. The entire system is open source, including the FUSE daemon, the RPC protocol, and the Durable Object filesystem.

What you need before you start

  • A Cloudflare account: With Workers and Durable Objects enabled.
  • Node.js and npm: For installing the @cloudflare/computer package and deploying Workers.
  • Docker (optional): Only needed if you want to use the container backend with a full Linux userland.
  • An MCP-compatible agent (optional): Claude Code, Cursor, or any MCP client if you want to use the Computer MCP example.

Step-by-step installation

Step 1: Install the Computer package

npm install @cloudflare/computer

Step 2: Create a Worker with a Workspace

Create a Worker that initializes a Computer Workspace with a Durable Object:

import { Computer } from '@cloudflare/computer';

export class AgentWorkspace extends Computer {
  // The Durable Object holds the filesystem state in SQLite
  // and exposes the execution surface through workspace.runtime
}

export default {
  async fetch(request, env) {
    const id = env.AGENT_WORKSPACE.idFromName('default');
    const stub = env.AGENT_WORKSPACE.get(id);
    return stub.fetch(request);
  }
};

Step 3: Choose your execution backend

Register backends under stable IDs. The agent picks which backend to use per execution:

// Container backend: full Linux userland, real binaries
workspace.runtime.register('container', containerBackend);

// Shell backend: just-bash in a Dynamic Worker, no container
workspace.runtime.register('shell', shellBackend);

// JavaScript backend: ECMAScript module in a Dynamic Worker
workspace.runtime.register('js', jsBackend);

// Execute a shell command
const result = await workspace.runtime.exec('ls -la /workspace', { backend: 'shell' });

// Execute a JavaScript module
const result = await workspace.runtime.exec(jsModuleSource, { backend: 'js' });

Step 4: Connect your AI agent via MCP

Use the Computer MCP example to expose the workspace as an MCP tool:

cd examples/mcp
npm install
npm run deploy

Add the MCP server to your Claude Code or Cursor configuration, and your agent can now write files, run commands, and execute code through the Computer workspace.

Common errors and how to fix them

Error What it means How to fix it
Durable Object not found The Worker is not configured with a Durable Object binding. Add the Durable Object binding to your wrangler.toml or Worker configuration. See the Cloudflare Durable Objects documentation.
Container backend fails to start Docker is not installed or the container image is not available. Install Docker and ensure the computerd linux-x64 binary is accessible. The container backend requires a Linux environment.
FUSE mount permission denied The computerd daemon does not have permission to create a FUSE mount. Run the container with appropriate capabilities. See the container example README for the required Docker flags.
MCP server not responding The MCP endpoint is not deployed or the agent configuration is wrong. Verify the Worker is deployed and the MCP endpoint URL is correct in your agent's MCP configuration.

Cloudflare Computer vs traditional sandboxes

Feature Cloudflare Computer Traditional sandbox (E2B, Daytona) Local Docker
State persistence Durable Object (SQLite), survives restarts Ephemeral, lost when session ends Volume mounts, manual management
Execution backends 3 (container, shell, JS isolate) 1 (container) 1 (container)
Startup time Instant (isolate), seconds (container) Seconds (container spin-up) Instant (local)
Global edge Yes (Cloudflare's network) No (single region) No (local only)
MCP server Included Rarely No
Cost Free (Cloudflare Workers free tier) $0.50-2/hour per sandbox Free (your hardware)
Best for AI agents that need a persistent, edge-deployed workspace Running untrusted code in isolation Local development

Bottom line: Cloudflare Computer gives AI agents what they have always been missing: a real, persistent workspace. Instead of generating code in chat and hoping you run it, the agent writes files, executes commands, and reads results, all through a durable filesystem that survives across turns. The three-backend design (container for real binaries, shell for quick commands, JS for structured execution) covers every use case. If you are building autonomous AI agents and want them to actually do things instead of just talk about doing things, Cloudflare Computer is the infrastructure layer you need. It is still in preview, but the design is sound and the examples are runnable today.

3 alternatives worth checking out

  • E2B (e2b.dev): A commercial sandbox platform for AI agents. E2B provides secure, isolated Linux sandboxes that agents can write code to and execute. It is more mature than Cloudflare Computer but is a paid cloud service, not open source, and does not run on the edge. Use E2B if you need production-ready sandboxes today. Use Cloudflare Computer if you want a free, open source, edge-deployed alternative.
  • Daytona (github.com/daytonaio/daytona): An open source development environment manager. Daytona creates and manages secure development environments. It is more focused on human developer environments than AI agent workspaces, but can be used as a backend for agent execution. Use Daytona for developer environment management, Computer for AI agent workspaces.
  • Modal (modal.com): A serverless compute platform for running Python in the cloud. Modal is excellent for running Python code from AI agents but is a commercial platform focused on Python specifically. Use Modal for Python-heavy agent workflows, Computer for multi-language, filesystem-backed agent workspaces on the edge.

Found this guide useful? Check out more AI tools and open source projects on Sudo Scout.

Share:

Related posts