Skip to content
/

E2B Desktop Sandbox

e2b-desktop · e2b-dev/desktop · ★ 1.4k · last commit 2026-05-26

Primitive shape
No installable primitives
00

Summary

E2B Desktop Sandbox — Summary

E2B Desktop Sandbox is an open-source secure virtual desktop environment for LLM-based Computer Use, built on top of the E2B Sandbox API. It provides an isolated graphical desktop (Xvfb + VNC) that agents can connect to for screenshots, mouse/keyboard input, application launching, and window streaming. The SDK ships in Python (e2b-desktop) and JavaScript (@e2b/desktop), with each sandbox isolated per session and customizable with arbitrary dependencies. Startup is fast (seconds) via the E2B cloud API; no local Docker or VM setup required from the user.

E2B Desktop is most similar to the e2b framework from the seed comparison (canonical sandboxes batch), but this is the Desktop-specific surface: the base e2b package provides code execution, while e2b-desktop adds graphical environment + Computer Use capabilities on top. It differs from microsandbox and cubesandbox seeds in that it is a managed cloud API (not self-hosted), from daytona in that it is ephemeral/disposable rather than persistent dev environments, and from capsule in scope (desktop/GUI vs. code execution only).

01

Overview

E2B Desktop Sandbox — Overview

Origin

Built by the E2B team as an extension of the E2B Sandbox platform specifically for Computer Use (GUI automation) use cases. Powered by the E2B cloud infrastructure — the same MicroVM-based isolation used for code execution sandboxes, extended with a graphical desktop environment.

Philosophy

From the README:

"E2B Desktop Sandbox is an open source secure virtual desktop ready for Computer Use. Powered by E2B. Each sandbox is isolated from the others and can be customized with any dependencies you want."

The design philosophy is "secure + disposable": each sandbox is fully isolated, can be killed when done, and starts fresh. Desktop access is via streaming (not full RDP) to minimize bandwidth while providing real GUI control for agents.

Key Capabilities

  • Screenshots: Capture desktop or specific window state
  • Mouse/keyboard input: Click, type, scroll
  • Application launch: desktop.launch('google-chrome'), desktop.launch('vscode'), etc.
  • Window streaming: Real-time screen stream with auth key
  • Process management: Run, list, kill processes
  • File system: Read, write files inside sandbox

Open Computer Use

Related project e2b-dev/open-computer-use: Computer Use made with 100% open-source LLMs — uses this Desktop Sandbox.

Surf

Related project e2b-dev/surf: OpenAI Computer Use Agent using E2B's Desktop Sandbox, built as a Next.js app.

02

Architecture

E2B Desktop Sandbox — Architecture

Distribution

  • Python: pip install e2b-desktop
  • JavaScript: npm install @e2b/desktop
  • No self-hosting — cloud API only (requires E2B API key)

Directory Structure (Monorepo)

packages/
  python/           # e2b-desktop Python SDK
  javascript/       # @e2b/desktop JavaScript SDK
examples/
  basic-python/
  basic-javascript/
  streaming-apps-python/
  streaming-apps-javascript/
template/           # Base sandbox image definition
readme-assets/

Required Runtime

  • E2B API key (E2B_API_KEY env var)
  • Python >= 3.8 (for Python SDK) or Node.js (for JS SDK)
  • No local Docker, no local VM setup required

Sandbox Architecture

  • Base: E2B Sandbox (MicroVM via Firecracker)
  • Desktop layer: Xvfb (virtual framebuffer) + VNC server
  • Streaming: Authenticated stream URL per window or full desktop
  • Isolation: Per-sandbox network and filesystem isolation
  • Startup: Seconds (MicroVM cold start)

Install Complexity

One-liner (pip install e2b-desktop or npm install @e2b/desktop). Multi-step for E2B account + API key setup.

Target AI Tools

Any agent framework (Python or JS) — not tied to a specific AI client. Used with OpenAI, Anthropic, open-source LLMs.

Stream Architecture

Sandbox (cloud VM)
  ├── Xvfb (virtual display)
  ├── VNC server
  └── Stream auth key
        → Client-side stream URL
        → Agent screenshot/input
03

Components

E2B Desktop Sandbox — Components

Python SDK (e2b_desktop)

Sandbox Class

  • Sandbox.create() — Create new desktop sandbox (cloud API call)
  • desktop.launch(app) — Launch application (google-chrome, vscode, firefox, etc.)
  • desktop.wait(ms) — Wait for app to load
  • desktop.kill() — Destroy sandbox

Stream API

  • desktop.stream.start(window_id, require_auth) — Start screen stream
  • desktop.stream.get_auth_key() — Get auth token for stream URL
  • desktop.stream.get_url(auth_key) — Get streamable URL
  • desktop.stream.stop() — Stop current stream (one stream at a time)
  • desktop.get_current_window_id() — Get active window ID

