Persistent VMs are now available.Learn more

Best E2B Alternatives for AI Agents and Code Sandboxes

TutorialsEngineering
Nathanael Chiang19 min read
Best E2B Alternatives for AI Agents and Code Sandboxes

The best E2B alternatives are Daytona, Modal Sandboxes, Beam, Fly.io Sprites, Tensorlake, Vercel Sandbox, Cloudflare Sandboxes, Northflank, Docker Sandboxes and Microsandbox. E2B already gives you Firecracker microVMs, pause and resume with memory, and forking, so the right switch depends on what it doesn't cover for you: GPUs, more than a day of continuous runtime without pausing, multi-node self-hosting, Windows or macOS desktops, or a cheaper home for agents that run for weeks.

Best E2B alternatives at a glance

The strongest E2B alternatives are Daytona, Beam, Tensorlake, Modal and Fly.io Sprites, and the right one depends on the gap you need to close. Every option runs untrusted code in isolation; they differ on GPUs, persistence, self-hosting and price.

  • GPUs inside the sandbox: Beam sandboxes attach a GPU with one argument. Daytona and Modal also sell GPU sandboxes. E2B is CPU-only.
  • A persistent machine for each agent: Beam VMs pause with RAM intact and, with auto-resume on, wake on access. Fly.io Sprites keep their disk and pause themselves when idle.
  • Windows or macOS desktops: Daytona runs Windows sandboxes through its SDK and offers macOS on reserved Macs through use.computer.
  • Fast managed microVM starts: Tensorlake's homepage lists an 84 ms cold start (its docs say boots take hundreds of milliseconds) and keeps memory across suspend.
  • A coding agent on your own laptop: Docker Sandboxes run Claude Code or Codex in a microVM with its own Docker Engine, at no charge on your machine.
  • Self-hosting on your own hardware: Microsandbox boots microVMs on your own machine. Beam's runtime, beta9, is open source under AGPL-3.0, though it doesn't include every Beam Cloud feature and its self-hosting guides don't cover VMs.
  • Your app already lives on Vercel or Cloudflare: their sandboxes sit next to it and bill CPU only while it's busy.

What E2B does well, and where teams hit limits

E2B gives each sandbox its own Firecracker microVM and handles state well: pause saves both disk and memory, snapshots capture both, and fork copies a running sandbox in one call. Teams usually move for four reasons: no GPUs, a continuous-runtime cap tied to the plan, single-node self-hosting, and Linux-only desktops.

The numbers, from E2B's pricing page and billing docs:

  • Plans: Hobby has no monthly fee and a one-time $100 usage credit. Pro costs $150 a month plus usage. Enterprise starts at a $2,000 monthly commit with 500 concurrent sandboxes included.
  • Rates: $0.000014 per vCPU-second and $0.0000045 per GiB-second, which is about $0.05 per vCPU-hour. The default sandbox has 2 vCPUs and 4 GiB of RAM, custom sizes go up to 8 vCPUs and 8 GiB, and Pro can go higher on request.
  • Runtime: 1 hour on Hobby and 24 hours on Pro. The cap counts time without a pause, so pausing resets it, and E2B keeps paused sandboxes indefinitely.
  • Concurrency: 20 sandboxes on Hobby, 100 on Pro, and add-ons that raise Pro to 600 or 1,100.
  • Self-hosting: the runtime is Apache-2.0. E2B Embed runs the whole stack on one Linux machine with KVM. Running across machines in your own AWS, GCP or Azure account is BYOC, an Enterprise option operated by E2B.
  • GPUs: none. E2B's pricing page says plainly that its sandboxes are CPU-only.
  • Desktop: the E2B Desktop SDK gives agents an Ubuntu 22.04 desktop with XFCE over VNC.

Our E2B pricing breakdown works through the plan math in detail.

How to choose an E2B alternative

Settle five questions before comparing prices: how much state must survive between agent turns, whether the code needs a GPU, how strong the isolation must be, whether you need to self-host, and how long a session runs. The answers usually leave two or three options.

Persistence: disk, memory, or a copy of both

