Modal vs Cloudflare Sandbox

Modal runs sandboxes under gVisor or a VM runtime inside a big AI compute platform with GPUs, and ends each one within 24 hours; filesystem snapshots carry work to a new sandbox. Cloudflare runs each sandbox as a container in its own Firecracker microVM behind your Worker. It sleeps when idle, wakes on the next request, and keeps files through snapshots or R2 that your code sets up.

The companies and products

Modal

Modal is a serverless cloud for AI work: inference, training, batch jobs and sandboxed code, all driven from Python, TypeScript or Go code.

Modal Sandboxes are containers you create from code, run commands in, and then terminate. By default they run under gVisor, a user-space kernel from Google. Since October 2026 you can also pick a VM runtime with its own Linux kernel for Docker and FUSE (Battleships tracks that as a separate card, Modal VM Sandboxes). Your code can save a sandbox's disk as a filesystem snapshot and start new sandboxes from it. It suits teams that already run models on Modal and want scalable code execution next to their GPUs.

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.

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. “15th cheapest of 336” means 14 of the other 335 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 workloadModal: price rankCloudflare Sandbox: price rankboat: price rank
Software factory
100 at once · 4 vCPU / 8 GB · 2,200 sessions of 8 h a month
106th of 365, with limits
$633 a month
192nd of 365, with limits
$1,543 a month
5th cheapest of 365
$634 a month
Always-on AI employees
50 machines 24/7 · 2 vCPU / 4 GB
Cloudflare ranks #43 here at $2,188 a month: your code keeps files with snapshots or R2. An always-on agent hits Modal's 24-hour limit, so your code snapshots the filesystem and starts a new sandbox each day. boat ranks #6 at $657, with no session cap once auto-stop is off on a paid plan.
61st of 361, with limits
$1,574 a month
43rd cheapest of 361
$2,188 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 well. Modal ranks #15 here at $140 a month and starts sandboxes fast at high concurrency. Cloudflare ranks #17 at $144, bills CPU only while busy and wakes on request.
15th cheapest of 336
$140 a month
17th cheapest of 336
$144 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
Both fit sandboxes for your users: Modal at $671 a month and Cloudflare at $731. boat ranks #3 at $209; a stopped boat sandbox has no compute charge and keeps its disk for at least 14 days.
18th cheapest of 349
$671 a month
19th cheapest of 349
$731 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
RL rollouts launch many short sandboxes at once, which is what Modal is built for: it ranks #6 here. Cloudflare's default 1,500 vCPU account limit gets in the way at that scale, until Cloudflare raises it.
6th cheapest of 349
$11,982 a month
147th of 349, with limits
$9,428 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
62nd cheapest of 359
$889 a month
60th cheapest of 359
$818 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
CI jobs that build Docker images run on Modal with runtime="vm", at $1,112 a month. Cloudflare runs docker:dind with iptables off and 20 GB of disk at most, so it is a compromise here. boat ranks #2 at $86, with full Docker in every sandbox.
110th cheapest of 374
$1,112 a month
303rd of 374, with limits
$704 a month
2nd cheapest of 374
$86 a month
24/7 dev boxes
1 machine 24/7 · 4 vCPU / 8 GB
A dev box needs its files after you log off. Cloudflare ranks #123 here at $93 a month; your code snapshots the disk or mounts R2. On Modal your code restores the root disk from a filesystem snapshot at least once a day. boat ranks #19 at $26 and keeps its disk with no code.
129th of 371, with limits
$9.07 a month
123rd cheapest of 371
$93 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
Modal ranks #45 here at $153 a month: its official example installs Xvfb, Chromium and noVNC in a VM sandbox. Cloudflare removed its built-in desktop in SDK 0.10.2; you build one into your own image. boat ranks #7 at $200, with a 60 fps desktop and computer tools built in.
45th cheapest of 367
$153 a month
207th of 367, with limits
$460 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
57th of 356, with limits
$121 a month
68th of 356, with limits
$233 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
98th cheapest of 343
$252 a month
102nd cheapest of 343
$286 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
171st of 327, with limits
$5,957 a month
168th of 327, with limits
$5,741 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
289th of 351, with limits
$464 a month
25th cheapest of 351
$325 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
Modal has GPUs from T4 to B300 and neither Cloudflare nor boat has any, so Modal is the pick for GPU jobs.
18th cheapest of 102
$1,116 a month
Not 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

