E2B vs Cloudflare Sandbox
Both run each sandbox in its own Firecracker microVM. E2B can pause a sandbox with its memory and bring it back in about a second, while Cloudflare Sandbox is a container inside the Workers platform that sleeps when idle and wakes on a fresh disk.
The companies and products
E2B
E2B calls itself the AI agent cloud: an API that gives each agent session its own isolated Linux machine.
Every E2B sandbox is a Firecracker microVM that boots from a snapshot, so it starts fast and can be paused and resumed with its memory. You build custom sandboxes from templates based on a Docker image, and drive them from Python or JavaScript SDKs. It is built for teams that run many short code, data or agent jobs, and its runtime is open source.
- Isolation
- Firecracker microVM per sandbox
- Bring your own cloud
- Enterprise data plane in your AWS, GCP or Azure account
- Compliance
- SOC 2 Type II; HIPAA BAA on request
- Machine size
- 1 to 8 vCPU and 1 to 8 GiB RAM, CPU only
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
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. “16th cheapest of 367” means 15 of the other 366 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 | E2B: price rank | Cloudflare Sandbox: price rank | bochka: price rank |
|---|---|---|---|
| Software factory 100 at once · 4 vCPU / 8 GB · 2,200 sessions of 8 h a month E2B fits a working day but stops at 24 hours on Pro; Cloudflare wipes the disk when the container sleeps, and bochka keeps the disk with no session cap. | 16th cheapest of 367 $4,143 a month | 162nd of 367, with limits $1,543 a month | 3rd cheapest of 367 $634 a month |
| Always-on AI employees 50 machines 24/7 · 2 vCPU / 4 GB An assistant that lives on its machine all month hits E2B's 24-hour cap and loses its files on Cloudflare after sleep; bochka simply keeps running. | 51st of 366, with limits $5,348 a month | 207th of 366, with limits $2,188 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 Short code runs suit both: Cloudflare Sandbox ranks 13th because CPU is billed only while busy, and E2B wakes a paused sandbox with its memory. | 37th cheapest of 345 $421 a month | 13th cheapest of 345 $144 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 All three fit sandboxes for your users; bochka ranks 1st, Cloudflare wakes on the next request, and E2B can resume a paused sandbox in about a second. | 23rd cheapest of 361 $2,354 a month | 9th cheapest of 361 $731 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 E2B ranks 2nd here: memory forks and a high start rate suit many short rollouts that branch from the same state. | 2nd cheapest of 360 $9,384 a month | 144th of 360, with limits $9,428 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 | 78th cheapest of 364 $1,975 a month | 45th cheapest of 364 $818 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 CI jobs that build Docker images or Android apps want full Docker and nested virtualization; bochka has both, E2B has no nested virtualization, and Cloudflare turns off iptables. | 337th of 377, with limits $1,429 a month | 301st of 377, with limits $704 a month | 4th cheapest of 377 $86 a month |
| 24/7 dev boxes 1 machine 24/7 · 4 vCPU / 8 GB A dev box that runs all month needs its files kept and no session cap; bochka has both, E2B stops at 24 hours, and Cloudflare starts from a fresh disk after sleep. | 192nd of 368, with limits $358 a month | 70th cheapest of 368 $93 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 E2B has a Linux desktop for computer use and bochka streams one at 60fps; Cloudflare removed its built-in desktop, so you bring your own. | 32nd cheapest of 369 $1,342 a month | 166th of 369, with limits $460 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 | 100th of 367, with limits $746 a month | 210th of 367, with limits $233 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 | 57th cheapest of 346 $554 a month | 250th of 346, with limits $286 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 | 227th of 338, with limits $9,223 a month | 169th of 338, with limits $5,741 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 | 11th cheapest of 360 $1,043 a month | 239th of 360, with limits $325 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 | E2B | Cloudflare Sandbox | bochka |
|---|---|---|---|
| Isolation | Firecracker microVM with its own kernel | Firecracker microVM per container, own kernel and network | Full VM with its own kernel on dedicated AMD Ryzen 9 9950X hosts |
| CPU benchmark (4 vCPU / 8 GB) | 12.61 runs/s | No result on this benchmark | 26.69 runs/s |
| Largest machine | Up to 8 vCPU / 8 GiB self-serve, more on request; 20 GiB disk on Pro | 4 vCPU / 12 GiB / 20 GB disk by default (can be raised) | Up to 16 vCPU / 32 GB, depending on plan |
| Session length | Up to 1 hour on Hobby, 24 hours on Pro; pausing resets the clock | No fixed maximum, but stops after inactivity and no runtime is guaranteed | No cap on paid plans; you set the time to live |
| Files between sessions | Pause saves memory and disk; resume takes about 1 second with processes running | Disk is fresh after sleep; snapshots (public beta, 30 days) or R2 backups when your code saves them | Disk saved every minute and on stop; resume boots the machine again |
| Fork a running sandbox | Yes, with its memory, up to 20 copies per call | No fork; restore a saved snapshot or backup into a new sandbox | Yes, with its disk, without stopping it |
| Sleep when idle | Auto-pause is opt-in; a paused sandbox wakes on the next HTTP request or SDK call | Stops after inactivity, wakes on the next request; CPU billed only while busy | TTL based (1 h default, changeable); started again by API |
| Docker and nested virtualization | Docker inside; nested virtualization not supported | docker:dind with iptables and IP forwarding turned off; nested virtualization not documented | Full Docker, root and systemd, plus /dev/kvm for Android emulators and VMs |
| Desktop and computer use | Linux desktop for computer use | Built-in desktop removed in SDK 0.10.2; bring your own | 60fps desktop and Chromium, computer-use API, embeddable stream |
| Inbound traffic | HTTPS URL per port, public by default unless you turn on a token; no dedicated IP | HTTP and WebSocket previews routed through your Worker; no raw TCP or public IP | HTTPS URLs for up to 50 ports, token-protected; raw TCP; dedicated IPv4 or IPv6 |
| Egress control | Allow and deny lists by IP, CIDR or domain | allowedHosts deny-by-default list plus outbound handlers you write in Worker code | Open internet, no provider-side allowlist |
| Keeping API keys out of the sandbox | Secrets injected into outbound HTTPS headers (private beta) | Your outbound handler adds the token for any HTTP or HTTPS host; you write the code | Managed proxy for model providers and any HTTPS API; switch a credential to another account when credits run out |
| Coding agents | Templates and guides for many agents, run through the command API | Run Claude Code, Codex, OpenCode or Pi in your image; OpenCode has an SDK helper | Seven agents preinstalled, with a prompt, steer and events API |
| Regions and self-hosting | US by default, EU and APAC on Pro via support; open-source runtime and bring your own cloud on Enterprise | Several regions across Cloudflare's network, nearest free one picked; platform cannot be self-hosted | EU only (Germany, Finland, France); no self-hosting |
Every feature Battleships tracks (43)
| Feature | E2B | Cloudflare Sandbox | bochka |
|---|---|---|---|
| Full VM (own kernel) | Yes | Yes | Yes |
| Docker inside | Yes | Yes | Yes |
| Nested virtualization | No | No | Yes |
| Root | Yes | Yes | Yes |
| Systemd | Yes | Not published | Yes |
| Desktop GUI | Yes | No | Yes |
| Browser | Yes | No | Yes |
| Computer-use API | Yes | No | Yes |
| SSH | Yes | Yes | Yes |
| Persistent disk | Yes | No | Yes |
| Pause/resume | Yes | No | Yes |
| Automatic snapshots | Yes | No | Yes |
| Fork/clone | Yes | No | Yes |
| Live fork (no pause) | Yes | No | Yes |
| Memory fork | Yes | No | No |
| Custom image (Docker or snapshot) | Yes | Yes | Yes |
| ≥24 h sessions | Yes | Yes | Yes |
| Idle auto-stop | Yes | Yes | No |
| Wake on request | Yes | Yes | No |
| HTTPS preview URLs | Yes | Yes | Yes |
| Raw TCP inbound | No | No | Yes |
| Public IPv4 | No | No | No |
| Egress allowlist | Yes | Yes | No |
| Secret proxy | Yes | Yes | Yes |
| Secret proxy for any API | Yes | Yes | Yes |
| Preinstalled agents | Yes | Yes | Yes |
| Agent harness API | No | Yes | Yes |
| MCP server | Yes | No | No |
| GPU | No | No | No |
| Windows | No | No | No |
| Arm64 | No | No | No |
| Self-hosting | Yes | No | No |
| BYOC | Yes | No | No |
| Open source | Yes | Yes | No |
| Scoped API keys | Not published | Not published | Yes |
| Spend limits | Yes | No | Yes |
| Usage per sandbox (API) | No | Not published | Yes |
| Audit logs | Not published | Yes | No |
| SSO | No | Yes | No |
| SOC 2 | Yes | Yes | No |
| HIPAA | Yes | Yes | No |
| EU data residency | Yes | Yes | Yes |
| Zero data retention | Not published | Not published | Yes |
Performance
On the hpc-sandbox-benchmarks Node.js build-and-test loop at 4 vCPU / 8 GB, in the same run, bochka did 26.69 runs per second and E2B did 12.61, so bochka finished about twice as much CPU work in the same time. Cloudflare Sandbox has no result on that benchmark, so there is no comparable CPU number for it. This measures CPU speed only, not start time.
Node.js build-and-test loop at 4 vCPU / 8 GB, higher is better. Measured with the open hpc-sandbox-benchmarks suite. Cloudflare Sandbox has 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 | E2B, a month | Cloudflare Sandbox, a month | bochka, 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 | $202 · Pro | $39 · Workers Paid · with limits | $20 · $20/mo |
| One agent that never stops 4 vCPU / 8 GB, 50 GB disk, running 24/7 all month | $368 · Pro · with limits | $148 · Workers Paid · 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 | $2,773 · Pro | $1,660 · Workers Paid · with limits | $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 | $1,395 · Pro+ (600 concurrent) | $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 | $2,797 · Pro++ (1,100 concurrent) | $1,889 · Workers Paid · with limits | $2,000 · $2000/mo · with limits |
E2B: E2B bills per second for the vCPU and RAM you set, idle time included, until you pause or kill the sandbox. Pro costs $150 a month for higher limits with no usage credit, and more concurrency costs $500 a month per 500 slots.
Cloudflare Sandbox: Cloudflare needs Workers Paid ($5 a month minimum). CPU is billed only while busy, while memory and disk are billed on the instance size until the container sleeps, and 4 vCPU always comes with 12 GiB.
Cloudflare Sandbox: Durable Object and Worker requests are billed on top, and egress is free up to 1 TB in North America and Europe, then $0.025 per GB.
Cloudflare Sandbox: Plans start at $20 a month, and the whole fee is usage credit. You pay per second while a sandbox runs, and a stopped sandbox costs nothing and keeps its disk.
Limits in those scenarios
Cloudflare's disk resets after sleep, so the coding-agent, always-on and 50-agent scenarios do not fit without your own snapshot or backup code. E2B caps a session at 24 hours on Pro, which rules it out for the agent that never stops, and its price for disk beyond 20 GiB is not published. For 1,000 short jobs at once, E2B Pro++ fits but queues bursts above 300 starts a minute, while Cloudflare's default 1,500 vCPU account limit is short of the 2,000 vCPU needed and bochka's $2,000 plan caps starts per hour and per day.
| Scenario | E2B | Cloudflare Sandbox | bochka |
|---|---|---|---|
| One coding agent, workdays |
|
| 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 E2B when
you run many short jobs that pause between requests and must resume with their memory, need big bursts, or want to self-host.
- Memory pause, fork and wake. For jobs that sleep between requests: a paused sandbox comes back in about a second with its processes still running, and can fork.
- Big bursts of short jobs. E2B Pro++ fits 1,000 short jobs at once, where Cloudflare's default account limit of 1,500 vCPU running falls short.
- Open source and your own cloud. Its runtime is Apache-2.0, and Enterprise customers can run it in their own AWS, GCP or Azure account.
Use Cloudflare Sandbox when
your app already runs on Workers and you want short sandboxes that sleep when idle, bill CPU only while busy, and follow egress rules you code.
- CPU billed only while busy. For many short, spiky sessions: a sandbox sleeps when idle, wakes on the next request, and bills CPU only while it works.
- Egress rules you can program. Cloudflare can block every host except the ones you list, and run your own Worker code on each outbound request.
- Next to the rest of Workers. If your app already runs on Workers, sandboxes sit next to Durable Objects and R2, in several regions.
Where bochka fits
Both E2B and Cloudflare Sandbox are built around short sessions: E2B stops at 24 hours, and Cloudflare sleeps and forgets its disk. If your agents work for hours on builds, tests, Docker, emulators and a browser, bochka gives each one a full, faster VM that keeps its files and never cuts it off.
Work that lasts
E2B stops a session at 24 hours on Pro, so your code must pause and resume it. Cloudflare wipes the disk on sleep unless your code saves a snapshot, which is in beta and expires after 30 days. bochka saves the disk every minute.
A whole, fast machine
Neither offers nested virtualization, so Android emulators and VMs will not start, and Cloudflare runs Docker with iptables off on 20 GB of disk. bochka is a full VM with /dev/kvm and systemd, and did 26.69 runs/s to E2B's 12.61.
Agents and keys built in
On Cloudflare you bake each agent into your image and write the handler that adds every token; on E2B secret injection is a private beta. bochka ships seven agents you drive from outside and a credentials proxy for any HTTPS API.
Use bochka when your agents do real work for hours: installs, builds, full Docker, emulators and a desktop, on a fast machine that keeps its files and never cuts them off. Compare it one to one: bochka vs E2B and bochka vs Cloudflare Sandbox.
Questions people ask
Is E2B cheaper than Cloudflare Sandbox?
No. Cloudflare's estimate is lower in all five scenarios on this page, for example $476 a month against $1,395 for sandboxes for your users. But Cloudflare only fits that one scenario, because its disk resets after sleep and its default vCPU limit is too low for 1,000 jobs at once.
Which is faster, E2B or Cloudflare Sandbox?
E2B did 12.61 runs per second on the hpc-sandbox-benchmarks CPU test at 4 vCPU / 8 GB, and Cloudflare has no result on that test, so they cannot be compared. bochka did 26.69 in the same run.
Can E2B and Cloudflare Sandbox run Docker?
Both run Docker inside the sandbox. Cloudflare uses docker:dind with iptables and IP forwarding turned off, and E2B does not support nested virtualization. bochka runs full Docker and exposes /dev/kvm for Android emulators and VMs.
Does Cloudflare Sandbox keep files like E2B?
Only while the container runs. When it sleeps, the next start uses a fresh disk unless your code saved a snapshot (public beta, kept 30 days) or a backup to R2. E2B keeps memory and disk when it pauses, and bochka keeps the disk on its own.
Can a sandbox run for days on E2B or Cloudflare?
Not in one E2B session: it stops after 24 hours on Pro and 1 hour on Hobby, though pausing resets the clock. Cloudflare sets no fixed maximum but stops idle containers and does not guarantee any runtime. bochka has no session cap on paid plans.
Can I limit where a sandbox connects to?
Yes on both. E2B has allow and deny lists by IP, CIDR or domain, and Cloudflare has an allowedHosts list plus outbound handlers you write in Worker code. bochka does not offer a provider-side egress allowlist today.
Try bochka
Install the CLI, then run bochka new.
Product preview