Input API

  • desktop.mouse.move(x, y) — Mouse move
  • desktop.mouse.click(x, y) — Mouse click
  • desktop.keyboard.type(text) — Type text
  • desktop.keyboard.press(key) — Press key

Screenshot API

  • desktop.screenshot() — Capture full desktop or window

Process API

  • desktop.process.start(cmd) — Start process
  • desktop.process.list() — List running processes

File API

  • desktop.files.read(path) — Read file
  • desktop.files.write(path, content) — Write file

JavaScript SDK (@e2b/desktop)

Mirror of Python API with async/await patterns. Same capabilities.

Templates

  • template/ — Base sandbox image definition (used to customize pre-installed dependencies)

Examples

  • examples/basic-python/ — Minimal create/launch/stream/kill
  • examples/basic-javascript/ — Same in JS
  • examples/streaming-apps-python/ — Window streaming examples
  • examples/streaming-apps-javascript/ — Same in JS
05

Prompts

E2B Desktop Sandbox — Prompts

Verbatim Excerpt 1: Python SDK Usage (from README)

from e2b_desktop import Sandbox

# Create a new desktop sandbox
desktop = Sandbox.create()

# Launch an application
desktop.launch('google-chrome')  # or vscode, firefox, etc.

# Wait 10s for the application to open
desktop.wait(10000)

# Stream the application's window
desktop.stream.start(
    window_id=desktop.get_current_window_id(),
    require_auth=True
)

# Get the stream auth key
auth_key = desktop.stream.get_auth_key()

# Print the stream URL
print('Stream URL:', desktop.stream.get_url(auth_key=auth_key))

# Kill the sandbox after the tasks are finished
# desktop.kill()

Technique: This is a runtime API, not a prompt file. The "prompting" is the agent's screenshot analysis + action decision loop that the user builds on top. E2B Desktop provides the execution surface, not the cognitive layer.


Verbatim Excerpt 2: JavaScript SDK (from README)

import { Sandbox } from '@e2b/desktop'

const desktop = await Sandbox.create()

await desktop.launch('google-chrome')
await desktop.wait(10000)

await desktop.stream.start({
  windowId: await desktop.getCurrentWindowId(),
  requireAuth: true,
})

const authKey = desktop.stream.getAuthKey()
console.log('Stream URL:', desktop.stream.getUrl({ authKey }))

Technique: Same pattern in async JS. The sandbox is a thin API client — all agent logic is user-implemented.


Observations

E2B Desktop ships zero pre-authored agent behavior prompts. It is purely an execution environment SDK. Prompt content and agent behavior are entirely user-defined. This is the same profile as the base e2b seed — a platform, not a behavioral framework.

09

Uniqueness

E2B Desktop Sandbox — Uniqueness

Differs From Seeds

E2B Desktop is a secondary surface of the e2b canonical sandbox from Phase B Batch 18/33. The base e2b seed handles code execution; this e2b-desktop package adds a graphical desktop environment with VNC streaming for Computer Use. Compared to microsandbox (self-hosted MicroVM, code-only) and cubesandbox (lightweight container), E2B Desktop is unique in providing a full graphical display (Xvfb + VNC) with window streaming and mouse/keyboard input — the only one in the corpus targeting GUI Computer Use natively. Compared to daytona (persistent dev environments), E2B Desktop is ephemeral/disposable. The agent-infra-sandbox (this batch) offers broader surface (Browser + Shell + VSCode + MCP in one Docker container) but lacks the MicroVM isolation guarantee.

Positioning

The minimal, cloud-managed primitive for LLM Computer Use. "Bring your own agent" philosophy — E2B provides the VM, you provide the intelligence.

Observable Failure Modes

  1. API key required: No offline/local mode — every sandbox creation requires E2B cloud API
  2. One stream at a time: Only one window stream active per sandbox — limits parallel visual monitoring
  3. No sandbox pools for Desktop: Base E2B has pool pre-warming; Desktop variant's pool support is unclear
  4. Ephemeral by default: No built-in snapshot for Desktop sandboxes (base sandbox has snapshots)
  5. Cost scales with usage: Cloud VM per sandbox; parallel agents get costly fast

What Makes It Interesting

Clean Computer Use primitive — the simplest possible API for giving an LLM access to a real GUI environment without local VM setup. The open-computer-use companion project demonstrates end-to-end with open-source models.

04

Workflow

E2B Desktop Sandbox — Workflow

Typical Agent Workflow

Phase Artifact Description
Setup API key + SDK install pip install e2b-desktop, set E2B_API_KEY
Create Sandbox Sandbox.create() cloud call Allocates MicroVM with desktop
Launch App desktop.launch(app) Start target application
Connect Stream stream.start() + get_url() Get authenticated stream URL
Agent Loop screenshot → action → screenshot Capture state, decide action, execute
Cleanup desktop.kill() Destroy sandbox (or auto-expire)

Agent Loop Pattern

desktop = Sandbox.create()
desktop.launch('google-chrome')
desktop.wait(10000)

