
Best code sandboxes for AI agents and apps that run user code
On this page
The short version
For short runs your app starts from an SDK, pick E2B: a sandbox pauses with its memory and forks mid-run. Pick Daytona for long runs, big machines, Windows, macOS or GPUs that aren't preempted, and Modal Sandboxes for GPU fan-out from Python with a credit that renews every month. If your app already runs on Vercel or Cloudflare, their sandboxes bill CPU only while it's busy. Pick Blaxel for agents that sleep between calls and wake with their memory, and Northflank for sandboxes with no time limit, beside your services or in your own cloud. Heaven keeps one machine per agent instead of starting fresh runs, so it isn't ranked here.
How to choose
Five questions decide most of it, and the first two matter most.
- How long does one run last? E2B Hobby stops a run at 1 hour and Vercel Hobby at 45 minutes. Daytona and Modal allow 24 hours with no monthly fee, Blaxel keeps a sandbox for 7 days on its first tier, and Northflank sets no limit.
- What has to survive the run? E2B's pause and Blaxel's standby keep memory and running processes. Vercel, Modal and Cloudflare bring files back into a new machine, and Daytona and Northflank keep only what you put on a volume.
- Is the sandbox busy or waiting? A task that waits on a model costs less on Vercel and Cloudflare, which bill CPU only while it's busy, or on E2B and Blaxel if it pauses between calls. A sandbox that stays busy costs least on Northflank, then about the same on E2B, Daytona and Blaxel.
- Does it need a GPU, Windows or macOS? Modal, Daytona and Northflank have GPUs. Only Daytona runs Windows and macOS.
- Where does the rest of your stack run? Vercel and Cloudflare sandboxes are driven from apps on those platforms, and Northflank runs beside your services or in your own cloud.
If the agent keeps one machine for weeks and serves what it builds, that isn't a sandbox job. See Heaven at the end of this list, or best persistent VMs for coding agents.
The best code sandboxes compared
| Product | Best for | Longest run | Kept after a run | While it waits |
|---|---|---|---|---|
| E2B | Short runs from an SDK that pause and fork | 1 hour, 24 on Pro | Everything, if paused | No compute charge paused |
| Daytona | Big machines, GPUs, Windows and macOS | 24 hours, 48 on Team | Volumes and snapshots only | Billed at the reservation while running |
| Modal Sandboxes | GPU fan-out from Python, in 19 locations | 24 hours | Snapshots, into a new Sandbox | Billed at the request while running |
| Vercel Sandbox | Apps on Vercel, tasks that mostly wait | 45 minutes, 24 hours on Pro | Files, in a fresh VM | Memory billed, CPU only while busy |
| Blaxel | Agents that wait between calls | 7 days on Tier 0, 30 on Tier 1 | Everything, in standby | Standby: storage only |
| Northflank | Long-lived sandboxes beside your services | No limit | Mounted volumes only | Billed while running, busy or idle |
| Cloudflare Sandbox | Commands from a Cloudflare Worker | While active, then up to 6 idle hours | Files, in a beta snapshot | Memory billed, CPU only while busy |
| Product | Isolation | GPUs | Free usage | Driven from |
|---|---|---|---|---|
| E2B | Firecracker microVM | No | $100 once, commercial use allowed | Python and TypeScript SDKs |
| Daytona | Firecracker microVM. Windows and GPUs in VMs | YesH100 to B300 and AMD MI355X | $200 once, GPUs excluded | Python and TypeScript SDKs |
| Modal Sandboxes | gVisor container or a VM | YesT4 to B300. Can be preempted | Yes$30 every month | Python. JavaScript and Go in beta |
| Vercel Sandbox | MicroVM | No | Hobby quotas, non-commercial only | TypeScript and Python SDKs |
| Blaxel | Firecracker-based microVM | No | Up to $200 of credits | Python, TypeScript and Go SDKs |
| Northflank | MicroVM on CPU, gVisor on GPU | YesL4 to B200 | Yes$20 of resources every month | JavaScript and Python SDKs |
| Cloudflare Sandbox | Firecracker microVM | No | Included usage on the $5 Workers Paid plan | TypeScript, inside a Worker |
All seven take your own container image and serve an exposed port at an HTTPS address while the sandbox runs.
The options
E2B for short runs that pause and fork
E2B starts a Firecracker microVM from its Python or TypeScript SDK, and a full pause keeps files, memory and processes with no expiry while compute billing stops. Auto-resume wakes a paused sandbox when a request reaches it, a fork copies a running one into up to 20, and the Code Interpreter SDK keeps variables and returns charts as data. Hobby allows commercial use, but stops a run at 1 hour, runs 10 at once and offers only the default 2 vCPU, 512 MiB size. Pro allows 24 hours, 100 at once and sizes up to 8 vCPUs and 8 GiB for $150 a month. See E2B alternatives.
Daytona for big machines, GPUs, Windows and macOS
Daytona runs Linux sandboxes on x86 or Arm, Windows, macOS and dedicated GPUs from Python and TypeScript SDKs, with interpreter contexts and computer-use APIs. Starter has no monthly fee, allows any size up to 64 cores and 128 GiB and sessions up to 24 hours, and gives $200 of credit once, GPUs excluded. Team, at $250 a month, raises sessions to 48 hours and makes GPUs non-preemptible. A Linux sandbox is deleted when its session ends, so keep results on a volume or in a snapshot. See Daytona alternatives.
Modal Sandboxes for GPU fan-out from Python
Modal starts Sandboxes from Python, or JavaScript and Go in beta, with GPUs from a T4 to a B300 billed by the second, and includes $30 of compute every month on Starter. Sandboxes can be pinned to 19 locations, and tunnels expose raw TCP as well as HTTPS. A Sandbox stops after 5 minutes by default and 24 hours at most, GPU Sandboxes can be preempted, and memory snapshots are in alpha. See Modal Sandboxes alternatives.
Vercel Sandbox for apps on Vercel
Vercel Sandbox gives each session a microVM from a TypeScript or Python SDK and bills CPU only while it's busy, so a task waiting on a model pays mostly for memory. A named sandbox saves its files when it stops and loads them into a fresh VM, so processes start again, and the firewall can match HTTP method, path and headers. Sessions last 45 minutes on Hobby, which is for non-commercial use, and 24 hours on Pro at $20 a month. An exposed port's URL is open to anyone who has it. See E2B vs Vercel Sandbox.
Blaxel for agents that wait between calls
Blaxel moves a sandbox to standby about 15 seconds after its last connection closes, stops the compute bill and resumes it with memory and processes on the next request, in under 25 ms by Blaxel's figure. Active time bills by allocated memory, CPU follows the memory size, and egress is included. Tier 0 keeps a sandbox for up to 7 days and Tier 1 for 30, and an agent working inside one needs a keep-alive process to stay active. See Heaven vs Blaxel.
Northflank for sandboxes beside your services
Northflank runs sandboxes with no time limit beside your app's services, jobs and databases, in 17 managed regions or in your own cloud or Kubernetes cluster. CPU sandboxes are microVMs and GPU sandboxes use gVisor, with GPUs from an L4 to a B200 once you prepay $50 of credit, and its CPU and memory rates are the lowest on this list. A sandbox bills while it runs, busy or idle, and pausing wipes its root disk and processes, so keep files on a mounted volume. The free Sandbox plan includes $20 of resources a month and 2 services. See Heaven vs Northflank.
Cloudflare Sandbox for commands from a Worker
Cloudflare Sandbox runs a Linux container in its own Firecracker microVM, controlled from a Worker through a TypeScript SDK, and bills memory and disk while it runs and CPU only while it's busy. It stays up while its Durable Object is active and then up to 6 idle hours, and the agent's own processes don't count as activity. When it stops, processes, memory and unsaved files are gone, and a beta snapshot brings files back into the next instance. Instances default to at most 4 vCPUs and 12 GiB, in nine regions, on the $5 Workers Paid plan.
Also consider Heaven
Heaven, which we make, is cloud infrastructure for software factories. Each agent or app gets a Computer: a full Linux VM with root that keeps running with nobody connected, and a team's Computers share one pool of CPU, memory and storage. Every Computer comes with an HTTPS website with sign-in in front, share links, custom domains, public TCP ports, email, snapshots and hourly off-site backups, and integrations keep GitHub and API credentials outside the machine. Plans start at $20 a month for 2 vCPUs and 8 GiB, with any number of members. See pricing.
Pricing
| Product | Entry plan | What it costs |
|---|---|---|
| E2B | Hobby | $0 plus usage, about $0.11 an hour for the default sandbox, with $100 of credit once. Pro is $150 a month |
| Daytona | Starter | $0 plus usage, with $200 of credit once. Team is $250 a month |
| Modal Sandboxes | Starter | $0 plus usage, with $30 of compute every month. Team is $250 a month |
| Vercel Sandbox | Hobby, non-commercial | $0 within its quotas. Pro is $20 a month with $20 of usage |
| Blaxel | Pay as you go | $0 plus active time, about $0.041 a GB-hour of memory, with up to $200 of credits |
| Northflank | Sandbox | $0 with $20 of resources a month, then $0.0167 a vCPU-hour and $0.0083 a GB-hour |
| Cloudflare Sandbox | Workers Paid | $5 a month with some container usage included, then active CPU, memory and disk |
300 short runs. Take 300 fresh runs a month, each 10 minutes long with 2 vCPUs, 512 MiB and 2 minutes of busy CPU: 50 hours of sandbox time. E2B Hobby costs $5.45 and Daytona Starter $5.46. Modal's $7.70 fits its monthly credit, so $0, and Northflank's $1.88 fits its free allowance. Cloudflare costs $5.27 on Workers Paid, including its $5 fee, and Blaxel about $2.07 for each GB of memory a run gets. Vercel needs Pro at $20, because the runs use 10 hours of busy CPU against Hobby's 5.
Sixty 2-hour agent runs. At 2 vCPUs and 4 GiB, with the CPU busy half the time, that's 120 hours. E2B needs Pro for the size and the length: $169.87. Daytona costs $19.90 and Blaxel $19.87. Modal's $28.56 fits its credit, so $0, and Northflank's $8.00 fits its allowance. Vercel Pro comes to $25.54 and Cloudflare to $17.29 plus disk, because both bill CPU only while it's busy.
A machine held all month, such as Heaven's $20 Tiny plan, costs less than E2B Hobby only above about 1,100 of the short runs.
Frequently asked questions
Where does the app my agent builds get served?
From the sandbox while it runs. Each of these products can serve an exposed port at an HTTPS address, Cloudflare through your routing Worker, and on all but Northflank the address goes away when the sandbox stops or expires. To keep an app up for people to open later, deploy it to a host, or run the agent on a persistent machine that keeps its website.
Does an idle sandbox still cost money?
On most of them, while it runs. E2B, Daytona, Modal Sandboxes and Northflank bill a running sandbox whether or not it's busy. Vercel and Cloudflare bill memory while it waits and CPU only while it works. Pausing on E2B and standby on Blaxel stop the compute bill, and saved files cost a little.
Why aren't Runloop and Deno Sandbox on this list?
Runloop is winding down and its registration is closed. Deno Sandbox is closed to new customers, and Deno Deploy, which it runs on, is due to shut down in April 2027.
Related comparisons
See E2B alternatives, Daytona alternatives, Modal Sandboxes alternatives, E2B vs Modal Sandboxes, best persistent VMs for coding agents and infrastructure for software factories.
- AlternativesE2B alternatives for agent codeE2B alternatives for agent code: how long a run can last, what survives it, idle billing, GPUs, what a month of runs costs and where built apps get served.
- AlternativesDaytona alternatives for agent sandboxesDaytona alternatives for agent code that keep a Linux machine after a run, pause with memory, run past 48 hours or run on your servers, with monthly costs.
- AlternativesModal Sandboxes alternativesModal Sandboxes alternatives for agent and GPU jobs: runs past 24 hours, GPUs that aren't preempted, pause with memory, interpreters and monthly costs.
- ComparisonE2B vs Modal SandboxesE2B and Modal Sandboxes for an agent product: pause and resume, GPUs, raw TCP, interpreters, how many run at once and what a month of runs costs.
- RoundupBest persistent VMs for coding agentsLinux VMs a coding agent keeps for weeks, side by side: what keeps running, private previews, ports, regions and what one agent or a team of four pays.
- RoundupBest infrastructure for software factoriesHeaven, exe.dev, boat, Fly.io Sprites and Coder for teams whose agents do the work: what keeps running, how reviewers get in and what a month costs.
Run your agents on Heaven
Persistent Linux Computers that share CPU, memory and storage in one pool. Tiny is $20 a month.
Sources and corrections
Spot an error? Email support@heaven.dev with the page, the claim and a source.