State survives at three levels, and vendors use "persistent" for all of them.

  • Disk survives a stop: files and packages come back, but processes restart. Fly.io Sprites after a cold wake, Vercel Sandbox, Daytona container sandboxes and stopped Beam VMs work this way.
  • Memory survives a pause: running processes resume where they were. E2B, Beam VMs, Daytona's VM classes and Tensorlake's named sandboxes keep memory. Sprites keep it only while warm.
  • A fork copies memory: E2B, Daytona VM classes, Tensorlake, Modal (alpha memory snapshots that expire after 7 days), Beam sandboxes on supported runtimes and Microsandbox can start new sandboxes from a running state. Beam VM forks and snapshots copy the disk only.

We go further into these trade-offs in our guide to stateful sandboxes for code execution.

GPU access

E2B, Fly.io Sprites, Vercel Sandbox and Cloudflare list no GPU option, and Docker's cloud sandboxes have none, though its local sandboxes can pass through the host's GPU. Beam, Daytona, Modal, Tensorlake and Northflank sell GPU sandboxes. Most GPU sandboxes give up the microVM boundary: Modal, Tensorlake and Northflank run them on gVisor, and Daytona's GPU class is a container with an exclusive GPU. Beam attaches GPUs to sandboxes on its GPU-capable runtimes, not to its CPU-only VMs.

Isolation model

A microVM gives each sandbox its own kernel, so a kernel exploit in one sandbox doesn't reach its neighbours. E2B, Sprites, Tensorlake's CPU sandboxes, Vercel, Cloudflare, Microsandbox, Northflank, Docker Sandboxes and Beam VMs use microVMs. gVisor puts a user-space kernel between the code and the host, and plain containers, including an ordinary docker run, share the host kernel. Daytona's isolation docs give its default container class namespace isolation and reserve a separate kernel for the Linux VM and Windows classes. If strangers' code shares your hosts, prefer a microVM.

Self-hosting and BYOC

E2B Embed self-hosts on one node. Microsandbox is a library, so it runs wherever you install it, and Docker Sandboxes run locally on the machine where you install the sbx CLI. Beam's beta9 self-hosts on a local k3d cluster or on AWS EKS, and Beam also offers BYOC on AWS, GCP and Azure. Daytona, Tensorlake and Northflank offer BYOC too. Daytona's public repository no longer receives updates, because its core development moved to a private codebase. For the operational side, see how to self-host a code execution sandbox.

Session limits

Modal caps a sandbox at 24 hours. Vercel caps each session at 45 minutes on Hobby and 24 hours on Pro. Tensorlake allows 2 hours free, 24 hours with usage credits, and no cap on Pro. Daytona auto-stops after 15 idle minutes by default, and you can turn that off. Northflank sets no time limit. Docker's cloud sandboxes expire after one hour by default and can't be extended past 24 hours from creation; local ones last until you remove them. A Beam sandbox runs for its TTL, 600 seconds by default; set keep_warm_seconds=-1 and it runs until you terminate it. A Beam VM runs until you stop it, pause it or an idle timeout fires.

Desktops for computer use

Computer-use agents need a screen to read and a mouse to drive. E2B, Beam VMs and Tensorlake offer Linux desktops. Daytona offers computer use on Linux and Windows, plus macOS sandboxes on reserved Macs through the separate use.computer platform, which makes it the pick when the target application only runs on Windows or a Mac.

E2B alternatives compared

The table lines up E2B and each alternative on isolation, memory pause, copying a running sandbox, session limits, GPUs, self-hosting and CPU rate. CPU rates aren't billed the same way: E2B and Beam bill the CPU you request while the sandbox runs, Modal bills the higher of request or actual use, and Sprites, Tensorlake, Vercel and Cloudflare bill CPU time actually used.

