What a sandbox is
Simply putYour agent is a kid who wants to paint. You don't let it paint in the living room; you give it a playroom with plastic on the floor, and if it makes a mess you throw the room away. That room is a sandbox.
A sandbox is an isolated, disposable computer (CPU, memory, disk and network) that an agent controls through an API. You create it, run commands in it, read and write files, stream their output, sometimes pause it, and kill it when you're done.
Why agents need one
Simply putThe agent writes code nobody has checked, and it can be tricked by what it reads. That code shouldn't run on your machine.
Agents run untrusted code: code the model wrote, or code smuggled in by prompt injection from a web page, a file or an email. A sandbox gives the agent a real machine (install packages, run tests, start servers, use a browser) without reaching your secrets, your network or other users.
How isolated it is
Simply putSome playrooms have curtains for walls, some have wooden walls, some are a separate little house. Thicker walls are safer.
| Wall | What it is | Trade-off |
|---|---|---|
| Container | A separate room that shares the host's kernel | Fastest; a kernel bug can let code out |
| gVisor | A stand-in kernel that answers the program's system calls itself | Strong, a little slower for some work. Modal and Agent37 use it. |
| MicroVM | A tiny virtual machine with its own kernel (Firecracker) | Strong, starts in well under a second. E2B, Vercel and Fly use it. |
| Full VM | A whole virtual machine | Strong and slow to start |
For code you didn't write, pick a microVM or gVisor. A tell for shared-kernel isolation: in our benchmarks one provider's sandbox reported the whole host machine's CPU counters instead of its own.
Why some start faster
Simply putSome shops keep playrooms built in the back; some rebuild one from a photo; some build from scratch.
Cold start is the time from asking for a sandbox to running its first command. Providers hide boot time with warm pools (machines already running) and memory snapshots (a running machine saved and restored, processes included), which also lets you fork a sandbox mid-task. Start times include the network, so they depend on where you are. See the measured start times.
How you're charged
Simply putSome shops charge for every hour the playroom exists. Others charge only while the kid is painting, plus rent for the room.
- Allocated: you pay for the CPU and memory you reserved, busy or not (E2B, Daytona, Boat, Maritime, Agent37, and Modal for the size you reserve).
- Active CPU: CPU only while it's busy, memory all the time (Vercel, Cloudflare, Tensorlake, AgentCore, Sail, Sprites). Agents spend much of their time waiting on the model, so this can cost a fraction of the listed price. Modal says a typical sandbox spends more than half its life under 6% of its peak CPU.
- The fine print decides short jobs: minimum charges (Agent37 and CodeSandbox bill at least a minute; Vercel's minute covers memory only), billing steps (per second or per minute), start fees that depend on your plan (Sail charges $0.01 per start on its free plan, Boat charges for starts above its allowance; our numbers leave these out and note them), floors (Tensorlake bills at least 20% CPU), plus disk, data out and monthly plans.
So the question is never the price per hour; it's what your job costs. The same provider can be first for a 30-minute session and seventh for a 10-second tool call. That's what the cost tables rank by, and how prices work has the details.
Speed isn't only start time
Simply putTwo playrooms both come with “2 crayons”, but one set draws twice as fast.
A vCPU isn't a fixed unit: chips and sharing differ. On the same short job, Modal took 0.4 s and Northflank took 26.7 s. Some machines are fast for a moment and then slow down under steady load: Modal's long job took 3.0× what its short job predicted. Disk and network speed matter too, for cloning repos and installing packages. Price per job is speed times the billing rules: see the cost of a real task.
Features that matter
Simply putSome playrooms have a shelf to keep toys overnight, a window to the internet, or a TV.
- Custom images: start from your own container with your tools already installed.
- Persistence: pause and resume, volumes, sleeping between agent turns, and snapshots that really bring back your files and processes.
- Networking: internet on or off (one code interpreter we tested had none by default), limits on what it can reach, and open ports or preview URLs so an agent can show you what it built.
- Limits: how long a session can run, how many sandboxes at once, the largest size, and regions.
- Extras: GPUs, full desktops and phones for agents that use a screen, and SDKs in your language.
Each provider page lists what it supports and passed in our check.
Security checklist
Simply putGive the kid the playroom, not the keys to the house.
- Match the walls to the code: microVM or gVisor for anything untrusted.
- Never put your real API keys inside the sandbox. Keep them outside, in a proxy that adds them, or use short-lived keys that can do one thing.
- Limit where the sandbox can send data, so injected code can't ship your data out.
- Set timeouts and always kill sandboxes; clean up the ones a crash left behind. A forgotten sandbox is money running out.
- Treat everything the agent reads as possibly written by an attacker.
Who's who
Simply putThere are dozens of playroom shops now, and they don't all sell the same thing.
- Code interpreters, for quick runs: E2B, AgentCore, Novita.
- Dev environments, for long, stateful work: Daytona, CodeSandbox, Runloop.
- Cloud platforms that added sandboxes: Vercel, Cloudflare, Modal, Fly (Sprites), AWS Lambda MicroVMs.
- Low-price newcomers competing on cost: Agent37, Boat, Maritime, OpenScale, Sail.
Where it's going: lower prices, paying for what you use, sandboxes that sleep between an agent's turns, snapshots and forks for running many agents in parallel, and agent platforms letting you bring your own sandbox. sandboxRouter tracks 36 providers, 22 of them tested on real accounts; see all of them side by side.
How to compare providers
Simply putBefore you believe a “50× cheaper” chart, ask three questions.
- At what CPU use? An active-CPU provider looks expensive at 100% and cheap at 10%. Agents are usually closer to 10%.
- For how long a job? Minimum charges and per-sandbox fees flip the ranking between a 10-second and a 30-minute run.
- Same size, same speed? Fixed default sizes and slower CPUs make two “2 vCPU” prices different things.
Then measure your own job: npx @sandboxrouter/sdk bench --task --job python runs one on every provider you have keys for.
Words to know
- Cold start
- Time from asking for a sandbox to running its first command.
- Warm pool
- Machines kept running so a new sandbox doesn't wait for a boot.
- Snapshot, fork, restore
- Save a running machine, copy it, or bring it back later.
- MicroVM, Firecracker
- A tiny virtual machine with its own kernel; Firecracker is the common one.
- gVisor
- A stand-in kernel between the program and the host.
- Active CPU vs allocated
- Paying for CPU while it's busy, or for what you reserved.
- Minimum charge, billing step
- The least you're billed, and the unit time is rounded up to.
- Egress
- Data the sandbox sends out; often billed, and worth limiting.
- Preview URL
- A link to a port in the sandbox, to see what an agent built.
- Concurrency limit
- How many sandboxes you can run at once.
- Burst vs throttle
- Fast for a moment, then slowed under steady load.
- Cost per task
- What a real job costs: speed times billing rules.
- Prompt injection
- Instructions hidden in what the agent reads, meant to take it over.