E2B vs Fly Machines: pricing, isolation and limits
E2B is a sandbox API billed on allocated vCPUs and memory; a Fly Machine is a general-purpose VM billed by size. Both use Firecracker.
Runtime runs the same job for 77% less than E2B and 55% less than a Fly
Machine. 1,000 one-minute runs of a 2 vCPU, 4 GiB sandbox cost $2.76 on E2B,
$1.44 on a performance-2x Machine and $0.64 on Runtime. All three run
Firecracker microVMs; Runtime is the one that bills the CPU your code uses
rather than the size it holds. Rates checked 23 September 2026.
Estimated compute cost
77% less than E2B55% less than Fly Machines
2 vCPUs · 4 GiB · 60 s a run · 20 CPU-seconds busy
Compute only, at list rates checked 23 September 2026 (E2B pricing, Fly.io pricing). Plan fees, network, taxes and free credits are left out. The worked example below shows the arithmetic.
At a glance
Fly Machines are at the rates of Fly.io's Ashburn (iad) region.
| E2B | Fly Machines | Runtime | |
|---|---|---|---|
| What it is | A sandbox API for agents | General-purpose VMs, driven by the Machines API and flyctl |
A sandbox API for agents |
| Isolation | Firecracker microVM, own kernel | Firecracker microVM | Firecracker microVM, own kernel |
| Price | $0.0504 per vCPU-hour, $0.0162 per GiB-hour | By size while started: performance-2x, 4 GB, $0.0861 an hour |
$0.025 per vCPU-hour of measured CPU, $0.0075 per GiB-hour |
| Billed | Per second | By the second while a Machine runs | By the second |
| Largest size | 8 vCPUs and 8 GiB | 16 performance vCPUs and 128 GB | vCPUs and memory chosen per sandbox |
| Plan fee | Hobby $0; Pro $150 a month | None; pay as you go | None; prepaid credit from $10 |
| Free start | $100 of usage credit, once | Not stated on the pricing page | 50 sandbox hours, no card |
| Between jobs | Pause keeps files, memory and processes | Root disk is temporary; volumes keep files, suspend memory | Pause keeps files, memory and processes, 1 to 365 days |
Is Fly Machines cheaper than E2B for agents?
At list rates, yes, by about half. A performance-2x Machine with 4 GB costs
$0.0861 an hour. The same 2 vCPUs and 4 GiB on E2B cost 2 × $0.0504 plus
4 × $0.0162, which is $0.1656 an hour. Both bill for as long as the machine
runs, whether the agent is working or waiting on a model.
What the lower price buys is a bare VM. E2B hands you a sandbox SDK in
JavaScript and Python, a code interpreter and a pause that keeps memory. A
Machine is a VM you drive through the Machines API: you create one per job,
decide what image it boots, and stop it yourself. Its root disk is temporary,
so files you want to keep go on a Fly Volume. A Machine's performance vCPUs are
whole cores kept for it; on Runtime, cpu: "reserved" does the same.
Runtime is priced below both for this kind of agent because it bills the 20 CPU-seconds a run uses, not two vCPUs for all 60 seconds. While the agent waits, only a floor of a twentieth of a vCPU is billed.
Cost for the same job
1,000 runs of a 2 vCPU, 4 GiB sandbox. Each run lasts 60 seconds and keeps the
CPU busy for 20 CPU-seconds: an agent that mostly waits for a model. The
Machine is a performance-2x with 4 GB.
TextE2B CPU 1,000 × 60 s / 3,600 × 2 × $0.0504 = $1.68 Memory 1,000 × 60 s / 3,600 × 4 × $0.0162 = $1.08 Total $2.76Machines Size 1,000 × 60 s / 3,600 × $0.0861 = $1.44Runtime CPU 1,000 × 20 s / 3,600 × $0.025 = $0.14 Memory 1,000 × 60 s / 3,600 × 4 × $0.0075 = $0.50 Total $0.64At 100,000 runs a month that is $276.00 on E2B, $143.50 on Machines and $63.89 on Runtime. With both CPUs busy for the whole minute, it is $1.33 on Runtime against $2.76 on E2B and $1.44 on Machines, so Runtime stays the cheapest of the three even for work that never waits. A Machine's price does not change with load: it is the size, by the second. Plan fees, volumes, network and free credits are left out.
What happens between jobs?
A paused E2B sandbox keeps its files, memory and running processes, with no expiry. A stopped Fly Machine keeps its root filesystem for $0.15 per GB a month, but that disk is temporary: data you need across restarts belongs on a volume, and only suspend keeps memory. A paused Runtime sandbox keeps files, memory and processes for the retention you set, 1 to 365 days, and wakes by itself on the next request. See how to pause and resume a sandbox.
Which one to pick
- Pick E2B for a ready-made agent sandbox with a code interpreter, paused sandboxes kept with no expiry, or a runtime you can self-host under Apache-2.0. Sessions past an hour need the $150-a-month Pro plan.
- Pick Fly Machines if you want general VMs in 18 regions, sizes up to 16 performance vCPUs and 128 GB, and volumes and Managed Postgres in the same account, and you are happy to build the sandbox layer yourself. Runtime runs in one US region.
- Pick Runtime for a sandbox API priced below a raw Machine: measured CPU, memory sized to the job, pause that keeps memory and processes, and an agent that connects without an API key.
Switch from either one
From E2B, change one import:
TypeScriptimport { Sandbox } from "withruntime/e2b"; // was: from "e2b"Pythonfrom withruntime.e2b import Sandbox # was: from e2b import SandboxFrom Fly Machines, where you create a Machine for each job through the Machines API, create a Runtime sandbox instead and stop it when the job ends. There is no app or image to set up first:
TypeScriptimport { Sandbox } from "withruntime";const box = await Sandbox.create({ funding: "trial" });try { console.log((await box.exec(["python3", "-c", "print(6 * 7)"], { check: true })).stdout);} finally { await box.stop();}Pythonfrom withruntime import Sandboxwith Sandbox.create(funding="trial") as box: print(box.exec("python3 -c 'print(6 * 7)'", check=True).stdout)Or give your coding agent the one instruction in migration: it
switches the project on a branch, tests it on the free trial and reports the
monthly saving. npx withruntime compare --from fly-machines (or --from e2b)
prices what you ran at the old provider's rates. The full side-by-sides are
Runtime vs E2B and
Runtime vs Fly.io; microVM vs container
explains the isolation all three share.
Sources
E2B and Fly.io pricing pages rechecked 25 September 2026; the rest checked 23 September 2026.
- E2B pricing, E2B sandbox persistence
- Fly.io pricing, Machine CPU performance, Machine suspend and resume, Fly Volumes, Fly.io regions
- Runtime pricing
Facts on this page were checked on 25 September 2026.