Which is better, E2B or Fly Machines?
It depends on whether you want a ready sandbox or raw VMs. For agents that wait on a model, Runtime is a ready-made sandbox and the lowest-cost option: $0.64 for this job, against $2.76 on E2B and $1.53 on a Fly Machine. It has no session limit, and its pauses keep memory. Pick E2B for self-hosting under Apache-2.0 or for paused sandboxes with no expiry. Pick Fly Machines for VMs in 17 regions with up to 128 GB, and for volumes and Managed Postgres nearby.
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.0916704 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 | Up to 16 vCPUs and 64 GiB, sized separately |
| Plan fee | Hobby $0; Pro $150 per month | None; pay as you go | None; prepaid credit from $10 |
| Free start | $100 of usage credit, once | Not stated on the pricing page | 100 free hours of a 1 GB machine in the first 30 days, 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 while you have credit |
Is Fly Machines cheaper than E2B for agents?
At list rates, yes, by about half. A performance-2x Machine with 4 GB costs
$0.0916704 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
or sandbox runs, whether the agent is working or waiting on a model.
What the lower price buys is a bare VM. E2B provides a sandbox SDK for
JavaScript and Python, a code interpreter, and a pause that keeps memory. A
Machine is a VM you control through the Machines API. You create one per job,
choose the 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 reserved for it; on Runtime, cpu: "reserved" does the same.
Runtime costs less than 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.
- CPU
- 1,000 × 60 s / 3,600 × 2 × $0.0504
- $1.68
- Memory
- 1,000 × 60 s / 3,600 × 4 × $0.0162
- $1.08
- Size
- 1,000 × 60 s / 3,600 × $0.0916704
- $1.53
- CPU
- 1,000 × 20 s / 3,600 × $0.025
- $0.14
- Memory
- 1,000 × 60 s / 3,600 × 4 × $0.0075
- $0.50
At 100,000 runs per month, that is $276.00 on E2B, $152.78 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.53 on Machines. Runtime stays the cheapest of the three even for work that never waits. A Machine's price does not change with load: it depends on its size, billed 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 per 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 while you have credit, and wakes on its own 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 Pro plan, $150 per month.
- Pick Fly Machines if you want general VMs in 17 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, a pause that keeps memory and processes, and an agent that connects without an API key.
Runtime Cloud
Runtime runs the same job for 77% less than E2B and 58% less than a Fly
Machine. 1,000 one-minute runs of a 2 vCPU, 4 GiB sandbox cost $2.76 on E2B,
$1.53 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,
not the size it holds. Rates checked 25 October 2026.
Create a sandbox on the free usage after running npx withruntime login. Both E2B code and
Fly Machines API calls move over with the migration guide.
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();try { await box.files.write("/workspace/invoice.py", "print(sum([125, 250, 375]))\n"); console.log((await box.exec(["python3", "/workspace/invoice.py"], { check: true })).stdout);} finally { await box.stop();}Pythonfrom withruntime import Sandboxwith Sandbox.create() as box: box.files.write("/workspace/invoice.py", "print(sum([125, 250, 375]))\n") print(box.exec("python3 /workspace/invoice.py", 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 usage 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 comparisons are
Runtime vs E2B and
Runtime vs Fly.io. microVM vs container
explains the isolation all three share.
Sources
Fly.io prices checked 25 October 2026.
E2B and Fly.io pricing pages rechecked 25 October 2026; the rest checked 25 October 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 26 October 2026.