FeatureModalCloudflare Sandboxboat
IsolationgVisor by default; VM runtime with its own kernel available (Modal VM Sandboxes)Firecracker microVM per container, own kernel and networkFull VM with its own kernel, on AMD Ryzen 7 9700X and Ryzen 9 9950X hosts; vCPUs are shared
Docker insideYes with the VM runtime (runtime="vm"), at the same price; not documented on gVisordocker:dind with iptables and IP forwarding turned offFull Docker with BuildKit and Compose, root and systemd in every sandbox
Nested virtualizationVM runtime only, Enterprise plan, as an experimental optionNot documentedYes, /dev/kvm (Android emulators, VMs)
Files between sessionsRoot disk ends with the sandbox; filesystem or directory snapshots (30 days by default, custom TTL or no expiry) or Volumes keep filesDisk is fresh after sleep; snapshots (public beta, 30 days), scheduled automatic saves, R2 backups or a mounted R2 bucket keep filesDisk saved every minute and at each stop, with no code; kept at least 14 days after a stop, longer as a saved snapshot
Longest session24 hours (default 5 minutes); for longer work, a filesystem snapshot and a new sandboxNo fixed maximum, but no guaranteed runtime; host restarts can stop a containerNo cap once auto-stop is off on a paid plan (default 1 hour, timer up to 30 days)
Fork and snapshotsOne filesystem snapshot boots many new sandboxes; memory snapshots in alpha (they end the sandbox)Snapshot or back up a running sandbox, then start new sandboxes from it (snapshots public beta, 30 days); no one-call forkFork a running sandbox in one call, from its last 1-minute snapshot; no memory snapshots
Largest machineNot published (Modal says a maximum is enforced); 512 GiB disk by default4 vCPU / 12 GiB / 20 GB diskUp to 16 vCPU / 32 GB / 251 GB disk on the $100 plan and above
GPUsT4 to B300; 10 at once on Starter, 50 on TeamNoneNone
Desktop and browserYou set it up: Modal's official example installs Xvfb, Chromium, x11vnc and noVNC in a VM sandboxBuilt-in desktop removed in SDK 0.10.2; build one into your image, or use the separate Browser Run service for headless browsers1920x1080, 60 fps desktop and Chrome, computer tools, embeddable stream
Coding agentsYou install the harness in the image (official OpenCode example)Guides for Claude Code, Codex, OpenCode and Pi in your image; OpenCode has an SDK helperSeven harnesses installed, including Claude Code, Codex, pi and OpenCode, with a prompt, steer and events API
Keeping keys out of the sandboxSecrets are environment variables, or you run your own proxy in a sidecar (beta)Your outbound handler adds the token for any HTTP or HTTPS host; you write the codeOptional paid proxy ($1 a day while on, plus $1 per 1,000 requests) for model providers and custom HTTPS APIs; switch a credential to another account
Inbound trafficEncrypted and raw TCP tunnels, connect tokens, inbound IP allowlistHTTP and WebSocket previews routed through your Worker; SSH; no raw TCP inbound or public IPHTTPS URLs for up to 50 ports, token-gated by default; SSH; raw ports over IPv6 on sandboxes with no IPv4 of their own
Egress controlBlock all, IP-range allowlist, domain allowlist (beta)allowedHosts deny-by-default list plus outbound handlers you write in Worker codeNo provider-side allowlist
Idle behavior and regionsIdle sandboxes pay until terminated; US, EU and Asia-Pacific, pinning costs 1.15x to 1.75xSleeps after inactivity and wakes on the next request; several regions across Cloudflare's network, pin to a region or jurisdictionAuto-stop timer, not an idle timer; no compute charge while stopped; Germany, Finland and France, no region choice
Every feature Battleships tracks (43)
FeatureModalCloudflare Sandboxboat
Full VM (own kernel)No documented wayYesYes
Docker insideNo documented wayYesYes
Nested virtualizationNo documented wayNo documented wayYes
RootYesYesYes
SystemdNo documented wayNot publishedYes
Desktop GUIWith your own setupNo documented wayYes
BrowserWith your own setupWith your own setupYes
Computer-use APIWith your own setupNo documented wayYes
SSHWith your own setupYesYes
Persistent diskWith your own setupWith your own setupYes
Pause/resumeNo documented wayNo documented wayYes
Automatic snapshotsNo documented wayWith your own setupYes
Fork/cloneYesWith your own setupYes
Live fork (no pause)Not publishedWith your own setupYes
Memory forkYesNo documented wayNo documented way
Custom image (Docker or snapshot)YesYesYes
≥24 h sessionsYesYesYes
Idle auto-stopYesYesNo documented way
Wake on requestNo documented wayYesNo documented way
HTTPS preview URLsYesYesYes
Raw TCP inboundYesNo documented wayYes
Public IPv4No documented wayNo documented wayNo documented way
Egress allowlistYesYesNo documented way
Secret proxyNo documented wayYesYes
Secret proxy for any APINo documented wayYesYes
Preinstalled agentsWith your own setupYesYes
Agent harness APINo documented wayWith your own setupYes
MCP serverNo documented wayNo documented wayNo documented way
GPUYesNo 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 sourceNo documented wayYesNo documented way
Scoped API keysNot publishedNot publishedYes
Spend limitsNot publishedNo documented wayYes
Usage per sandbox (API)Not publishedNot publishedYes
Audit logsYesYesNo documented way
SSOYesYesNo documented way
SOC 2YesYesNo documented way
HIPAAYesYesNo documented way
EU data residencyYesYesNo documented way
Zero data retentionNot publishedNot publishedYes