OptionIsolationPause with memoryCopy a running sandboxSession limitGPUSelf-host or BYOCCPU rate
E2BFirecracker microVMYesFork with memory1 h Hobby, 24 h Pro, resets on pauseNoEmbed on one node; BYOC on Enterprise$0.0504 per vCPU-hour
Beam sandboxesContainer, or microVM with use_vm=TrueNo pause; memory snapshotsFork from a memory snapshot on supported runtimesYour TTL; can run until terminatedYes, on GPU-capable runtimesbeta9 open source; BYOC on AWS, GCP, Azure$0.05 per vCPU-hour on Performance; $0.011 Shared; $0.0063 Spot
Beam VMsCPU microVM with its own kernelYesDisk onlyNone; stop, pause or idle timeoutNo, CPU-onlyNot covered by self-hosting guides$0.05 per vCPU-hour on Performance; $0.011 Shared; $0.0063 Spot
DaytonaContainer by default; Linux VM and Windows classesVM classes onlyVM classes only15 min idle auto-stop by defaultYes, RTX 4090 to B300BYOC custom regions, enabled per org; public repo no longer maintained$0.0504 per vCPU-hour
Modal SandboxesgVisor, or VM runtimeNo pause; memory snapshots in alphaMemory snapshot, 7-day expiry24 h maximumYes, gVisor only, preemptibleManaged only$0.0710 per vCPU-hour
Fly.io SpritesFirecracker microVMWhile warm onlyNo; checkpoints roll back the same Sprite's diskNone; pauses when idleNoManaged only$0.0385 per CPU-hour used
TensorlakeFirecracker microVM; gVisor for GPUNamed sandboxesClone with memory, or memory snapshots2 h free, 24 h on credits, none on ProBy requestBYOC on AWS$0.07 per active core-hour
Vercel SandboxFirecracker microVMNo, disk onlyDisk snapshots45 min Hobby, 24 h Pro per sessionNoManaged only$0.128 per active CPU-hour
Cloudflare SandboxesMicroVM container started by a WorkerNoDisk snapshots, beta, 30-day expiryNo fixed cap; stops up to 6 h after its Durable Object goes idleNoManaged only$0.072 per active vCPU-hour
NorthflankCloud Hypervisor microVM; gVisor for GPUPause; memory not documentedNot documentedNoneYes, gVisorBYOC in your cloud account$0.01667 per vCPU-hour
Docker SandboxesMicroVM with its own Docker EngineCloud stop keeps memoryNo; sbx move copies files between local and cloudLocal none; cloud 1 h default, 24 h maximumLocal passthrough onlyLocal sandboxes run on your machineLocal free; cloud $0.07 per vCPU-hour with 2 GB
MicrosandboxLocal microVMSnapshots of running stateLive forkNot documentedNot listedRuns on your machineOpen source