# Agent loop
while not done:
    screenshot = desktop.screenshot()  # capture state
    action = llm_decide(screenshot)    # LLM decision
    execute_action(desktop, action)    # mouse/keyboard

Approval Gates

None — the sandbox is a tool, not an agent framework with gates. All control flow is in the user's agent code.

Isolation Guarantees

  • Network isolation: each sandbox has isolated network namespace
  • Filesystem isolation: per-sandbox ephemeral filesystem
  • Process isolation: MicroVM-level (Firecracker)

Startup Time

Seconds (E2B claims fast MicroVM cold start). Pool/warmup not available in the Desktop variant (unlike base E2B sandbox pools).

Custom Dependencies

Via template/ — customize the sandbox image with pre-installed packages, browsers, or applications.

06

Memory Context

E2B Desktop Sandbox — Memory & Context

State Storage

None built-in. Sandbox filesystem is ephemeral — destroyed on kill().

Memory Type

None. The sandbox itself has no memory or context management. Any state persistence must be implemented by the user (write to files, copy out, etc.).

Cross-Session Handoff

None natively. Users can copy files out of sandbox before killing, or use E2B's snapshot capability (from the base E2B SDK) for persistence.

Compaction

Not applicable.

Sandbox Filesystem

  • Ephemeral per-sandbox
  • Read/write via desktop.files.read/write API
  • All data destroyed on sandbox kill

Screenshot State

Screenshots are returned as binary data to the calling agent — not stored in the sandbox.

Stream Authentication

Each stream has an auth key — stateless per stream session.

Notes

The Desktop Sandbox is a stateless execution environment. Any memory, context compaction, or cross-session state management must be implemented externally by the agent consuming the sandbox API.

07

Orchestration

E2B Desktop Sandbox — Orchestration

Multi-Agent Support

No — individual sandbox per agent instance. Multi-agent coordination is not part of the Desktop Sandbox API.

Orchestration Pattern

None — the sandbox is a tool/primitive. Orchestration is user-defined.

Isolation Mechanism

MicroVM (Firecracker-based, via E2B cloud infrastructure). Each sandbox = separate VM with isolated network, filesystem, and process namespace.

Subagent Definition Format

Not applicable.

Multi-Model Usage

Not applicable — the Desktop Sandbox is model-agnostic.

Execution Mode

One-shot per sandbox lifecycle. Create → use → kill. No persistent daemon.

Startup Time

Seconds (cloud-managed MicroVM cold start).

Concurrency

Multiple sandboxes can run concurrently — each is an independent cloud VM instance. No built-in coordination between them.

Consensus Mechanism

None.

Crash Recovery

No — if sandbox crashes, create a new one. No checkpoint/restore in Desktop variant.

Context Compaction

Not applicable.

Cross-Session Handoff

None natively. Users export files before kill if needed.

Streaming Output

Yes — authenticated stream URL for real-time screen sharing.

08

Ui Cli Surface

E2B Desktop Sandbox — UI / CLI Surface

CLI Binary

None. Python/JS SDK only.

Local Web UI

None. The sandbox streams to any URL — the user accesses the stream via authenticated URL in any browser. Not a local dashboard.

Stream URL

  • Format: https://<stream-endpoint>?auth=<key>
  • Can be opened in any browser for visual monitoring of sandbox
  • Agent reads screenshots programmatically (not via browser)

Observability

None built-in at SDK level. E2B dashboard (cloud console) provides sandbox lifecycle visibility, but this is external to the SDK.

IDE Integration

None. SDK is used from Python or JS scripts.

Cross-Tool Portability

High — works with any Python/JS agent framework. Not tied to Claude Code, Cursor, or any specific AI tool.

Programmatic Access Points

  • Screenshot API (returns image bytes)
  • Authenticated stream URL (browser-viewable)
  • File read/write
  • Process management
  • Mouse/keyboard input

E2B Cloud Console

External web dashboard at e2b.dev for managing sandboxes, API keys, and billing. Not part of the open-source repo.

Related frameworks

same archetype · same primary tool · same memory type

Daytona ★ 72k

Provide secure, elastic, sub-90ms sandbox compute infrastructure for running AI-generated code, accessible via multi-language…

CUA ★ 17k

Unified SDK for building, benchmarking, and deploying agents that interact with full OS GUIs via isolated VMs.

E2B ★ 12k

Run AI-generated code safely in cloud-hosted isolated sandboxes via a 3-line SDK integration.

OpenSandbox ★ 11k

Protocol-first general-purpose sandbox platform for AI applications with multi-language SDKs and pluggable isolation backends.

Microsandbox ★ 6.3k

Spawn hardware-isolated microVMs as child processes directly from application code, with no server setup, in under 100ms.

CubeSandbox ★ 5.9k

Sub-60ms KVM microVM sandboxes for AI agents with E2B drop-in compatibility and <5MB memory overhead.