Performance

Modal12.60 runs/s
Cloudflare SandboxNot measured
boat28.06 runs/s

In StarSling's run of 3 October 2026 (run 37073680030), the V8 Web Tooling Benchmark at 4 vCPU / 8 GB did 28.06 runs/s on boat, 15.48 on Modal's VM runtime and 12.60 on Modal gVisor. StarSling ran Modal with cpu=4, and the sandbox saw 4 CPUs (PR #121). Every boat sandbox in that run ran on an AMD Ryzen 9 9950X host; boat also places some sandboxes on other hosts, and does not promise a CPU model. Providers ran on different hardware in different regions. Cloudflare is not in that run, so there is no comparable CPU number for it. For start time, ComputeSDK measured 100 sandboxes started at once on 6 November 2026, at each provider's default size: Cloudflare 671 ms median and Modal 796 ms. boat is not in ComputeSDK.

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. Modal measured on: Sandbox (gVisor), request = size, any region. 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 is 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.

ScenarioModal, a monthCloudflare Sandbox, 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
$0 · Starter$39 · Workers Paid$20 · $20/mo
One agent that never stops
4 vCPU / 8 GB, 50 GB disk, running 24/7 all month
$109 · Starter · with limits$148 · Workers Paid$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,480 · Starter · with limits$1,660 · Workers Paid$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
$579 · Team$476 · Workers Paid$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,911 · Team · with limits$1,889 · Workers Paid · with limits$8,800 · $2000/mo · with limits

Modal: Modal bills by the second for whichever is higher, the CPU and memory you request or what you use, and an idle sandbox pays until it is terminated. Modal prices CPU per physical core, and one core equals 2 vCPU, so 4 vCPU / 8 GiB costs $0.476 an hour at a full request. StarSling ran Modal with cpu=4 (PR #121); sized that way, Modal bills 4 cores, $0.76 an hour. Starter is free with $30 of monthly credit; Team is $250 a month with $100 of credit.

Cloudflare Sandbox: Cloudflare needs Workers Paid ($5 a month minimum). CPU is billed only while busy, at $0.072 per vCPU-hour. Memory and disk are billed on the instance size until the container sleeps, including the idle wait before it sleeps. 4 vCPU always comes with 12 GiB. Snapshot pricing is not published.

Cloudflare Sandbox: 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 costs no machine time and keeps its disk at least 14 days. Saved snapshots above the included count ($0.056 a day each) and the AI proxy, if on, still bill while sandboxes are stopped. Starts above the plan's included number cost $0.03 to $0.07 each.

Limits in those scenarios

Modal ends a sandbox within 24 hours, and keeps files only in snapshots or Volumes your code saves. The 50-agent fleet needs Modal's VM runtime for Docker; the default gVisor sandbox does not document it. Cloudflare starts from a fresh disk after sleep, so the scenarios that keep files between days need your own snapshot, automatic-save or R2 code. Its default 1,500 vCPU account limit is short of the 2,000 vCPU the 1,000-job burst needs, though Cloudflare raises it on request. On boat, that burst runs into start limits: the $2,000 plan includes 90 starts a minute, extra starts cost $0.03 to $0.07, and starts above 270 a minute fail with 429 (docs.boat.dev/limits).

ScenarioModalCloudflare Sandboxboat
One coding agent, workdaysNone for this scenarioNone for this scenarioNone for this scenario
One agent that never stops
  • Starter: sessions capped at 24 h
None for this scenarioNone for this scenario
50 agents in parallel
  • missing Docker inside
None for this scenarioNone for this scenario
Sandboxes for your usersNone for this scenarioNone for this scenarioNone for this scenario
1,000 short jobs at once
  • shared vCPUs on this tier (Modal sells dedicated cores separately as “Sandbox (gVisor), request = size, any region”): heavy, sustained CPU use can be slowed by other tenants
  • Workers Paid: max 1,500 vCPU running at once (needs 2,000)
  • 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 Modal when

your sandboxes need GPUs, or are huge bursts of short jobs next to models you already run on Modal.

  • GPUs next to your sandboxes. Useful if your agent trains or runs models: Modal rents GPUs from T4 to B300 on the same platform as its sandboxes.
  • Huge bursts of short jobs. Modal runs up to 5,000 containers on Team with fast starts, and memory snapshots are in alpha.
  • Raw TCP and a VM option. Modal offers raw TCP tunnels, and its VM runtime gives a real kernel for Docker and FUSE when you need it.

Use Cloudflare Sandbox when

your app already runs on Workers and you want short sandboxes that sleep when idle, wake on request and follow egress rules you write.

  • 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.
  • Egress rules you can program. Cloudflare can block every host except the ones you list, and run your own code on each outbound request.
  • Next to your Workers app. If your app already runs on Workers, sandboxes sit next to Durable Objects and R2, in a region you can pick.

Where boat fits

Modal and Cloudflare both shine at short sandboxes that come and go. If your agents work for hours or days, building, testing, running Docker and checking a UI, look at boat. Each one gets a full VM that saves its disk with no code, has no compute charge while stopped, and has agents and a desktop ready.

A disk kept with no code

Modal ends a sandbox within 24 hours, and Cloudflare starts from a fresh disk after sleep. On both, your code saves files to snapshots, Volumes or R2, or the agent reinstalls everything. boat saves the disk every minute and at each stop. Writes from the last minute can be missing after a machine failure.

A whole machine with a screen

Docker on Modal needs the VM runtime. Cloudflare runs Docker with iptables off in 20 GB of disk. On both you build the desktop yourself; Modal publishes an example for it. boat gives full Docker, /dev/kvm and a 60 fps desktop with computer use in every sandbox.

Agents and keys handled for you

On Modal and Cloudflare you bake each coding agent into your image, and keep keys in env vars or write your own sidecar or outbound handler. boat ships Claude Code, Codex and others with one API. Its optional paid proxy keeps supported providers' keys out of the sandbox.

Use boat when your agents work for hours or days: installs, builds, tests, full Docker and a desktop, on a VM that saves its disk with no code. Turn auto-stop off on a paid plan for long work (default 1 hour). Compare it one to one: boat vs Modal and boat vs Cloudflare Sandbox.

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 Modal cheaper than Cloudflare Sandbox?

It depends on the job. For one agent on workdays, Modal costs $0 inside its $30 Starter credit, against $39 on Cloudflare. For one agent that never stops, Modal costs $109 against $148, but Modal needs a new sandbox each day. For 50 parallel agents, Modal costs $1,480 against $1,660, and for sandboxes for your users $579 against $476. boat costs $20, $26, $317 and $200 for those four.

Which is faster, Modal or Cloudflare Sandbox?

There is no comparable CPU number: Cloudflare is not in the public CPU benchmark we use. In StarSling's run of 3 October 2026, Modal's VM runtime did 15.48 runs/s and its gVisor runtime 12.60 on the V8 Web Tooling Benchmark at 4 vCPU / 8 GB; boat did 28.06 on an AMD Ryzen 9 9950X host. For 100 sandboxes started at once, ComputeSDK measured Cloudflare at 671 ms median and Modal at 796 ms on 6 November 2026.

Can Modal or Cloudflare Sandbox run Docker?

Modal runs Docker with its VM runtime (runtime="vm"), at the same price; its default gVisor runtime does not document Docker. Cloudflare supports docker:dind with iptables and IP forwarding turned off. Every boat sandbox runs Docker with BuildKit and Compose, with root and systemd.

Do they keep my files?

Yes, if your code saves them. A Modal sandbox's root disk ends with it unless your code saves a filesystem snapshot or writes to a Volume. A Cloudflare sandbox starts from a fresh disk after sleep unless your code saved a snapshot, an automatic save or an R2 backup, or works in a mounted R2 bucket. boat saves the disk every minute and at each stop with no code, and keeps it at least 14 days after a stop.

Which one has GPUs?

Modal, with GPUs from T4 to B300. Cloudflare Sandbox has none, and neither does boat.

How long can a sandbox run?

Modal caps a sandbox at 24 hours, with a 5-minute default; for longer work, Modal recommends a filesystem snapshot and a new sandbox. Cloudflare sets no fixed maximum but does not guarantee any runtime, and stops idle containers. On boat, auto-stop defaults to 1 hour; turn it off on a paid plan for no session cap.

Try boat

Install the CLI, then run boat new.

7-day free trial

More comparisons