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.

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 workloadCloudflare Sandbox: price rankCodeSandbox SDK: price rankboat: 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 requirementNot ranked: misses a requirementNot 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 requirementNot ranked: misses a requirementNot ranked: misses a requirement

Key features

FeatureCloudflare SandboxCodeSandbox SDKboat
IsolationFirecracker microVM per container, own kernel and networkFirecracker microVM per sandbox, own kernelFull VM with its own kernel, on a physical host dedicated to boat (AMD Ryzen 7 9700X or Ryzen 9 9950X); vCPUs are shared
Biggest machine4 vCPU / 12 GiB / 20 GB diskUp to 16 cores / 32 GB on Scale, 64 cores / 128 GB on Enterprise; 20 GB disk on every size16 vCPU / 32 GB / 251 GB disk (needs the $100 plan or higher)
Files between sessionsDisk is fresh after sleep; keep files with snapshots (public beta, 30 days), scheduled automatic saves, R2 backups or a mounted R2 bucketDisk kept; hibernates with a memory snapshotDisk saved every minute and at each stop, with no code; kept at least 14 days after a stop
Pause and resumeNo memory kept; a sleeping container starts again on the next requestResumes from a memory snapshot with processes still running, in about 0.5 to 2 sMemory not kept; resume boots the machine again with its disk in place
ForkSnapshot or back up a running sandbox, then start new sandboxes from it; no one-call forkFork a hibernated sandbox from its memory snapshot, or a running one sharing its memoryFork a running sandbox in one call, from its last 1-minute disk snapshot
Wake on requestYes; stops after inactivity and wakes on the next requestYes; an HTTP request to a host wakes a hibernated VMNo; you resume a stopped sandbox by API
Docker insidedocker:dind with iptables and IP forwarding turned offDocker and root; templates build from any DockerfileDocker with BuildKit and Compose, root and systemd; start from boat's image or a saved snapshot
Nested virtualizationNot documentedNot documentedYes, /dev/kvm for Android emulators and VMs
Inbound trafficHTTP and WebSocket previews routed through your Worker; SSH; no raw TCP inbound or public IPHTTPS host per port, public by default, signed tokens for private sandboxes; SSH, raw TCP and a public IP not documentedUp to 50 HTTPS URLs, token-gated by default; SSH; raw ports over public IPv6
Egress controlallowedHosts deny-by-default list plus outbound handlers in Worker codeNo provider-side allowlist documentedNo provider-side allowlist
Keeping keys out of the sandboxYour outbound handler adds the token for any HTTP or HTTPS host; you write the codeSecrets passed in as environment variables; no credentials proxy documentedOptional 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 browserBuilt-in desktop removed in SDK 0.10.2; headless browsers through the separate Browser Run serviceNo built-in desktop; a headless Chromium template, and you can install a VNC desktop in your own Dockerfile1920x1080, 60 fps desktop and Chrome, computer tools, embeddable stream
Coding agentsGuides for Claude Code, Codex, OpenCode and Pi in your imageYou install your own agent in the template and run it through the commands APISeven installed (Claude Code, Codex and more), with a prompt, steer and events API
RegionsSeveral regions across Cloudflare's network; pin to a region or jurisdictionA country hint steers scheduling; placement not guaranteedGermany, Finland and France; no US or Asia region; you cannot pick one
Every feature Battleships tracks (43)
FeatureCloudflare SandboxCodeSandbox SDKboat
Full VM (own kernel)YesYesYes
Docker insideYesYesYes
Nested virtualizationNo documented wayNo documented wayYes
RootYesYesYes
SystemdNot publishedNot publishedYes
Desktop GUINo documented wayWith your own setupYes
BrowserWith your own setupWith your own setupYes
Computer-use APINo documented wayNo documented wayYes
SSHYesNo documented wayYes
Persistent diskWith your own setupYesYes
Pause/resumeNo documented wayYesYes
Automatic snapshotsWith your own setupYesYes
Fork/cloneWith your own setupYesYes
Live fork (no pause)With your own setupYesYes
Memory forkNo documented wayYesNo documented way
Custom image (Docker or snapshot)YesYesYes
≥24 h sessionsYesYesYes
Idle auto-stopYesYesNo documented way
Wake on requestYesYesNo documented way
HTTPS preview URLsYesYesYes
Raw TCP inboundNo documented wayNo documented wayYes
Public IPv4No documented wayNo documented wayNo documented way
Egress allowlistYesNo documented wayNo documented way
Secret proxyYesNo documented wayYes
Secret proxy for any APIYesNo documented wayYes
Preinstalled agentsYesNo documented wayYes
Agent harness APIWith your own setupNo documented wayYes
MCP serverNo documented wayNo documented wayNo documented way
GPUNo documented wayNo documented wayNo documented way
WindowsNo documented wayNo documented wayNo documented way
Arm64No documented wayNo documented wayNo documented way
Self-hostingNo documented wayNo documented wayNo documented way
BYOCNo documented wayNo documented wayNo documented way
Open sourceYesNo documented wayNo documented way
Scoped API keysNot publishedNot publishedYes
Spend limitsNo documented wayNot publishedYes
Usage per sandbox (API)Not publishedNo documented wayYes
Audit logsYesNot publishedNo documented way
SSOYesYesNo documented way
SOC 2YesYesNo documented way
HIPAAYesNo documented wayNo documented way
EU data residencyYesNo documented wayNo documented way
Zero data retentionNot publishedNot publishedYes

Performance

Cloudflare SandboxNot measured
CodeSandbox SDKNot measured
boat28.06 runs/s

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.

ScenarioCloudflare Sandbox, a monthCodeSandbox SDK, a monthboat, 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.

ScenarioCloudflare SandboxCodeSandbox SDKboat
One coding agent, workdaysNone for this scenario
  • disk beyond 20 GiB: price unknown
  • egress price not published
None for this scenario
One agent that never stopsNone for this scenario
  • disk beyond 20 GiB: price unknown
  • egress price not published
None for this scenario
50 agents in parallelNone for this scenario
  • egress price not published
None for this scenario
Sandboxes for your usersNone for this scenario
  • Scale: max 250 concurrent
  • egress price not published
None for this scenario
1,000 short jobs at once
  • Workers Paid: max 1,500 vCPU running at once (needs 2,000)
  • Scale: max 250 concurrent
  • egress price not published
  • 2,400 starts/day included, paid above that (needs ~6,667)
  • 600 starts/hour included, paid above that (needs ~1,000)
  • starts above 90/min are paid, and starts above 270/min fail with 429

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