Skip to content

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

ProductBest forLongest runKept after a runWhile it waits
E2BShort runs from an SDK that pause and fork1 hour, 24 on ProEverything, if pausedNo compute charge paused
DaytonaBig machines, GPUs, Windows and macOS24 hours, 48 on TeamVolumes and snapshots onlyBilled at the reservation while running
Modal SandboxesGPU fan-out from Python, in 19 locations24 hoursSnapshots, into a new SandboxBilled at the request while running
Vercel SandboxApps on Vercel, tasks that mostly wait45 minutes, 24 hours on ProFiles, in a fresh VMMemory billed, CPU only while busy
BlaxelAgents that wait between calls7 days on Tier 0, 30 on Tier 1Everything, in standbyStandby: storage only
NorthflankLong-lived sandboxes beside your servicesNo limitMounted volumes onlyBilled while running, busy or idle
Cloudflare SandboxCommands from a Cloudflare WorkerWhile active, then up to 6 idle hoursFiles, in a beta snapshotMemory billed, CPU only while busy
ProductIsolationGPUsFree usageDriven from
E2BFirecracker microVMNo$100 once, commercial use allowedPython and TypeScript SDKs
DaytonaFirecracker microVM. Windows and GPUs in VMsYesH100 to B300 and AMD MI355X$200 once, GPUs excludedPython and TypeScript SDKs
Modal SandboxesgVisor container or a VMYesT4 to B300. Can be preemptedYes$30 every monthPython. JavaScript and Go in beta
Vercel SandboxMicroVMNoHobby quotas, non-commercial onlyTypeScript and Python SDKs
BlaxelFirecracker-based microVMNoUp to $200 of creditsPython, TypeScript and Go SDKs
NorthflankMicroVM on CPU, gVisor on GPUYesL4 to B200Yes$20 of resources every monthJavaScript and Python SDKs
Cloudflare SandboxFirecracker microVMNoIncluded usage on the $5 Workers Paid planTypeScript, 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 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

ProductEntry planWhat it costs
E2BHobby$0 plus usage, about $0.11 an hour for the default sandbox, with $100 of credit once. Pro is $150 a month
DaytonaStarter$0 plus usage, with $200 of credit once. Team is $250 a month
Modal SandboxesStarter$0 plus usage, with $30 of compute every month. Team is $250 a month
Vercel SandboxHobby, non-commercial$0 within its quotas. Pro is $20 a month with $20 of usage
BlaxelPay as you go$0 plus active time, about $0.041 a GB-hour of memory, with up to $200 of credits
NorthflankSandbox$0 with $20 of resources a month, then $0.0167 a vCPU-hour and $0.0083 a GB-hour
Cloudflare SandboxWorkers 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.

See E2B alternatives, Daytona alternatives, Modal Sandboxes alternatives, E2B vs Modal Sandboxes, best persistent VMs for coding agents and infrastructure for software factories.

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

SourceChecked
1E2B pricingNovember 20, 2026
2E2B plans and limitsNovember 19, 2026
3E2B sandbox priceNovember 19, 2026
4E2B quickstartNovember 19, 2026
5E2B auto-pause and persistenceNovember 19, 2026
6E2B auto-resumeNovember 19, 2026
7E2B forkNovember 20, 2026
8E2B interpreter contextsNovember 19, 2026
9E2B isolationNovember 19, 2026
10Daytona pricingNovember 20, 2026
11Daytona sandbox classes and lifecycleNovember 20, 2026
12Daytona limitsNovember 20, 2026
13Daytona billingNovember 20, 2026
14Daytona isolationNovember 20, 2026
15Daytona GPU sandboxesNovember 20, 2026
16Daytona interpreterNovember 20, 2026
17Modal pricingNovember 19, 2026
18Modal Sandbox timeoutsNovember 19, 2026
19Modal runtimesNovember 19, 2026
20Modal Sandbox resources and billingNovember 19, 2026
21Modal GPU SandboxesNovember 19, 2026
22Modal memory snapshot limitsNovember 19, 2026
23Modal tunnelsNovember 19, 2026
24Modal regionsNovember 19, 2026
25Modal JavaScript and Go SDKsNovember 19, 2026
26Vercel SandboxNovember 19, 2026
27Vercel Sandbox pricing and limitsNovember 20, 2026
28Vercel Sandbox securityNovember 19, 2026
29Vercel persistent SandboxesNovember 19, 2026
30Vercel Sandbox FirewallNovember 19, 2026
31Vercel exposed portsNovember 19, 2026
32Vercel Hobby termsNovember 19, 2026
33Blaxel pricingNovember 19, 2026
34Blaxel standbyNovember 20, 2026
35Blaxel sandbox sizesNovember 19, 2026
36Blaxel process keep-aliveNovember 19, 2026
37Blaxel expirationNovember 19, 2026
38Blaxel runtimeNovember 19, 2026
39Blaxel SDKsNovember 19, 2026
40Northflank pricingNovember 19, 2026
41Northflank sandboxesNovember 19, 2026
42Northflank sandbox quickstartNovember 19, 2026
43Northflank sandbox isolation and billingNovember 19, 2026
44Northflank pause and resumeNovember 19, 2026
45Northflank persistent storageNovember 19, 2026
46Northflank GPU sandboxesNovember 19, 2026
47Northflank GPU plansNovember 19, 2026
48Northflank sandboxes in your own cloudNovember 19, 2026
49Cloudflare Sandbox SDKNovember 19, 2026
50Cloudflare Sandbox lifetimeNovember 19, 2026
51Cloudflare Containers pricingNovember 19, 2026
52Cloudflare Containers limitsNovember 19, 2026
53Cloudflare Container regionsNovember 19, 2026
54Cloudflare Container snapshotsNovember 19, 2026
55Cloudflare Containers isolationNovember 19, 2026
56Cloudflare Sandbox SDK referenceNovember 19, 2026
57Heaven pricingNovember 21, 2026
58Heaven ComputersNovember 21, 2026
59Runloop transition noticeNovember 19, 2026
60Runloop registrationNovember 19, 2026
61Deno Sandbox availabilityNovember 19, 2026
62Deno Sandbox docsNovember 19, 2026

Spot an error? Email support@heaven.dev with the page, the claim and a source.