Skip to main content

Documentation Index

Fetch the complete documentation index at: https://e2b-squash-sandbox-pages.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

An E2B sandbox is a persistent, secure cloud environment where your AI agents execute code, run commands, manage files, and access the internet. Every sandbox supports pause and resume — when a sandbox times out, it can automatically pause and preserve its full state (filesystem and memory), then resume exactly where it left off when activity arrives.

Key characteristics

  • Persistent by default — configure onTimeout: 'pause' and sandboxes preserve their full state (filesystem + memory) indefinitely. Resume at any time.
  • Auto-resume — when enabled, paused sandboxes wake automatically when SDK calls or HTTP traffic arrive. No manual state management needed.
  • Snapshots — capture a running sandbox’s state and spawn multiple new sandboxes from it. Useful for checkpointing, forking, and rollback.
  • Configurable timeouts — sandboxes run for up to 24 hours (Pro) or 1 hour (Base) continuously. Pausing resets the runtime window.
  • Isolated and secure — each sandbox runs in its own microVM with network controls, access tokens, and rate limits.

Quick setup: persistent sandbox

import { Sandbox } from 'e2b'

const sandbox = await Sandbox.create({
  timeoutMs: 5 * 60 * 1000,
  lifecycle: {
    onTimeout: 'pause',     // pause instead of kill on timeout
    autoResume: true,        // wake on activity
  },
})

// Use the sandbox — it auto-pauses when idle, auto-resumes when needed
const result = await sandbox.commands.run('echo "Hello from a persistent sandbox"')
console.log(result.stdout)

Core

Managing sandboxes

Timeouts, sandbox info, metadata, listing, filtering, and shutdown.

Pause, resume & snapshots

Pause/resume, auto-pause, auto-resume, snapshots, and state transitions.

Commands

Run commands, stream output, interactive terminal (PTY), and SSH access.

Filesystem

Read, write, upload, download files and watch for changes.

Volumes

Persistent storage that survives sandbox lifecycle.

MCP gateway

Connect to 200+ tools through the Model Context Protocol.

Environment variables

Default metadata, global variables, and per-command overrides.

Connect storage bucket

Mount GCS, S3, or R2 buckets inside sandboxes.

Security

Secured access, network controls, and rate limits.

Observability

Metrics, lifecycle events API, and webhooks.

Guides

Runtime customization

Install packages, upload files, and configure sandboxes dynamically.

Git integration

Clone repos, manage branches, push changes.

Proxy tunneling

Route sandbox traffic through a proxy server.

Custom domain

Set up a custom domain for sandbox access.