On price, the defaults sit close together. A 2 vCPU, 4 GiB sandbox costs about $0.166 an hour on E2B or Daytona (2 × $0.0504 + 4 × $0.0162, before Daytona's disk charge past 5 GiB) and $0.14 on Beam's Performance tier, the default for new accounts (2 × $0.05 + 4 × $0.01). Northflank's list rates put the same size at about $0.067 (2 × $0.01667 + 4 × $0.00833). Beam's Shared tier brings it to $0.044 (2 × $0.011 + 4 × $0.0055) and Spot to $0.018 (2 × $0.0063 + 4 × $0.00135), though Shared caps a workload at 8 vCPU and 16 GiB and Spot can be interrupted with 30 seconds' notice.

Where the others win, plainly: E2B forks a running sandbox with its memory in one call, which Beam VMs can't do. Tensorlake publishes the lowest cold-start number here, and Daytona is the only option here with Windows, plus macOS through use.computer. Docker Sandboxes and Microsandbox run on your own machine at no charge, which Beam, a managed cloud service, doesn't match.

E2B vs Daytona vs Modal Sandboxes

E2B, Daytona and Modal all run agent code in isolated sandboxes from an SDK, and they split on isolation and on what survives a pause. E2B gives every sandbox a Firecracker microVM with pause, fork and snapshots that keep memory. Daytona starts containers by default and keeps memory across pause and fork only on its VM classes. Modal runs gVisor or a VM runtime, caps each sandbox at 24 hours, and sells GPUs, as Daytona does; E2B has none.

E2BDaytonaModal Sandboxes
IsolationFirecracker microVM for every sandboxContainer by default; Linux VM and Windows classesgVisor, or a VM runtime
Pause with memoryYesVM classes onlyNo; memory snapshots in alpha
Fork a running sandboxYes, with memoryVM classes onlyFrom a memory snapshot that expires after 7 days
Session limit1 h Hobby, 24 h Pro, resets on pause15 min idle auto-stop by default24 h maximum
GPUsNoneEight models, RTX 4090 to B300, plus AMD MI355XT4 to B300, gVisor only, preemptible
CPU$0.0504 per vCPU-hour$0.0504 per vCPU-hour$0.0710 per vCPU-hour
Memory$0.0162 per GiB-hour$0.0162 per GiB-hour$0.0240 per GiB-hour
Open source and self-hostingApache-2.0; Embed runs on one nodeAGPL-3.0 repository no longer maintained; BYOC custom regionsManaged only
SDKsPython, JavaScriptPython, TypeScript, Ruby, Go, JavaPython, JavaScript, Go
  • Pick E2B for CPU agents that need pause and fork with memory on every sandbox. It ties Daytona for the lowest list rate of the three.
  • Pick Daytona for GPU sandboxes, Windows or macOS targets, or SDKs in Ruby, Go or Java. Memory pause and fork need one of its VM classes.
  • Pick Modal when your inference or training already runs on Modal. Plan for the 24-hour cap, and note that Modal bills the higher of your request or actual use.

If you need a GPU sandbox that forks from a memory snapshot, or a machine that pauses with RAM intact for days, Beam covers both cases; the Beam review below has the details.

E2B alternatives for AI agents, reviewed

For AI agents, pick by the agent's job: Tensorlake for short CPU code runs, Beam for GPU sandboxes or persistent VMs that pause with RAM intact, Daytona for agents that drive Windows apps, and Fly.io Sprites for a long-lived workspace billed on CPU used. Each review opens with the workload it fits, then the numbers that decide it.

Beam: GPU sandboxes and persistent microVMs

Beam fits teams that want SDK-driven code sandboxes with GPUs, plus a separate VM product for agents that need a machine of their own.

Beam sandboxes are isolated containers for short-lived code execution. The docs list a container runtime, or a microVM with use_vm=True. Beam's open-source runtime, beta9, ships runc, gVisor and microVM runtimes, and its default worker configuration uses gVisor. Sandboxes boot in seconds, default to a 600-second lifetime, and attach a GPU such as an RTX 4090 with gpu="RTX4090". snapshot_memory() captures process state and the filesystem on supported runtimes, and create_from_memory_snapshot() forks it into new sandboxes. Egress can be blocked or allowlisted, and secrets reach the guest only as placeholders. Sandboxes bill per second at the CPU tier you choose. Performance, the default for new accounts, costs $0.05 per vCPU-hour plus $0.01 per GiB-hour, so a 2 vCPU, 8 GiB sandbox costs $0.18 an hour. The same sandbox costs $0.066 an hour on Shared ($0.011 + $0.0055) and $0.023 on Spot ($0.0063 + $0.00135), which runs on spare capacity and fails to start if none frees up within 20 minutes. CPU and RAM attached to a GPU bill at Beam's GPU-attached rates on every tier.

Beam virtual machines are persistent CPU microVMs, each with its own kernel, systemd and a durable root disk. Pause keeps RAM and running processes; stop keeps the disk and releases compute. Snapshots and forks copy the filesystem. You get SSH through an authenticated tunnel, a protected browser terminal, and an Ubuntu desktop with an automation API for screenshots, clicks, typing, scrolling, dragging and screen recording. Docker and Compose come preinstalled (enable the daemon with --docker-enabled), as do the Claude Code and Codex CLIs. An idle timeout can pause the VM, and auto-resume wakes it on an SDK call, a tunnel or a request to a published URL. VMs bill per second on the same tiers. The default VM has 4 vCPUs, 8 GiB of RAM and a 50 GiB disk, and costs $0.28 an hour on Performance (4 × $0.05 + 8 × $0.01), $0.088 on Shared and $0.036 on Spot, where a preempted VM has to be restarted by hand. Disk isn't billed yet, and a stopped VM incurs no compute charges. Python and TypeScript SDKs drive both sandboxes and VMs, and the VM docs cover the lifecycle in full.

Some comparison sites list Beam as gVisor sandboxes with no pause, no desktop, no computer-use API and no VM with its own kernel. Beam VMs run their own kernel, pause with RAM intact, and ship an Ubuntu desktop with an automation API.

Where Beam loses: on the default Performance tier, CPU costs about what E2B and Daytona charge per vCPU, and the cheaper tiers come with limits (Shared stops at 8 vCPU and 16 GiB, Spot can be interrupted). VMs are CPU-only and Linux-only, there's no published VM boot time, and VM forks don't carry RAM. The beta9 repository self-hosts under AGPL-3.0, but it doesn't include every Beam Cloud feature, and the self-hosting guides don't cover VMs.

Daytona: the widest catalog, including Windows and macOS

Daytona is the broadest single catalog: container, Linux VM, Windows and GPU sandboxes behind one SDK, plus macOS sandboxes on reserved Macs through the separate use.computer API. Pick it when the agent must drive a Windows or Mac application, or you want consumer RTX cards and AMD MI355X next to H100-class GPUs.

Sandboxes are Linux containers by default and start in under 90 ms. Pause, fork and memory snapshots work only on the VM classes; a container sandbox keeps its filesystem on stop but not its memory. GPU sandboxes offer H100, H200, B200, B300, RTX PRO 6000, RTX 4090, RTX 5090 and AMD MI355X, up to 8 per sandbox, and they're ephemeral. Sandboxes auto-stop after 15 idle minutes by default, and a process running inside doesn't count as activity. CPU costs $0.0504 per vCPU-hour and memory $0.0162 per GiB-hour, the same as E2B; Windows costs $0.0858 per vCPU-hour. An RTX 4090 runs $0.99 an hour on demand or $0.57 preemptible. SDKs cover Python, TypeScript, Ruby, Go and Java.

The catch is the open-source path. Daytona's public AGPL-3.0 repository still works and can be forked, but it gets no further updates, fixes or releases, because core development moved to a private codebase. Teams that want their own hardware can attach runner nodes as BYOC custom regions, once Daytona enables that for the organization. Our Daytona alternatives guide covers what that means for self-hosters.

Modal Sandboxes: sandboxes next to Modal inference

Modal Sandboxes suit teams already running inference or training on Modal who want sandboxes in the same account. The limit to plan around is 24 hours per sandbox.

Sandboxes run on gVisor or on a VM runtime with their own Linux kernel. GPU sandboxes can use Modal's full GPU list, from T4 to B300, but run on gVisor only and, unlike CPU sandboxes, can be preempted. The default lifetime is 5 minutes; past the 24-hour maximum, Modal recommends restoring a filesystem snapshot into a new sandbox. Memory snapshots are in alpha and expire after 7 days. SDKs cover Python, JavaScript and Go. Sandboxes bill at 3x Modal's list price: $0.00003942 per physical core-second (2 vCPU) and $0.00000667 per GiB-second, charged on the higher of your request or actual use.

Fly.io Sprites: persistent computers that pause themselves

Sprites are persistent Linux computers for agents. Choose them for a long-lived workspace that bills only for CPU actually used, when you don't need GPUs or a fork API.

Each Sprite runs in a dedicated microVM, and Fly says Sprites run on Firecracker. After about 30 idle seconds a Sprite goes warm, with memory frozen and a 100 to 500 ms resume. Left idle longer, it goes cold, drops memory and takes 1 to 2 seconds to wake. The 100 GB ext4 disk always persists. Resources are fixed at 8 vCPUs. Checkpoints capture the disk only, open TCP connections drop on any pause, and there's no direct SSH (sprite console gives you a shell). CPU costs $0.0385 per CPU-hour of actual use and memory $0.021875 per GB-hour.

Tensorlake: Firecracker sandboxes with memory snapshots

Tensorlake is the closest match to E2B's design: Firecracker microVMs for CPU work with suspend, memory snapshots and fast starts, plus longer sessions on paid plans.

Named sandboxes suspend and resume with memory intact. Memory snapshots restore the filesystem, memory and running processes into new sandboxes with a warm start, and copy clones a running or suspended sandbox the same way in one call. The homepage lists an 84 ms cold start; the docs describe boots in hundreds of milliseconds. GPU sandboxes are available by request and run on gVisor. Tensorlake's free plan allows one sandbox and 2-hour sessions; usage credits start at $5 and allow 24-hour sessions; Pro costs $250 a month plus usage, with no session cap. CPU costs $0.07 per active core-hour on credits ($0.042 on Pro), and SSH, a VNC desktop image and BYOC on AWS are available.

Vercel Sandbox: Firecracker microVMs for Vercel apps

Vercel Sandbox is the easy choice for apps already deployed on Vercel. Each sandbox is a Firecracker microVM with its own kernel.

Sandboxes are persistent by default: stopping one snapshots the filesystem, and the next SDK call resumes from it. Memory and processes don't survive. The default timeout is 5 minutes, and a session can run up to 45 minutes on Hobby or 24 hours on Pro. In the default iad1 region, Pro bills $0.128 per active CPU-hour, $0.0212 per GB-hour of provisioned memory and $0.60 per million sandbox creations, after the plan's $20 monthly credit runs out. Pro sandboxes go up to 8 vCPUs and 16 GB.

Cloudflare Sandboxes: microVMs behind a Worker

Cloudflare's sandboxes fit apps built on Workers. A Durable Object starts a Linux container instance, and each instance is a microVM with its own kernel and network.

They need the Workers Paid plan. An instance stops up to 6 hours after its Durable Object goes inactive, even if code inside is still running. Its processes and disk end with it, and a snapshot (in public beta, kept 30 days) carries files to the next instance. Containers bill $0.000020 per vCPU-second of active CPU and $0.0000025 per GiB-second, and the largest standard instance has 4 vCPUs and 12 GiB, with higher limits on request.

Microsandbox: microVMs on your own machine

Microsandbox is the self-hosted pick: an Apache-2.0 library that boots microVMs on your own machine with no server or daemon.

It needs Linux with KVM, macOS on Apple Silicon, or Windows with WHP. It runs OCI images, forks live sandboxes and snapshots running state, and the README reports average boot times under 100 ms, measured as guest boot on an M1. SDKs cover TypeScript, Python, Rust, Go and Ruby, and there's an MCP server. It's beta software, so expect breaking changes, and scaling past one machine is your job.

Docker Sandboxes: microVMs with their own Docker Engine

Docker Sandboxes suit developers who want a coding agent such as Claude Code or Codex walled off on their own laptop, with the option to move the same sandbox to Docker's cloud later.

Docker built the sandboxes as microVMs, each with its own kernel and its own private Docker Engine, so an agent can build images and run containers without touching the host's daemon. The sbx CLI installs through Homebrew, winget or Docker's install script, and sbx run claude starts an agent in a sandbox. Local sandboxes are free, including for commercial use, can work directly on host folders, and can use the host's GPU through passthrough. Cloud sandboxes run on Docker's infrastructure with no GPU and bill per second, from $0.07 an hour for 1 vCPU and 2 GB up to $1.12 an hour for 16 vCPUs and 32 GB. Stopping a cloud sandbox keeps its memory and filesystem, and a stopped sandbox isn't billed. A cloud sandbox expires after one hour by default and can't be extended past 24 hours from creation. sbx move carries the filesystem between local and cloud, but not running processes or memory. Docker labels the Agentic Platform behind cloud sandboxes experimental, and its docs describe no fork.

Northflank: microVM sandboxes inside a broader platform

Northflank runs sandboxes as Cloud Hypervisor microVMs, uses gVisor for GPU sandboxes, and offers the same runtimes on BYOC clusters in your own cloud account. Sandboxes have no time limit, and idle ones can pause to stop compute billing. It's also a general deployment platform, so it suits teams that want sandboxes, services and databases in one place. Compute starts at $0.01667 per vCPU-hour, billed by the second.

How to move code from E2B to another sandbox

Most E2B calls have a direct equivalent in other sandbox SDKs: create, run code, move files, set a timeout, snapshot, kill. Pause and fork need the most thought, because each vendor draws the line between memory and disk differently.

Here is how E2B's Python calls map onto Beam:

  • Sandbox.create(timeout=60) becomes Sandbox(keep_warm_seconds=60).create().
  • Code Interpreter's sbx.run_code(...) becomes sb.process.run_code(...), which returns stdout, stderr and the exit code. E2B runs those calls in a shared code context; Beam runs each snippet with the sandbox's Python interpreter and documents no shared context, so keep state in files or run one script.
  • sbx.set_timeout(30) becomes sb.update_ttl(30).
  • Sandbox.connect(sandbox_id) becomes Sandbox().connect(container_id).
  • sbx.fork() becomes sb.snapshot_memory() followed by Sandbox().create_from_memory_snapshot(snapshot_id).
  • sbx.pause() has no sandbox equivalent. For a machine that pauses in place with RAM intact, use a Beam VM and beam vm pause.
  • sbx.kill() becomes sb.terminate().

This example from Beam's sandbox quickstart runs code, serves a URL, then forks the running sandbox three times from a memory snapshot:

python
from beam import Sandbox

# Create a sandbox and run code
sb = Sandbox(cpu=1, memory="1Gi", keep_warm_seconds=600).create()
print(sb.process.run_code("print(sum(range(10)))").stdout)  # 45

# Start a web server and get a URL
sb.fs.write_text("/workspace/index.html", "Hello from a Beam sandbox")
sb.process.exec(
    "python3", "-m", "http.server", "8000", "--bind", "0.0.0.0",
    cwd="/workspace",
)
print(sb.expose_port(8000))

# Snapshot memory, including the running server, then fork it
snapshot_id = sb.snapshot_memory()
sb.terminate()

forks = [Sandbox().create_from_memory_snapshot(snapshot_id) for _ in range(3)]
for fork in forks:
    print(fork.list_urls())  # each fork serves its own copy
    fork.terminate()

Sandbox preview URLs are public, so add authentication in your app before serving anything sensitive. For the persistent case, beam vm new devbox creates a VM and beam vm update devbox --ttl 300 --idle-action pause --auto-resume makes it pause after five idle minutes and wake on access.

FAQ

What is an E2B sandbox?

An E2B sandbox is a Linux microVM, built on Firecracker, that an AI agent controls through E2B's Python or JavaScript SDK. The agent can run code and shell commands, edit files, install packages and, with E2B Desktop, drive a graphical desktop. Sandboxes can pause with memory intact, and each can run up to 1 hour on Hobby or 24 hours on Pro between pauses.

Who competes with E2B?

E2B's closest competitors are Daytona, Modal Sandboxes, Tensorlake, Fly.io Sprites, Vercel Sandbox, Cloudflare Sandboxes, Northflank and Beam. Docker Sandboxes compete for coding agents run on a developer's own machine, and Microsandbox for teams that want to self-host microVMs. Each makes different trade-offs on GPUs, persistence, isolation and price.

What is the best E2B alternative for AI agents?

It depends on what the agent does. A coding agent that runs short CPU jobs fits Tensorlake, the closest swap for E2B, while one that needs a GPU or a machine that keeps its RAM between sessions fits Beam's sandboxes or VMs. A computer-use agent that drives Windows apps fits Daytona, which also offers macOS on reserved Macs through use.computer.

Is E2B or Daytona better for AI agents?

E2B is the better fit for CPU agents that pause and fork often, because every E2B sandbox is a microVM that keeps memory across pause and fork. Daytona is the better fit when the agent needs a GPU or must drive Windows or macOS, but its memory pause and fork work only on VM classes. Both list $0.0504 per vCPU-hour.

Which E2B alternatives support GPUs?

Beam, Daytona, Modal, Tensorlake and Northflank offer GPU sandboxes, though Beam attaches GPUs only to sandboxes, not to its CPU-only VMs; E2B, Fly.io Sprites, Vercel Sandbox and Cloudflare don't list one. Daytona and Modal publish the widest GPU menus: eight models on Daytona, from RTX 4090 to B300 plus AMD MI355X, and ten on Modal, from T4 to B300. On Modal, Tensorlake and Northflank, GPU sandboxes run on gVisor rather than a microVM.

What is the best E2B alternative for running AI-generated code in isolated sandboxes?

For CPU-only code, Tensorlake is the closest like-for-like swap, and Vercel Sandbox is simplest if you already deploy on Vercel. If the code needs a GPU, Beam sandboxes attach one with a single argument. If the agent needs a lasting machine with a desktop, a Beam VM pauses with RAM intact and can wake on access with auto-resume.

Nathanael ChiangPublished November 8, 2026

Pay as you go
billed by the second

Give your agents their own machines

Sign up, install the CLI, and launch a sandbox, VM, or GPU from your terminal or your coding agent.