Cloudflare Sandbox vs GitHub Codespaces
Cloudflare Sandbox is a sandbox you drive from code: a container in its own microVM, started from your Worker, that sleeps when idle and comes back with a fresh disk. GitHub Codespaces is a dev environment for people: a dev container opened from a repository in VS Code or the browser, that keeps its files but stops after 12 hours at most.
The companies and products
Cloudflare Sandbox
Cloudflare Sandbox SDK runs untrusted or AI-generated code in Linux containers on Cloudflare's network, driven from a Cloudflare Worker.
Each sandbox is a Cloudflare Container backed by a Durable Object, and each container runs in its own Firecracker microVM with its own kernel and network. You build a linux/amd64 image, pick an instance type of up to 4 vCPU and 12 GiB, and reach the sandbox through your own Worker. It suits teams already on Workers who want short-lived sandboxes that sleep when idle; for code that only calls known methods, Cloudflare also offers Dynamic Workers, which run JavaScript in V8 isolates.
- Largest instance
- 4 vCPU, 12 GiB memory, 20 GB disk (defaults, can be raised)
- Account limits
- 1,500 vCPU, 6 TiB memory and 30 TB disk running at once
- Compliance
- Cloudflare holds a SOC 2 Type II report
GitHub Codespaces
GitHub Codespaces is GitHub's cloud development environment: a ready-to-code Linux machine for a repository, opened in the browser, VS Code or the GitHub CLI.
Codespaces is a different kind of product from boat: a dev environment for people working on a GitHub repository, not a sandbox API for agents. Each codespace is a Docker container built from the repo's dev container config, running on its own newly built VM on Azure, with 2 to 32 cores. It is built for developers and teams who want every contributor to start from the same setup, with prebuilds, port forwarding and GitHub billing.
Which use cases each one fits
For each use case, Battleships prices every sandbox provider on the same workload and sorts them from the cheapest monthly bill up. “13th cheapest of 345” means 12 of the other 344 providers run that workload, with every feature it needs, for less. “With limits” means the provider runs it but misses something, so it is listed after every full match. Open a use case for its whole ranking and what each provider misses.
| Use case and its workload | Cloudflare Sandbox: price rank | GitHub Codespaces: price rank | boat: price rank |
|---|---|---|---|
| Software factory 100 at once · 4 vCPU / 8 GB · 2,200 sessions of 8 h a month Long build-and-test loops hit a wall on both: Cloudflare resets the disk when a container sleeps, and a codespace stops after 12 hours; boat keeps the disk and runs until you stop it. | 162nd of 367, with limits $1,543 a month | 274th of 367, with limits $4,618 a month | 3rd cheapest of 367 $634 a month |
| Always-on AI employees 50 machines 24/7 · 2 vCPU / 4 GB An always-on assistant needs its files and logins to stay put; Cloudflare wipes the disk on sleep, Codespaces stops every 12 hours, and boat keeps running with its disk. | 207th of 366, with limits $2,188 a month | 309th of 366, with limits $6,970 a month | 5th cheapest of 366 $657 a month |
| Code interpreter bursts 100 at once · 1 vCPU / 2 GB · 200,000 sessions of 1 min a month For short code-interpreter calls Cloudflare Sandbox ranks 13th, since CPU is billed only while busy and a container wakes on the next request, while each codespace builds a dev container on a new VM. | 13th cheapest of 345 $144 a month | 288th of 345, with limits $619 a month | 186th of 345, with limits $2,000 a month |
| Sandboxes for your users 300 at once · 2 vCPU / 4 GB · 30,000 sessions of 23 min a month Cloudflare fits sandboxes for your own users and adds egress rules in Worker code; Codespaces are made for GitHub users on a repository and GitHub does not publish how many can run at once. | 9th cheapest of 361 $731 a month | 281st of 361, with limits $1,964 a month | Cheapest of 361 $209 a month |
| RL rollouts 1,000 at once · 2 vCPU / 4 GB · 1,000,000 sessions of 3 min a month | 144th of 360, with limits $9,428 a month | 282nd of 360, with limits $9,489 a month | 34th of 360, with limits $2,000 a month |
| Agent evals 250 at once · 4 vCPU / 8 GB · 15,000 sessions of 20 min a month Cloudflare fits agent evals as many short, separate sandboxes; on Codespaces every copy is created again from the repository, and boat can fork one prepared machine while it runs. | 45th cheapest of 364 $818 a month | 295th of 364, with limits $1,519 a month | 10th cheapest of 364 $200 a month |
| CI runners 40 at once · 8 vCPU / 16 GB · 6,000 sessions of 12 min a month Neither is a natural CI box: Cloudflare caps disk at 20 GB by default and runs Docker with iptables off, and Codespaces has no fork or snapshot API. | 301st of 377, with limits $704 a month | 314th of 377, with limits $909 a month | 4th cheapest of 377 $86 a month |
| 24/7 dev boxes 1 machine 24/7 · 4 vCPU / 8 GB Codespaces is the more polished dev box for a person, with VS Code and files kept between days, but it stops after 12 hours at most; Cloudflare starts from a fresh disk after sleep. | 70th cheapest of 368 $93 a month | 130th of 368, with limits $270 a month | 18th cheapest of 368 $26 a month |
| Computer-use agents 50 at once · 4 vCPU / 8 GB · 20,000 sessions of 15 min a month Neither ships a graphical desktop: Cloudflare removed its built-in one and Codespaces gives you an editor and a terminal, while boat streams a 60fps desktop with Chromium. | 166th of 369, with limits $460 a month | 267th of 369, with limits $1,367 a month | 6th cheapest of 369 $200 a month |
| Browser-use agents 50 at once · 2 vCPU / 4 GB · 30,000 sessions of 10 min a month | 210th of 367, with limits $233 a month | 275th of 367, with limits $678 a month | 7th cheapest of 367 $200 a month |
| Scraping & bots (startup scale) 50 at once · 1 vCPU / 2 GB · 100,000 sessions of 3 min a month | 250th of 346, with limits $286 a month | 310th of 346, with limits $922 a month | 6th cheapest of 346 $90 a month |
| Mass scraping & bots (undetectable) 1,000 at once · 1 vCPU / 2 GB · 3,000,000 sessions of 2 min a month | 169th of 338, with limits $5,741 a month | 280th of 338, with limits $18,637 a month | 71st of 338, with limits $1,800 a month |
| Parallel red teaming 200 at once · 2 vCPU / 4 GB · 5,000 sessions of 30 min a month | 239th of 360, with limits $325 a month | 267th of 360, with limits $445 a month | 2nd cheapest of 360 $200 a month |
| GPU eval jobs 10 at once · 8 vCPU / 32 GB · 500 sessions of 30 min a month | Can't run it | Can't run it | Can't run it |
| macOS agents 5 at once · 4 vCPU / 8 GB · 1,000 sessions of 20 min a month | Can't run it | Can't run it | Can't run it |
Key features
| Feature | Cloudflare Sandbox | GitHub Codespaces | boat |
|---|---|---|---|
| What it is | Sandbox SDK: Linux containers you start and drive from a Cloudflare Worker | Cloud dev environment opened from a GitHub repository in VS Code, the browser or the CLI | Sandbox API: full VMs you create, fork and drive from code |
| Isolation | Firecracker microVM per container, own kernel and network | A Docker container on its own newly built VM, with its own virtual network | Full VM with its own kernel on dedicated AMD Ryzen 9 9950X hosts |
| Largest machine | 4 vCPU / 12 GiB / 20 GB disk by default (can be raised) | 2, 4, 8, 16 or 32 cores, with 4 GB of memory per core | Up to 16 vCPU / 32 GB, depending on plan |
| How long it runs | No fixed maximum runtime, but none guaranteed; host restarts can stop it and wipe its state | Stops after 30 idle minutes by default (up to 240) and after 12 hours at most, even while in use | Runs until you stop it; no session cap on paid plans |
| Files after a stop | Fresh disk after sleep; snapshots (public beta, 30 days) or R2 backups when your code saves them | Saved files are kept and storage is billed; stopped codespaces are deleted after 30 days by default | Disk snapshotted every minute and on stop; a stopped sandbox keeps its disk and costs nothing |
| Fork a running sandbox | No fork; restore a saved snapshot or backup into a new sandbox | No copy or snapshot endpoint; new codespaces start from a repo, branch, pull request or prebuild | Yes, without stopping it |
| Docker and nested virtualization | docker:dind with iptables and IP forwarding turned off; nested virtualization not documented | Docker and sudo inside the dev container; /dev/kvm not documented | Full Docker, root, systemd and /dev/kvm on every machine |
| Desktop and computer use | Built-in desktop removed in SDK 0.10.2; bring your own | VS Code, JupyterLab and a terminal; no graphical desktop | 60fps desktop and Chromium, computer-use API, embeddable stream |
| Reaching the sandbox | HTTP and WebSocket previews routed through your Worker; no raw TCP or public IP | A URL per forwarded port, plus SSH and CLI tunnels; no public IP | HTTPS URLs for up to 50 ports, token-protected; raw TCP; own IPv6 or IPv4 |
| Egress control | allowedHosts deny-by-default list plus outbound handlers you write in Worker code | Open internet; GitHub says there is no way to restrict it | Open internet; no provider-side allowlist |
| Keeping keys out of the sandbox | Your outbound handler adds the token for any HTTP or HTTPS host; you write the code | Secrets are copied into the codespace as environment variables | Managed proxy for model providers and any HTTPS API you register; switch a credential to another account |
| Coding agents | Run Claude Code, Codex, OpenCode or Pi in your image; OpenCode has an SDK helper | GitHub Copilot as a VS Code extension; other agents you install and run yourself | Claude Code, Codex, OpenCode and more built in, with a prompt, steer and events API |
| Sleep when idle | Stops after inactivity and wakes on the next request | Stops after the idle timeout; you restart it from the editor, CLI or API | TTL based (1 h default, changeable); no idle timer |
| Regions | Several regions across Cloudflare's network, nearest free instance picked | US East, US West, Europe West and Southeast Asia | EU only: Germany, Finland, France |
Every feature Battleships tracks (43)
| Feature | Cloudflare Sandbox | GitHub Codespaces | boat |
|---|---|---|---|
| Full VM (own kernel) | Yes | Yes | Yes |
| Docker inside | Yes | Yes | Yes |
| Nested virtualization | No | No | Yes |
| Root | Yes | Yes | Yes |
| Systemd | Not published | Not published | Yes |
| Desktop GUI | No | No | Yes |
| Browser | No | No | Yes |
| Computer-use API | No | No | Yes |
| SSH | Yes | Yes | Yes |
| Persistent disk | No | Yes | Yes |
| Pause/resume | No | Yes | Yes |
| Automatic snapshots | No | No | Yes |
| Fork/clone | No | No | Yes |
| Live fork (no pause) | No | No | Yes |
| Memory fork | No | No | No |
| Custom image (Docker or snapshot) | Yes | Yes | Yes |
| ≥24 h sessions | Yes | No | Yes |
| Idle auto-stop | Yes | Yes | No |
| Wake on request | Yes | No | No |
| HTTPS preview URLs | Yes | Yes | Yes |
| Raw TCP inbound | No | No | Yes |
| Public IPv4 | No | No | No |
| Egress allowlist | Yes | No | No |
| Secret proxy | Yes | No | Yes |
| Secret proxy for any API | Yes | No | Yes |
| Preinstalled agents | Yes | No | Yes |
| Agent harness API | Yes | No | Yes |
| MCP server | No | No | No |
| GPU | No | No | No |
| Windows | No | No | No |
| Arm64 | No | No | No |
| Self-hosting | No | No | No |
| BYOC | No | No | No |
| Open source | Yes | No | No |
| Scoped API keys | Not published | Not published | Yes |
| Spend limits | No | Yes | Yes |
| Usage per sandbox (API) | Not published | No | Yes |
| Audit logs | Yes | Yes | No |
| SSO | Yes | Yes | No |
| SOC 2 | Yes | Yes | No |
| HIPAA | Yes | No | No |
| EU data residency | Yes | Yes | Yes |
| Zero data retention | Not published | Not published | Yes |
Performance
Neither Cloudflare Sandbox nor GitHub Codespaces has a result on the hpc-sandbox-benchmarks Node.js build-and-test loop, so there is no comparable CPU number between them. boat did 26.69 runs per second at 4 vCPU / 8 GB in StarSling's run of 2026-09-29, on dedicated AMD Ryzen 9 9950X hosts.
Node.js build-and-test loop at 4 vCPU / 8 GB, higher is better. Measured with the open hpc-sandbox-benchmarks suite. Cloudflare Sandbox and GitHub Codespaces have no published run in this suite yet, so there is no like-for-like number to compare.
Pricing in five scenarios
Each bill is priced from the providers' public price lists by the open Battleships engine, with the cheapest plan that runs the scenario.
| Scenario | Cloudflare Sandbox, a month | GitHub Codespaces, a month | boat, a month |
|---|---|---|---|
| One coding agent, workdays 4 vCPU / 8 GB, 50 GB disk, 8 hours a day, 22 days a month, files kept between days | $39 · Workers Paid · with limits | $51 · Personal account: GitHub Free | $20 · $20/mo |
| One agent that never stops 4 vCPU / 8 GB, 50 GB disk, running 24/7 all month | $148 · Workers Paid · with limits | $270 · Personal account: GitHub Free · with limits | $26 · $20/mo |
| 50 agents in parallel 50 machines of 4 vCPU / 8 GB at once, 8-hour sessions, 1,100 sessions a month, Docker inside | $1,660 · Workers Paid · with limits | $3,019 · Personal account: GitHub Free | $317 · $20/mo × 3 seats |
| Sandboxes for your users 2 vCPU / 4 GB, 30,000 sessions of 10 minutes a month, up to 300 at once | $476 · Workers Paid | $850 · Personal account: GitHub Free · with limits | $200 · $100/mo × 2 seats |
| 1,000 short jobs at once 2 vCPU / 4 GB, 1,000 at once, 3 minutes each, 200,000 jobs a month | $1,889 · Workers Paid · with limits | $1,889 · Personal account: GitHub Free · with limits | $2,000 · $2000/mo · with limits |
Cloudflare Sandbox: You need Workers Paid ($5 a month minimum). CPU is billed only while in use; memory and disk are billed on the instance size, in 10 ms steps, until the container sleeps, and 4 vCPU always comes with 12 GiB.
GitHub Codespaces: Codespaces bills $0.09 per core-hour while a codespace is active, used or not, plus $0.07 per GB-month of storage while it exists, stopped too. Personal accounts get a free monthly quota; organizations do not.
GitHub Codespaces: You pick a monthly plan from $20, and all of it becomes usage credit spent per second on running sandboxes. A stopped sandbox costs nothing and keeps its disk.
Limits in those scenarios
Cloudflare's disk resets after sleep, so the scenarios that keep 50 GB of files between days do not fit without your own snapshot or backup code, and its 1,500 vCPU account cap is short of the 2,000 vCPU the 1,000-job burst needs. Codespaces keeps files, but every codespace stops after 12 hours, so it misses the always-on scenario, and GitHub does not publish how many can run at once, so 300 user sandboxes and 1,000 short jobs are not confirmed. boat fits all but the burst, where the $2,000 plan allows 600 starts an hour and bursts above 90 starts a minute wait in a queue.
| Scenario | Cloudflare Sandbox | GitHub Codespaces | boat |
|---|---|---|---|
| One coding agent, workdays |
| None that bite | None that bite |
| One agent that never stops |
|
| None that bite |
| 50 agents in parallel |
|
| None that bite |
| Sandboxes for your users | None that bite |
| None that bite |
| 1,000 short jobs at once |
|
|
|
Which one should you use?
Use Cloudflare Sandbox when
your app already runs on Workers and you want many short sandboxes that sleep when idle, wake on the next request and follow egress rules you program.
- Egress rules you can program. Useful when sandboxes run untrusted code: block every host except the ones you list, and run your own code on each outbound request.
- Sleeps when idle, wakes on request. Useful for many short, spiky sessions: a sandbox sleeps when idle, wakes on the next request, and bills CPU only while busy.
- Part of the Workers platform. If your app already runs on Workers, sandboxes sit next to Durable Objects and R2, in several regions.
Use GitHub Codespaces when
your developers want a ready VS Code environment for a GitHub repository, opened from a branch or pull request, with files kept between days.
- Built into GitHub. Useful if your team lives on GitHub: open a codespace from any repo, branch or pull request, with the dev container already set up.
- Bigger machines for people. Useful for heavy local-style work: machines go up to 32 cores with 4 GB of memory per core, and files stay between days.
- Free hours for personal accounts. Useful for occasional personal work: a GitHub Free account includes 120 core-hours and 15 GB-month of storage each month.
Where boat fits
If what you are really running is coding agents that work for hours, neither product was built for that: Cloudflare forgets the disk when a sandbox sleeps, and Codespaces is a dev box for people that stops at 12 hours. boat gives each agent a full VM that keeps running and keeps its files, with Docker, /dev/kvm, a desktop and the agents already installed.
Work that survives the night
Cloudflare starts a slept sandbox from a fresh disk unless your code saves a snapshot or R2 backup, and a codespace stops at 12 hours, ending its processes. boat runs until you stop it, saves the disk every minute and forks while running.
A full machine, not a container
On Cloudflare, Docker runs with iptables off, disk is 20 GB by default and there is no desktop. Codespaces documents no /dev/kvm, no graphical desktop and no public IP. boat has systemd, /dev/kvm, a 60fps desktop and raw TCP.
Agents driven from outside, keys kept out
On Cloudflare you bake each agent into your image and write the outbound handler that adds tokens. On Codespaces you script agents over SSH, and secrets sit in environment variables. boat ships agents with a prompt, steer and events API and a credentials proxy.
Use boat when your code starts agents that work for hours or days: full VMs with Docker, /dev/kvm and a desktop, coding agents built in with keys kept outside, and machines that keep their work and fork while running. Compare it one to one: boat vs Cloudflare Sandbox and boat vs GitHub Codespaces.
Questions people ask
Is Cloudflare Sandbox cheaper than GitHub Codespaces?
In our scenarios Cloudflare's estimate is lower: one agent all month is $148 against $270, 50 agents $1,660 against $3,019, and 300 user sandboxes $476 against $850. But Cloudflare only fits the user-sandbox scenario, since the others need files kept between sessions. boat comes to $26, $317 and $200 for the same three.
Which is faster, Cloudflare Sandbox or GitHub Codespaces?
There is no comparable measurement: neither has a result on the benchmark we use. boat did 26.69 Node.js build-and-test runs per second at 4 vCPU / 8 GB.
Can I run Docker in Cloudflare Sandbox or GitHub Codespaces?
Yes, with limits. Cloudflare supports docker:dind with iptables and IP forwarding turned off, and Codespaces runs Docker inside the dev container with sudo, but neither documents /dev/kvm. boat runs full Docker with systemd and /dev/kvm.
Can an AI agent run 24/7 on either one?
Not easily. Codespaces stops every codespace after 12 hours, even while in use. Cloudflare has no fixed maximum runtime but guarantees none, and a stopped or slept container comes back with a fresh disk. A boat sandbox runs until you stop it, with no session cap on paid plans.
Which one keeps my files?
Codespaces keeps saved files when a codespace stops, and deletes stopped codespaces after 30 days by default. Cloudflare starts from a fresh disk after sleep unless your code saved a snapshot (public beta, 30 days) or an R2 backup. boat keeps the disk on its own and snapshots it every minute.
Where do they run?
Cloudflare places containers in several regions of its network and picks the nearest free instance. Codespaces runs in US East, US West, Europe West and Southeast Asia. boat runs only in the EU, in Germany, Finland and France.
Try boat
Install the CLI, then run boat new.
7-day free trial
More comparisons
- boat vs Cloudflare Sandbox
- boat vs GitHub Codespaces
- E2B vs Cloudflare Sandbox
- Daytona vs Cloudflare Sandbox
- Modal vs Cloudflare Sandbox
- Vercel Sandbox vs Cloudflare Sandbox
- Cloudflare Sandbox vs Blaxel
- Cloudflare Sandbox vs Runloop
- Cloudflare Sandbox vs Tensorlake
- Cloudflare Sandbox vs Morph Cloud
- Cloudflare Sandbox vs CodeSandbox SDK
- Cloudflare Sandbox vs Northflank