What Is E2B? Code Sandboxes for AI Agents Explained
When an agent writes code, something has to run it. Your production server is the wrong place. E2B is an open-source service that gives agents isolated cloud sandboxes for that job. You start one from an SDK and run code or shell commands in it. Then you throw it away. Below is how E2B sandboxes work as of October 2026 and what they cost. We also look at what state survives a pause, a timeout or a kill.
What is E2B, in one sentence?
E2B is an open-source cloud service that starts isolated Linux virtual machines on demand so AI agents can run code safely.
The E2B docs describe "isolated sandboxes that let agents safely execute code." Each sandbox is a Linux VM that you control through the SDKs, published as the e2b package on npm and PyPI. A separate Code Interpreter SDK adds a Jupyter-style runtime for data analysis. The GitHub repository is Apache-2.0 licensed. It points to a separate infrastructure repo for running E2B in your own cloud account.
E2B raised a $21 million Series A led by Insight Partners on July 28, 2025. Total funding is now $32 million. In that post, E2B said 88% of the Fortune 100 had signed up for its platform.
How does an E2B sandbox differ from a local Docker container?
The usual alternative is running agent code in a container on your own machine or cluster. Both isolate code. They differ in who runs the fleet and what happens to state.
| E2B sandbox | Local Docker container | |
|---|---|---|
| Isolation | Separate Linux VM per sandbox | Shared host kernel |
| Where it runs | E2B's cloud, or your cloud through BYOC or self-hosting | Your machine or cluster |
| Start | One SDK call, from a prebuilt template | You build and run the image |
| Default lifetime | 5 minutes, then killed | Until you stop it |
| Saving state | Pause keeps filesystem and memory | Volumes and image layers |
| Billing | Per second of vCPU and RAM | Your own infrastructure cost |
Lifetime and pause details come from the sandbox lifetime FAQ and the persistence docs.
How does E2B work?
You call Sandbox.create from the SDK, and E2B starts a VM from a template. Templates are defined in code with E2B's Template SDK, starting from a base image. The template quickstart explains that a template's start command runs during the build and is captured in a snapshot. A sandbox made from it starts with that process already running. E2B describes this as "zero wait time."
Inside the sandbox, the agent can run commands and work with files. Internet access is on by default. The network docs show how to turn it off or limit outbound traffic with allow and deny lists by IP range or domain. Domain filtering covers HTTP on port 80 and TLS on port 443.
Every sandbox has a timeout. The default is 5 minutes, and you can change it at creation or extend it later. Continuous runtime is capped at 1 hour on the free Hobby plan and 24 hours on Pro.
What does E2B cost?
E2B bills compute per second. The pricing page listed these plans in October 2026:
| Plan | Monthly fee | Credits | Max continuous runtime | Concurrent sandboxes |
|---|---|---|---|---|
| Hobby | $0 | $100 once | 1 hour | 20 |
| Pro | $150 plus usage | None listed | 24 hours | 100, or more with add-ons |
| Enterprise | Custom, $3,000 monthly usage minimum | Custom | Custom | Custom |
Usage costs $0.000014 per vCPU-second and $0.0000045 per GiB-second of RAM, and storage is free. A sandbox can have 1 to 8 vCPUs and 1 to 8 GiB of RAM. The default is 2 vCPUs and 4 GiB, so an hour on the default size costs about 17 cents by our arithmetic. Sandboxes are CPU-only.
What survives when an E2B sandbox ends?
By default, nothing. When the timeout hits, the default action is to kill the sandbox. The lifetime FAQ is direct: "A killed sandbox cannot be resumed, and its state is gone."
E2B offers three ways to keep state:
- Pause and resume. Pausing saves the filesystem and memory, including running processes and loaded variables. It takes about 4 seconds per GiB of RAM, and resuming takes about 1 second. Paused sandboxes are kept indefinitely until you kill them. The lifetime FAQ says they are not billed and do not count toward your concurrency limit.
- Pause on timeout. Set the timeout action to pause, and every timeout becomes a pause. Services in a paused sandbox are unreachable, and clients have to reconnect after resume.
- Volumes. Volumes are storage that lives apart from any sandbox and can be mounted into new ones. They were in private beta when we checked.
All three keep machine state. What the agent learned along the way, such as a failed install command or a flaky test, stays in its conversation. E2B never sees it.
What should you read in the fine print?
The adoption numbers are E2B's own. The 88% Fortune 100 figure counts companies "signed up," and the "hundreds of millions of sandbox sessions" in the Series A post have no published method. The zero-wait startup is also a vendor description.
Check plan limits before you design around them. A 1-hour cap on Hobby rules out long jobs unless you pause and resume, which resets the runtime clock. E2B posted a postmortem for a service disruption on January 13, 2026, so plan for retries as you would with any cloud dependency.
The bottom line
Use E2B when your agent needs to run code you did not write and you want each run isolated and disposable. Start on Hobby with the $100 credit and set explicit timeouts. For any sandbox whose state you care about, make the timeout action pause. Store project knowledge in the agent's memory layer, outside the sandbox.
How do you keep what an agent learned in a disposable sandbox?
A coding agent that runs work in E2B can lose its lessons each time a sandbox is killed, and by default that happens after 5 minutes. Pausing keeps the files. The pip pin your agent discovered after three failed installs needs a home that outlives every sandbox.
memU keeps them as a shared wiki of readable Markdown files. A scheduled background task slices new session logs from the agent host into jobs. The agent decides what is worth keeping and writes it as memory or skill Markdown. memU's memory service makes no LLM calls: it stores and retrieves what the agent prepared. A standing instruction in CLAUDE.md or AGENTS.md tells the agent to retrieve before answering. memU is not an E2B integration. It works at the host level, with Claude Code or Codex. When one of those agents drives an E2B sandbox, that work is part of the host's session log, which memU processes like any other.
To try the hosted version, which is free and syncs across devices, get an API key from memu.so and send your agent one message:
Read https://memu.pro/SKILL.md, follow its instructions to install and configure memU, API Key is
YOUR_MEMU_API_KEY.
The self-hosted setup and the list of supported agents are in the memU GitHub repository.
FAQ
Is E2B free?
There is a free Hobby plan with a one-time $100 usage credit. It allows up to 20 concurrent sandboxes with a 1-hour runtime cap. Pro costs $150 a month plus usage.
How long does an E2B sandbox live?
The default timeout is 5 minutes, and you can raise it. Continuous runtime is capped at 1 hour on Hobby and 24 hours on Pro, and pausing resets that clock.
Does E2B keep files after a sandbox stops?
Not if the sandbox is killed, which is the default on timeout. If you pause it instead, E2B keeps its full state until you kill it.
Is E2B open source?
Yes. The E2B repository on GitHub is licensed under Apache-2.0. The infrastructure can also be self-hosted in your own cloud.
Can E2B sandboxes access the internet?
Yes, outbound internet access is on by default. You can turn it off when creating a sandbox or restrict it with allow and deny lists.