Cloudflare Sandbox vs CodeSandbox SDK
Both run each sandbox in its own Firecracker microVM. A Cloudflare sandbox lives inside your Workers app, starts from a fresh disk after it sleeps, and keeps files through snapshots, automatic saves or R2 that your code sets up. A CodeSandbox SDK sandbox keeps its disk and hibernates with its memory, so it wakes with processes still running.
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. 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. The disk resets when the container stops, and your code keeps files with snapshots, automatic saves, R2 backups or R2 bucket mounts. It suits teams already on Workers who want 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
- Compliance
- Cloudflare holds a SOC 2 Type II report
CodeSandbox SDK
CodeSandbox SDK is an API from CodeSandbox, now a Together AI company, that starts sandboxed development VMs on the same infrastructure as the CodeSandbox editor.
Each sandbox is a Firecracker microVM built from a template or any Dockerfile. When it goes idle, it hibernates with a memory snapshot, and it resumes or forks from that snapshot in seconds. You drive it from a TypeScript SDK through terminals, commands, files and HTTPS hosts. Together's docs call it the deprecated offering and point new users to its successor, the together-sandbox SDK.
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. “43rd cheapest of 361” means 42 of the other 360 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 | CodeSandbox SDK: price rank | boat: price rank |
|---|---|---|---|
| Software factory 100 at once · 4 vCPU / 8 GB · 2,200 sessions of 8 h a month A long build session needs its files to stay. CodeSandbox SDK keeps its disk with no code. On Cloudflare your code keeps files with snapshots, automatic saves or R2. boat saves the disk with no code and adds /dev/kvm and coding agents. | 192nd of 365, with limits $1,543 a month | 32nd cheapest of 365 $3,731 a month | 5th cheapest of 365 $634 a month |
| Always-on AI employees 50 machines 24/7 · 2 vCPU / 4 GB | 43rd cheapest of 361 $2,188 a month | 50th cheapest of 361 $4,811 a month | 6th cheapest of 361 $657 a month |
| Code interpreter bursts 100 at once · 1 vCPU / 2 GB · 200,000 sessions of 1 min a month Both fit short code-interpreter calls. Cloudflare bills CPU only while busy and wakes on the next request. CodeSandbox SDK wakes a hibernated VM with its memory, and bills per started minute until it hibernates. | 17th cheapest of 336 $144 a month | 54th cheapest of 336 $642 a month | 189th of 336, 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 300 user sandboxes at once on Workers Paid. CodeSandbox SDK's Scale plan stops at 250 VMs at once. boat fits on the $100 plan with 2 seats, with SSH, a desktop and start limits per plan. | 19th cheapest of 349 $731 a month | 140th of 349, with limits $1,707 a month | 3rd cheapest of 349 $209 a month |
| RL rollouts 1,000 at once · 2 vCPU / 4 GB · 1,000,000 sessions of 3 min a month CodeSandbox SDK's memory forks let many rollouts branch from one warm state. On Cloudflare you snapshot a running sandbox and start new ones from it. A boat fork copies the disk, and the fork boots fresh. | 147th of 349, with limits $9,428 a month | 341st of 349, with limits $3,861 a month | 39th of 349, with limits $2,000 a month |
| Agent evals 250 at once · 4 vCPU / 8 GB · 15,000 sessions of 20 min a month | 60th cheapest of 359 $818 a month | 77th cheapest of 359 $1,335 a month | 10th cheapest of 359 $200 a month |
| CI runners 40 at once · 8 vCPU / 16 GB · 6,000 sessions of 12 min a month CodeSandbox SDK runs Docker with root on a 20 GB disk that stays. Cloudflare runs docker:dind with iptables turned off, on up to 20 GB of disk. boat runs Docker with BuildKit on 51 GB or more. | 303rd of 374, with limits $704 a month | 96th cheapest of 374 $860 a month | 2nd cheapest of 374 $86 a month |
| 24/7 dev boxes 1 machine 24/7 · 4 vCPU / 8 GB | 123rd cheapest of 371 $93 a month | 316th of 371, with limits $240 a month | 19th cheapest of 371 $26 a month |
| Computer-use agents 50 at once · 4 vCPU / 8 GB · 20,000 sessions of 15 min a month Cloudflare removed its built-in desktop, and CodeSandbox SDK has a headless Chromium template; on both you add a VNC desktop to your own image. boat streams a 60 fps desktop in every sandbox. | 207th of 367, with limits $460 a month | 54th cheapest of 367 $1,236 a month | 7th cheapest of 367 $200 a month |
| Browser-use agents 50 at once · 2 vCPU / 4 GB · 30,000 sessions of 10 min a month | 68th of 356, with limits $233 a month | 125th of 356, with limits $741 a month | 7th cheapest of 356 $200 a month |
| Scraping & bots (startup scale) 50 at once · 1 vCPU / 2 GB · 100,000 sessions of 3 min a month | 102nd cheapest of 343 $286 a month | 119th cheapest of 343 $871 a month | 6th cheapest of 343 $90 a month |
| Mass scraping & bots (undetectable) 1,000 at once · 1 vCPU / 2 GB · 3,000,000 sessions of 2 min a month | 168th of 327, with limits $5,741 a month | 194th of 327, with limits $7,390 a month | 73rd of 327, with limits $1,800 a month |
| Parallel red teaming 200 at once · 2 vCPU / 4 GB · 5,000 sessions of 30 min a month Red-team runs often need raw TCP, root networking and nested VMs. Neither Cloudflare nor CodeSandbox SDK takes raw TCP from outside or documents /dev/kvm. boat has raw ports over IPv6 and /dev/kvm. | 25th cheapest of 351 $325 a month | 29th cheapest of 351 $505 a month | 3rd cheapest of 351 $200 a month |
| GPU eval jobs 10 at once · 8 vCPU / 32 GB · 500 sessions of 30 min a month | Not ranked: misses a requirement | Not ranked: misses a requirement | Not ranked: misses a requirement |
| macOS agents 5 at once · 4 vCPU / 8 GB · 1,000 sessions of 20 min a month | Not ranked: misses a requirement | Not ranked: misses a requirement | Not ranked: misses a requirement |
Key features
| Feature | Cloudflare Sandbox | CodeSandbox SDK | boat |
|---|---|---|---|
| Isolation | Firecracker microVM per container, own kernel and network | Firecracker microVM per sandbox, own kernel | Full VM with its own kernel, on a physical host dedicated to boat (AMD Ryzen 7 9700X or Ryzen 9 9950X); vCPUs are shared |
| Biggest machine | 4 vCPU / 12 GiB / 20 GB disk | Up to 16 cores / 32 GB on Scale, 64 cores / 128 GB on Enterprise; 20 GB disk on every size | 16 vCPU / 32 GB / 251 GB disk (needs the $100 plan or higher) |
| Files between sessions | Disk is fresh after sleep; keep files with snapshots (public beta, 30 days), scheduled automatic saves, R2 backups or a mounted R2 bucket | Disk kept; hibernates with a memory snapshot | Disk saved every minute and at each stop, with no code; kept at least 14 days after a stop |
| Pause and resume | No memory kept; a sleeping container starts again on the next request | Resumes from a memory snapshot with processes still running, in about 0.5 to 2 s | Memory not kept; resume boots the machine again with its disk in place |
| Fork | Snapshot or back up a running sandbox, then start new sandboxes from it; no one-call fork | Fork a hibernated sandbox from its memory snapshot, or a running one sharing its memory | Fork a running sandbox in one call, from its last 1-minute disk snapshot |
| Wake on request | Yes; stops after inactivity and wakes on the next request | Yes; an HTTP request to a host wakes a hibernated VM | No; you resume a stopped sandbox by API |
| Docker inside | docker:dind with iptables and IP forwarding turned off | Docker and root; templates build from any Dockerfile | Docker with BuildKit and Compose, root and systemd; start from boat's image or a saved snapshot |
| Nested virtualization | Not documented | Not documented | Yes, /dev/kvm for Android emulators and VMs |
| Inbound traffic | HTTP and WebSocket previews routed through your Worker; SSH; no raw TCP inbound or public IP | HTTPS host per port, public by default, signed tokens for private sandboxes; SSH, raw TCP and a public IP not documented | Up to 50 HTTPS URLs, token-gated by default; SSH; raw ports over public IPv6 |
| Egress control | allowedHosts deny-by-default list plus outbound handlers in Worker code | No provider-side allowlist documented | 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 passed in as environment variables; no credentials proxy documented | Optional paid proxy ($1 a day while on, plus $1 per 1,000 requests) for model providers and custom HTTPS APIs; other secrets enter the sandbox |
| Desktop and browser | Built-in desktop removed in SDK 0.10.2; headless browsers through the separate Browser Run service | No built-in desktop; a headless Chromium template, and you can install a VNC desktop in your own Dockerfile | 1920x1080, 60 fps desktop and Chrome, computer tools, embeddable stream |
| Coding agents | Guides for Claude Code, Codex, OpenCode and Pi in your image | You install your own agent in the template and run it through the commands API | Seven installed (Claude Code, Codex and more), with a prompt, steer and events API |
| Regions | Several regions across Cloudflare's network; pin to a region or jurisdiction | A country hint steers scheduling; placement not guaranteed | Germany, Finland and France; no US or Asia region; you cannot pick one |
Every feature Battleships tracks (43)
| Feature | Cloudflare Sandbox | CodeSandbox SDK | boat |
|---|---|---|---|
| Full VM (own kernel) | Yes | Yes | Yes |
| Docker inside | Yes | Yes | Yes |
| Nested virtualization | No documented way | No documented way | Yes |
| Root | Yes | Yes | Yes |
| Systemd | Not published | Not published | Yes |
| Desktop GUI | No documented way | With your own setup | Yes |
| Browser | With your own setup | With your own setup | Yes |
| Computer-use API | No documented way | No documented way | Yes |
| SSH | Yes | No documented way | Yes |
| Persistent disk | With your own setup | Yes | Yes |
| Pause/resume | No documented way | Yes | Yes |
| Automatic snapshots | With your own setup | Yes | Yes |
| Fork/clone | With your own setup | Yes | Yes |
| Live fork (no pause) | With your own setup | Yes | Yes |
| Memory fork | No documented way | Yes | No documented way |
| Custom image (Docker or snapshot) | Yes | Yes | Yes |
| ≥24 h sessions | Yes | Yes | Yes |
| Idle auto-stop | Yes | Yes | No documented way |
| Wake on request | Yes | Yes | No documented way |
| HTTPS preview URLs | Yes | Yes | Yes |
| Raw TCP inbound | No documented way | No documented way | Yes |
| Public IPv4 | No documented way | No documented way | No documented way |
| Egress allowlist | Yes | No documented way | No documented way |
| Secret proxy | Yes | No documented way | Yes |
| Secret proxy for any API | Yes | No documented way | Yes |
| Preinstalled agents | Yes | No documented way | Yes |
| Agent harness API | With your own setup | No documented way | Yes |
| MCP server | No documented way | No documented way | No documented way |
| GPU | No documented way | No documented way | No documented way |
| Windows | No documented way | No documented way | No documented way |
| Arm64 | No documented way | No documented way | No documented way |
| Self-hosting | No documented way | No documented way | No documented way |
| BYOC | No documented way | No documented way | No documented way |
| Open source | Yes | No documented way | No documented way |
| Scoped API keys | Not published | Not published | Yes |
| Spend limits | No documented way | Not published | Yes |
| Usage per sandbox (API) | Not published | No documented way | Yes |
| Audit logs | Yes | Not published | No documented way |
| SSO | Yes | Yes | No documented way |
| SOC 2 | Yes | Yes | No documented way |
| HIPAA | Yes | No documented way | No documented way |
| EU data residency | Yes | No documented way | No documented way |
| Zero data retention | Not published | Not published | Yes |
Performance
Cloudflare Sandbox and CodeSandbox SDK are not in StarSling's run of 3 October 2026 (run 37073680030), so we cannot compare their CPU. In that run boat did 28.06 runs/s on the V8 Web Tooling Benchmark at 4 vCPU / 8 GB, second of 15, on an AMD Ryzen 9 9950X host; boat also places some sandboxes on other hosts. ComputeSDK measured median starts with 100 at once (2026-11-06, default sizes): 671 ms for Cloudflare and 11.76 s for CodeSandbox SDK. boat is not in ComputeSDK. Providers ran on different hardware in different regions.
V8 Web Tooling Benchmark at a 4 vCPU / 8 GB target, runs per second, higher is better. Source: StarSling's run of 3 October 2026 (run 37073680030), median of 5 sandboxes. Providers ran on different hardware in different regions. StarSling gives a shared rank when the run cannot separate two providers. Every boat sandbox in this run ran on an AMD Ryzen 9 9950X host. boat also places some sandboxes on AMD Ryzen 7 9700X hosts, which this run did not measure. Cloudflare Sandbox and CodeSandbox SDK are not in the public benchmarks we use, so we cannot say which is faster.
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. Start limits, per-start fees and plan minimums are in the price, boat's included.
| Scenario | Cloudflare Sandbox, a month | CodeSandbox SDK, 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 | $193 · Scale | $20 · $20/mo |
| One agent that never stops 4 vCPU / 8 GB, 50 GB disk, running 24/7 all month | $148 · Workers Paid | $341 · Scale | $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 | $2,500 · Scale | $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 | $815 · Scale · 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,632 · Scale · with limits | $8,800 · $2000/mo · with limits |
Cloudflare Sandbox: You need Workers Paid ($5 a month minimum). CPU is billed only while busy, at $0.072 per vCPU-hour; memory and disk on the instance size until the container sleeps, and 4 vCPU always comes with 12 GiB. Durable Object and Worker requests are billed on top, and snapshot pricing is not published.
CodeSandbox SDK: You buy VM credits at $0.01486 each, and each size burns a fixed number per hour: 20 for 4 vCPU / 8 GB, about $0.30. Billing is per started minute while the VM runs, including idle time before it hibernates. A hibernated VM costs nothing. Scale adds a $170 monthly platform fee that is not usage credit. Prices as checked on 28 September 2026.
CodeSandbox SDK: Plans cost $20, $100, $500 or $2,000 a month, and the whole plan price comes back as VM time for that month. A 4 vCPU / 8 GB sandbox costs $0.036 an hour, billed per second while it runs, busy or idle. A stopped sandbox has no compute charge; saved snapshots above the included count and the AI proxy, if on, still bill. The $20 plan includes 200 starts a day; extra starts cost $0.03 to $0.07.
Limits in those scenarios
Cloudflare's local disk tops out at 20 GB and resets after sleep, so the scenarios that keep files between sessions need your own snapshot, automatic-save or R2 code. CodeSandbox SDK's Scale plan caps at 250 VMs at once and 1,000 new sandboxes an hour, so it misses the 300-at-once user sandboxes, and its price for egress and extra disk is not published. For 1,000 short jobs at once none of the three fits as is: Cloudflare's default account limit is 1,500 vCPU running at once against the 2,000 needed, CodeSandbox SDK stops at 250 VMs, and boat's $2,000 plan includes 90 starts a minute, charges $0.03 to $0.07 for extra starts and refuses starts above 270 a minute with 429.
| Scenario | Cloudflare Sandbox | CodeSandbox SDK | boat |
|---|---|---|---|
| One coding agent, workdays | None for this scenario |
| None for this scenario |
| One agent that never stops | None for this scenario |
| None for this scenario |
| 50 agents in parallel | None for this scenario |
| None for this scenario |
| Sandboxes for your users | None for this scenario |
| None for this scenario |
| 1,000 short jobs at once |
|
|
|
Which one should you use?
Use Cloudflare Sandbox when
your app already runs on Workers, your sessions are short and spiky, and you want to program exactly which hosts a sandbox can reach.
- Egress rules you can program. For teams that must control traffic: block every host except the ones you list, and run your own code on each outbound request.
- Native to Workers. If your app already runs on Workers, sandboxes sit next to Durable Objects and R2, in a region you can pick.
- Billing for spiky sessions. CPU is billed only while busy, and a sandbox sleeps when idle and wakes on the next request.
Use CodeSandbox SDK when
sandboxes sleep between visits and should wake with their memory and files intact, or fork from a warm state, from your own Dockerfile, and you accept that Together calls this SDK deprecated.
- Hibernation with memory. For sandboxes used in bursts: an idle VM hibernates at no charge and wakes with its memory and running processes.
- Forks from a warm state. Good for branching many runs, such as rollouts or test variants, from one running state instead of booting again.
- Bigger machines, your own Dockerfile. Sizes reach 16 cores and 32 GB on Scale, templates build from any Dockerfile, and files stay on the disk between sessions.
Where boat fits
If your agents do hours of real work, compare what each one gives the agent. On Cloudflare your code keeps the files. CodeSandbox SDK keeps them, and you reach the VM through its SDK. boat gives each agent a full VM that saves its files with no code, with SSH, Docker, /dev/kvm, a desktop and coding agents installed.
A full machine with its own kernel
Emulator builds and VM tests need /dev/kvm, which neither documents. Cloudflare runs Docker with iptables turned off, and CodeSandbox SDK documents no SSH, so tools go through an SDK call. boat has root, systemd, Docker, SSH and /dev/kvm.
A desktop and agents installed
On Cloudflare and CodeSandbox SDK you add a desktop and each agent to your own image. boat streams a 60 fps desktop and drives Claude Code, Codex and five other agents from outside through one API.
Hosting beyond HTTP
Neither Cloudflare nor CodeSandbox SDK takes raw TCP from outside, so a database or game server an agent starts is reached over HTTP only. boat opens raw ports over public IPv6 and serves up to 50 HTTPS URLs, token-gated by default.
Use boat when your agents do real work for hours: builds, Docker, emulators, a desktop and servers others can reach, on a full machine that saves its files with no code. Compare it one to one: boat vs Cloudflare Sandbox and boat vs CodeSandbox SDK.
boat's own limits
- Plans start at $20 a month. The plan price comes back as VM time for that month. Unused time does not carry over. Source
- Starts (create, fork, resume): the $20 plan includes 12 a minute, 60 an hour and 200 a day. The $2,000 plan includes 90 a minute, 600 an hour and 2,400 a day. Extra starts cost $0.03 to $0.07. A start fails with 429 above 3 times the included starts per minute, or 6 times per hour or per day. Source
- A stopped sandbox has no compute charge. boat keeps its disk for at least 14 days. A saved snapshot keeps it longer; extra saved snapshots and the AI credentials proxy are paid. Source
- Auto-stop defaults to 1 hour. You can turn it off on a paid plan. The trial allows 2 hours at most. Source
- boat saves the disk every minute and at each stop. Memory, running programs and /tmp are not saved: a resume is like a reboot. A machine failure loses writes after the last good snapshot. Source
- Machines run in Germany, Finland and France only. Snapshot copies can be stored outside the EU. Source
- Public IPv6 and outbound IPv4. No dedicated IPv4. The IP changes at each resume. Source
- Hosts are AMD Ryzen 7 9700X and Ryzen 9 9950X. vCPUs are shared. No GPU. You cannot boot your own Docker image. Source
Questions people ask
Is Cloudflare Sandbox cheaper than CodeSandbox SDK?
In four of the five scenarios here, Cloudflare's estimate is lower, such as $148 against $341 a month for one agent that never stops, and $476 against $815 for sandboxes for your users. For 1,000 short jobs at once, CodeSandbox SDK's $1,632 is below Cloudflare's $1,889, though neither fits as is. boat is lower than both in four of the five, for example $26 and $200.
Which is faster?
We cannot compare CPU: neither is in StarSling's run. For start time, ComputeSDK measured median starts with 100 at once of 671 ms for Cloudflare and 11.76 s for CodeSandbox SDK (2026-11-06, default sizes).
Which one keeps my files?
Both can. CodeSandbox SDK keeps the disk and hibernates with memory, so a sandbox wakes with its processes running. Cloudflare keeps files when your code saves a snapshot (public beta, kept 30 days), schedules automatic saves, makes an R2 backup or works in a mounted R2 bucket. boat saves the disk every minute and at each stop with no code; a machine failure loses writes after the last good snapshot.
Can Cloudflare Sandbox and CodeSandbox SDK run Docker?
Both can. Cloudflare supports docker:dind with iptables and IP forwarding turned off, and CodeSandbox SDK runs Docker with root on VMs built from any Dockerfile. boat runs Docker with BuildKit and systemd and also exposes /dev/kvm.
Is CodeSandbox SDK still maintained?
CodeSandbox is now part of Together AI. Together's docs call the CodeSandbox-based SDK deprecated and name together-sandbox as its successor. The last SDK release was 2.4.2 in December 2025, and self-serve sign-up still runs through CodeSandbox.
Can I limit where a sandbox connects to?
On Cloudflare, yes: allowedHosts blocks every host not on your list, and outbound handlers can inspect and change each HTTP request. CodeSandbox SDK and boat do not offer a provider-side egress allowlist.
Try boat
Install the CLI, then run boat new.
7-day free trial
More comparisons
- boat vs Cloudflare Sandbox
- boat vs CodeSandbox SDK
- 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 Northflank
- Cloudflare Sandbox vs Fly.io Machines