Hosted E2B Code Sandbox

Runs code in fresh hosted Firecracker microVMs with enforceable egress rules, streaming output, and automatic teardown.

Overview

Description

Hosted E2B Code Sandbox executes untrusted code in a fresh Firecracker microVM through the E2B provider. For each request, the adapter creates a sandbox with a bounded lifetime, maps the grant's network policy into denied internet or an explicit egress allowlist, writes the source into the sandbox home directory, runs the language-specific command, and tears the sandbox down in a finally path.

The provider supports both buffered execution and streamed stdout/stderr events followed by one terminal result. Inputs cross the boundary as a JSON environment value, and idempotency metadata can accompany sandbox creation. The capability envelope honestly declares what this implementation supports: selected languages, denied or allowlisted network, streaming, and no Dots API, secrets, or persistent filesystem. Requests for memory or CPU limits it cannot enforce fail before user code runs.

Selling Points

  • Hosted microVM isolation avoids sharing the application host kernel with untrusted code.
  • Per-run egress deny or allowlist policies constrain network access before execution begins.
  • Streaming stdout and stderr give long-running scripts useful live feedback.
  • Fresh sandbox creation and unconditional teardown keep state from leaking between customers or runs.
  • Capability honesty rejects unsupported limits and scopes instead of pretending they were enforced.

User Story

A hosted workspace runs a Python marketplace asset that may call one approved external API. Dots derives an allowlist grant, creates a short-lived E2B sandbox with only that egress, streams progress to the caller, and returns the terminal result. The microVM is killed whether the script succeeds, exits nonzero, times out, or the SDK throws, leaving no reusable environment behind.

Extension Surface

This feature is configurable. packages/code-execution/src/providers/e2b/e2b-executor.ts accepts an API key, offered languages, sandbox template, clock, ID factory, and injectable SDK factory. Network behavior follows each request's grant. The provider plugs into the broader executor seam, while E2B-specific sandbox creation remains a configured implementation rather than a further plugin registry.

Capabilities & Limits

  • It runs selected languages in per-request hosted microVMs with denied or allowlisted egress.
  • It supports buffered completion and asynchronous stdout/stderr streaming.
  • It maps nonzero exits and unsupported limits into stable terminal outcomes and always attempts teardown.
  • Limit: Dots API transport, secret injection, persistent filesystem, and direct memory/CPU-limit enforcement are not offered by this provider.

Implementation Map

  • packages/code-execution/src/providers/e2b/e2b-executor.ts
  • packages/code-execution/src/providers/e2b/e2b-sandbox.ts
  • packages/code-execution/src/providers/e2b/languages.ts
  • packages/code-execution/src/providers/e2b/index.ts

Properties

Property
Value
product
dots-platform
extensibility
configurable
module
Code Execution
packages
code-execution
status
shipped
surface
api
summary
Runs code in fresh hosted Firecracker microVMs with enforceable egress rules, streaming output, and automatic teardown.

Connections

Hosted E2B Code Sandbox · Explore connections

  • complementstoLocal Docker Code Sandbox
  • implemented bytopackages/code-execution/src/providers/e2b/index.ts
  • implemented bytopackages/code-execution/src/providers/e2b/e2b-sandbox.ts
  • implemented bytopackages/code-execution/src/providers/e2b/e2b-executor.ts
  • implemented bytopackages/code-execution/src/providers/e2b/languages.ts
  • extendstoPluggable Code Execution Sandboxes
  • complementsfromLocal Docker Code Sandbox
  • complementsfromPluggable Code Execution Sandboxes

Connected Records8

Complements
Extends
Implemented by
packages/code-execution/src/providers/e2b/e2b-executor.ts
packages/code-execution/src/providers/e2b/e2b-sandbox.ts
packages/code-execution/src/providers/e2b/index.ts
packages/code-execution/src/providers/e2b/languages.ts
8 connections.