E2B
Open-source cloud code sandbox platform providing secure execution environments for AI agents using Firecracker microVMs.
At a Glance & Reviews
About E2B
E2B is a platform providing cloud-isolated execution environments for AI agents, operated by FoundryLabs, with both its software development kit and underlying runtime open-sourced under the Apache 2.0 license. It addresses the problem that code generated by agents cannot be run freely on a developer's local machine or in production environments: commands written by models may install packages, modify files, access the network, or even delete data. E2B's approach is to give each agent a dedicated isolated machine whenever a session starts, with code, commands, and file operations confined to that machine; the machine can be destroyed when the task ends, and any problem does not affect external systems. The official pricing page summarizes this positioning as giving every agent a machine.
Its isolation approach is what sets it apart from ordinary container solutions. Each sandbox runs in an independent Firecracker microVM with its own kernel, placing the isolation boundary at the virtualization layer rather than the container or process layer—this is also the technical foundation it repeatedly emphasizes for untrusted code scenarios. On top of this machine, agents can execute commands, run code, operate terminals, and read and write files, as well as use a full Linux desktop environment to operate graphical interface programs. Runtime metrics and logs can be collected by external systems, session events can be notified to business systems through signed callbacks, and business secrets are stored in a vault for use within the sandbox without handing plaintext directly to the model.
Lifecycle and persistence capabilities determine how long a task it can handle. Sandboxes can be paused; according to the official documentation, pausing saves memory and filesystem state, and resuming continues from the original state. Paused sandboxes incur no compute charges and can be retained long-term. The default single-run timeout is on the order of five minutes, with sessions extendable to one hour or twenty-four hours depending on the plan, and the Enterprise edition supports multi-day and persistent sessions. The filesystem can be saved persistently or connected to external object storage, allowing the same agent to accumulate work across multiple sessions. Network access is open by default while inbound and outbound traffic can be controlled by policy, supporting allow or deny rules by address range and allowlists by domain. The enterprise bring-your-own-cloud deployment model can install the entire runtime into the customer's own AWS, Google Cloud, or Azure account, keeping tasks involving internal data within the customer's cloud boundary.
Beyond the sandbox itself, the official platform offers several commonly used components. The Code Interpreter component builds on the sandbox to provide interactive code execution, preserved variable state, and chart output—common data analysis capabilities suited to letting models run Python step by step in a notebook-like manner and view the results. The Desktop component provides a sandbox with a graphical interface for computer-use agents to click and type. The template mechanism allows a base environment with dependencies and tools installed to be prepared as an image in advance, so new sessions can start directly from the template, eliminating the time spent reinstalling everything each time. The runtime itself is open-source and offers a single-machine deployment option, installable via Docker Compose, Terraform, or single-node Kubernetes, requiring Linux and KVM support—suitable for teams that want to first validate on their own machines or run small-scale self-hosting.
Getting started is primarily based on the cloud service. First register on the official website and obtain an API key in the console, then install the package for your language: Python projects run pip install e2b, while JavaScript projects run npm i e2b. Install the corresponding Code Interpreter package when code interpretation is needed, and the Desktop package when desktop capabilities are required. After initializing with the key in code and creating a sandbox instance, you can call the command execution method to run tasks inside the sandbox, read and write content through the file interface, and set the timeout for the session, then actively close or pause the sandbox when the task is complete. Throughout the process, business code remains orchestrated outside the sandbox, while models, prompts, and agent frameworks can continue using the developer's existing stack; E2B is only responsible for providing the machine layer.
There are four typical scenarios. The first is coding agents modifying code, installing dependencies, and running full tests in an isolated environment—if changes break, the sandbox is destroyed and recreated without polluting the developer's local machine. The second is data analysis agents executing user-uploaded scripts and data files, using the Code Interpreter to calculate step by step and produce charts, where isolation is especially important when the uploaded content itself cannot be trusted. The third is running large numbers of sessions in parallel for agent evaluation or reinforcement learning training, with one sandbox per sample, no interference between them, and unified cleanup. The fourth is enterprises deploying the runtime into their own cloud accounts so agent tasks processing internal data run within compliance boundaries, with the platform providing a SOC 2 Type II report and HIPAA-related agreements available on the Enterprise edition, subject to the official security page.
Pricing consists of a plan fee and per-second usage charges, with the current wording on the official pricing page as follows. The Hobby edition is free, includes a one-time $100 usage credit with no card required, allows sessions of up to one hour, shows ten concurrent sandboxes on the current pricing page, and uses default processor and memory specifications. The Pro edition costs $150 per month plus usage charges, allows sessions of up to twenty-four hours, includes one hundred concurrent sandboxes expandable to 1,100 for an additional fee, supports custom processor and memory specifications, and totals approximately $316 per month for an example workload of around 1,000 runtime hours in the official calculator. Usage is billed per second for running sandboxes: processors cost $0.000014 per vCPU per second, with the default two-vCPU specification costing $0.000028 per second, and four, six, and eight vCPUs scaling linearly; memory is charged separately at $0.0000045 per GiB per second, while disk space is included in the plan—10 GiB for the free edition and 20 GiB for the Pro edition. The Enterprise edition uses custom pricing, with a committed usage threshold starting at $2,000 per month, including five hundred concurrent sandboxes and support for tens of thousands of concurrent sandboxes, multi-day persistent sessions, custom specifications, and bring-your-own-cloud deployment.
Compared to services that only provide a code interpreter API, E2B's difference lies in delivering a complete isolated machine that can be paused, preserve files, control network ingress and egress, and run desktop programs, rather than merely executing a code snippet and returning a result. An agent's behavior inside more closely resembles working on a real computer. Compared to assembling virtual machines from cloud providers directly, it turns fast microVM creation, pause and resume, templates, logging, and secret management into ready-made APIs and a billing system, at the cost of requiring careful calculation of per-second usage for long sessions and high concurrency. When evaluating it, you should first run real workload samples using the free allowance, then estimate the monthly bill against the calculator on the pricing page.
Frequently Asked Questions
Is E2B free?
Partly. E2B has a free tier; higher limits or advanced features are paid. Check the official site for current plans and limits.