# e2b-dev/e2b architecture

> Architecture diagram of the GitHub repository e2b-dev/e2b, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/e2b-dev/e2b
- Repository: https://github.com/e2b-dev/e2b

## Overview

E2B is a cloud sandbox platform exposed through JavaScript and Python SDKs, with a CLI and specialized Code Interpreter and Desktop packages. The principal workflow is to configure a client, create or connect to a sandbox, then execute commands or interact with its files and processes. Template building, volumes, sandbox lifecycle controls, code interpretation, and desktop automation are distinct capabilities. The graph emphasizes Python SDK paths where source relationships are indexed or excerpted; other package links follow README-described capabilities, so some connections remain undocumented at source level.

Main entry points: [`packages/python-sdk/e2b/sandbox_sync/main.py`](https://github.com/e2b-dev/e2b/blob/main/packages/python-sdk/e2b/sandbox_sync/main.py) (Sandbox Lifecycle), [`packages/python-sdk/e2b/__init__.py`](https://github.com/e2b-dev/e2b/blob/main/packages/python-sdk/e2b/__init__.py) (SDK Exports), [`packages/desktop-python/e2b_desktop/main.py`](https://github.com/e2b-dev/e2b/blob/main/packages/desktop-python/e2b_desktop/main.py) (Desktop Controls), [`packages/python-sdk/e2b/template/main.py`](https://github.com/e2b-dev/e2b/blob/main/packages/python-sdk/e2b/template/main.py) (Template Builder)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sdk["Core SDKs"]
  node_sdk_entry["SDK Exports<br/>[__init__.py]"]
  node_client_config["Client Setup"]
end

subgraph group_sandbox["Sandbox Runtime"]
  node_sandbox_api["Sandbox Lifecycle<br/>[main.py]"]
  node_sandbox_async["Async Sandbox<br/>[main.py]"]
  node_sandbox_base["Sandbox Base<br/>[main.py]"]
  node_envd["Sandbox Interface<br/>[api.py]"]
  node_commands["Command Execution<br/>[command_handle.py]"]
  node_filesystem["File Operations<br/>[filesystem.py]"]
  node_git["Sandbox Git<br/>[git.py]"]
end

subgraph group_extensions["Specialized SDKs"]
  node_code_client["Code Interpreter<br/>[client.ts]"]
  node_code_runtime["Code Execution<br/>[sandbox.ts]"]
  node_desktop_client["Desktop SDK<br/>[client.py]"]
  node_desktop_runtime["Desktop Controls<br/>[main.py]"]
end

subgraph group_build["Templates and Storage"]
  node_template_builder["Template Builder<br/>[main.py]"]
  node_template_build["Build Workflow<br/>[main.py]"]
  node_volume["Persistent Volumes<br/>[volume_sync.py]"]
end

node_developer(("Developer"))
node_cloud["E2B Cloud"]

node_developer -->|"uses"| node_sdk_entry
node_sdk_entry -->|"exports"| node_sandbox_api
node_sdk_entry -->|"exports"| node_client_config
node_sdk_entry -->|"exports"| node_template_builder
node_sdk_entry -->|"exports"| node_volume
node_client_config -.->|"configures requests"| node_cloud
node_sandbox_api -->|"uses"| node_sandbox_base
node_sandbox_api -->|"uses"| node_envd
node_sandbox_async -->|"uses"| node_sandbox_base
node_sandbox_async -->|"uses"| node_envd
node_sandbox_api -->|"controls sandboxes"| node_cloud
node_sandbox_api -->|"exposes"| node_commands
node_sandbox_api -->|"exposes"| node_filesystem
node_sandbox_api -->|"exposes"| node_git
node_developer -->|"defines template"| node_template_builder
node_template_builder -->|"builds with"| node_template_build
node_template_build -.->|"submits build"| node_cloud
node_developer -.->|"uses"| node_volume
node_developer -->|"installs and uses"| node_code_client
node_code_client -->|"creates"| node_code_runtime
node_code_runtime -->|"extends sandbox"| node_sandbox_api
node_developer -->|"installs and uses"| node_desktop_client
node_desktop_client -->|"creates"| node_desktop_runtime
node_desktop_runtime -->|"runs desktop commands"| node_commands
node_desktop_runtime -->|"reads screenshots"| node_filesystem

click node_sdk_entry "https://github.com/e2b-dev/e2b/blob/main/packages/python-sdk/e2b/__init__.py"
click node_client_config "https://github.com/e2b-dev/e2b/blob/main/packages/python-sdk/e2b/connection_config.py"
click node_sandbox_api "https://github.com/e2b-dev/e2b/blob/main/packages/python-sdk/e2b/sandbox_sync/main.py"
click node_sandbox_async "https://github.com/e2b-dev/e2b/blob/main/packages/python-sdk/e2b/sandbox_async/main.py"
click node_sandbox_base "https://github.com/e2b-dev/e2b/blob/main/packages/python-sdk/e2b/sandbox/main.py"
click node_envd "https://github.com/e2b-dev/e2b/blob/main/packages/python-sdk/e2b/envd/api.py"
click node_commands "https://github.com/e2b-dev/e2b/blob/main/packages/python-sdk/e2b/sandbox/commands/command_handle.py"
click node_filesystem "https://github.com/e2b-dev/e2b/blob/main/packages/python-sdk/e2b/sandbox/filesystem/filesystem.py"
click node_git "https://github.com/e2b-dev/e2b/blob/main/packages/python-sdk/e2b/sandbox_sync/git.py"
click node_template_builder "https://github.com/e2b-dev/e2b/blob/main/packages/python-sdk/e2b/template/main.py"
click node_template_build "https://github.com/e2b-dev/e2b/blob/main/packages/python-sdk/e2b/template_sync/main.py"
click node_volume "https://github.com/e2b-dev/e2b/blob/main/packages/python-sdk/e2b/volume/volume_sync.py"
click node_code_client "https://github.com/e2b-dev/e2b/blob/main/packages/code-interpreter-js/src/client.ts"
click node_code_runtime "https://github.com/e2b-dev/e2b/blob/main/packages/code-interpreter-js/src/sandbox.ts"
click node_desktop_client "https://github.com/e2b-dev/e2b/blob/main/packages/desktop-python/e2b_desktop/client.py"
click node_desktop_runtime "https://github.com/e2b-dev/e2b/blob/main/packages/desktop-python/e2b_desktop/main.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_sdk_entry,node_client_config toneBlue
class node_sandbox_api,node_sandbox_async,node_sandbox_base,node_envd,node_commands,node_filesystem,node_git toneAmber
class node_code_client,node_code_runtime,node_desktop_client,node_desktop_runtime toneMint
class node_template_builder,node_template_build,node_volume toneRose
class node_developer,node_cloud toneIndigo
```

## Components

### Core SDKs

- [SDK Exports](https://github.com/e2b-dev/e2b/blob/main/packages/python-sdk/e2b/__init__.py): `packages/python-sdk/e2b/__init__.py`
- [Client Setup](https://github.com/e2b-dev/e2b/blob/main/packages/python-sdk/e2b/connection_config.py): `packages/python-sdk/e2b/connection_config.py`

### Sandbox Runtime

- [Sandbox Lifecycle](https://github.com/e2b-dev/e2b/blob/main/packages/python-sdk/e2b/sandbox_sync/main.py): `packages/python-sdk/e2b/sandbox_sync/main.py`
- [Async Sandbox](https://github.com/e2b-dev/e2b/blob/main/packages/python-sdk/e2b/sandbox_async/main.py): `packages/python-sdk/e2b/sandbox_async/main.py`
- [Sandbox Base](https://github.com/e2b-dev/e2b/blob/main/packages/python-sdk/e2b/sandbox/main.py): `packages/python-sdk/e2b/sandbox/main.py`
- [Sandbox Interface](https://github.com/e2b-dev/e2b/blob/main/packages/python-sdk/e2b/envd/api.py): `packages/python-sdk/e2b/envd/api.py`
- [Command Execution](https://github.com/e2b-dev/e2b/blob/main/packages/python-sdk/e2b/sandbox/commands/command_handle.py): `packages/python-sdk/e2b/sandbox/commands/command_handle.py`
- [File Operations](https://github.com/e2b-dev/e2b/blob/main/packages/python-sdk/e2b/sandbox/filesystem/filesystem.py): `packages/python-sdk/e2b/sandbox/filesystem/filesystem.py`
- [Sandbox Git](https://github.com/e2b-dev/e2b/blob/main/packages/python-sdk/e2b/sandbox_sync/git.py): `packages/python-sdk/e2b/sandbox_sync/git.py`

### Specialized SDKs

- [Code Interpreter](https://github.com/e2b-dev/e2b/blob/main/packages/code-interpreter-js/src/client.ts): `packages/code-interpreter-js/src/client.ts`
- [Code Execution](https://github.com/e2b-dev/e2b/blob/main/packages/code-interpreter-js/src/sandbox.ts): `packages/code-interpreter-js/src/sandbox.ts`
- [Desktop SDK](https://github.com/e2b-dev/e2b/blob/main/packages/desktop-python/e2b_desktop/client.py): `packages/desktop-python/e2b_desktop/client.py`
- [Desktop Controls](https://github.com/e2b-dev/e2b/blob/main/packages/desktop-python/e2b_desktop/main.py): `packages/desktop-python/e2b_desktop/main.py`

### Templates and Storage

- [Template Builder](https://github.com/e2b-dev/e2b/blob/main/packages/python-sdk/e2b/template/main.py): `packages/python-sdk/e2b/template/main.py`
- [Build Workflow](https://github.com/e2b-dev/e2b/blob/main/packages/python-sdk/e2b/template_sync/main.py): `packages/python-sdk/e2b/template_sync/main.py`
- [Persistent Volumes](https://github.com/e2b-dev/e2b/blob/main/packages/python-sdk/e2b/volume/volume_sync.py): `packages/python-sdk/e2b/volume/volume_sync.py`

### Other components

- **Developer**
- **E2B Cloud**

## Connections

- Developer → SDK Exports: uses (evidence: `README.md`)
- SDK Exports → Sandbox Lifecycle: exports (evidence: `packages/python-sdk/e2b/__init__.py`)
- SDK Exports → Client Setup: exports (evidence: `packages/python-sdk/e2b/__init__.py`)
- SDK Exports → Template Builder: exports (evidence: `packages/python-sdk/e2b/__init__.py`)
- SDK Exports → Persistent Volumes: exports (evidence: `packages/python-sdk/e2b/__init__.py`)
- Client Setup → E2B Cloud: configures requests
- Sandbox Lifecycle → Sandbox Base: uses (evidence: `packages/python-sdk/e2b/sandbox_sync/main.py`)
- Sandbox Lifecycle → Sandbox Interface: uses (evidence: `packages/python-sdk/e2b/sandbox_sync/main.py`)
- Async Sandbox → Sandbox Base: uses (evidence: `packages/python-sdk/e2b/sandbox_async/main.py`)
- Async Sandbox → Sandbox Interface: uses (evidence: `packages/python-sdk/e2b/sandbox_async/main.py`)
- Sandbox Lifecycle → E2B Cloud: controls sandboxes (evidence: `README.md`)
- Sandbox Lifecycle → Command Execution: exposes (evidence: `packages/python-sdk/e2b/sandbox_sync/main.py`)
- Sandbox Lifecycle → File Operations: exposes (evidence: `packages/python-sdk/e2b/sandbox_sync/main.py`)
- Sandbox Lifecycle → Sandbox Git: exposes (evidence: `packages/python-sdk/e2b/sandbox_sync/main.py`)
- Developer → Template Builder: defines template (evidence: `packages/python-sdk/e2b/template/main.py`)
- Template Builder → Build Workflow: builds with (evidence: `packages/python-sdk/e2b/template_sync/main.py`)
- Build Workflow → E2B Cloud: submits build
- Developer → Persistent Volumes: uses
- Developer → Code Interpreter: installs and uses (evidence: `README.md`)
- Code Interpreter → Code Execution: creates (evidence: `packages/code-interpreter-js/src/client.ts`)
- Code Execution → Sandbox Lifecycle: extends sandbox (evidence: `README.md`)
- Developer → Desktop SDK: installs and uses (evidence: `README.md`)
- Desktop SDK → Desktop Controls: creates (evidence: `packages/desktop-python/e2b_desktop/client.py`)
- Desktop Controls → Command Execution: runs desktop commands (evidence: `packages/desktop-python/e2b_desktop/main.py`)
- Desktop Controls → File Operations: reads screenshots (evidence: `packages/desktop-python/e2b_desktop/main.py`)
