diff --git a/docs.json b/docs.json index f1410c9..0d035fa 100644 --- a/docs.json +++ b/docs.json @@ -36,158 +36,39 @@ "docs/quickstart/install-custom-packages" ] }, - "docs/api-key", - "docs/cookbook", - "docs/support" + "docs/api-key" ] }, { - "group": "Code Interpreting", + "group": "Use Case Examples", "pages": [ - { - "group": "Analyze data with AI", - "pages": [ - "docs/code-interpreting/analyze-data-with-ai", - "docs/code-interpreting/analyze-data-with-ai/pre-installed-libraries" - ] - }, - { - "group": "Charts & visualizations", - "pages": [ - "docs/code-interpreting/create-charts-visualizations", - "docs/code-interpreting/create-charts-visualizations/static-charts", - "docs/code-interpreting/create-charts-visualizations/interactive-charts" - ] - }, - "docs/code-interpreting/streaming", - { - "group": "Supported languages", - "pages": [ - "docs/code-interpreting/supported-languages", - "docs/code-interpreting/supported-languages/python", - "docs/code-interpreting/supported-languages/javascript", - "docs/code-interpreting/supported-languages/r", - "docs/code-interpreting/supported-languages/java", - "docs/code-interpreting/supported-languages/bash" - ] - } + "docs/use-cases/linux-desktop", + "docs/use-cases/deep-research-agents", + "docs/use-cases/ai-data-analysis-visualization", + "docs/use-cases/reinforcement-learning", + "docs/use-cases/vibe-coding" ] }, { "group": "Sandbox", "pages": [ - "docs/sandbox", - "docs/sandbox/lifecycle-events-api", - "docs/sandbox/lifecycle-events-webhooks", + "docs/sandbox/intro", + "docs/sandbox/executing-code", + "docs/sandbox/reading-output", "docs/sandbox/persistence", - "docs/sandbox/metrics", - "docs/sandbox/metadata", - "docs/sandbox/environment-variables", - "docs/sandbox/list", - "docs/sandbox/connect", - "docs/sandbox/internet-access", - "docs/sandbox/connect-bucket", - "docs/sandbox/rate-limits", - "docs/sandbox/secured-access" + "docs/sandbox/security" ] }, { "group": "Templates", "pages": [ - "docs/template/quickstart", - "docs/template/how-it-works", - "docs/template/user-and-workdir", - "docs/template/caching", - "docs/template/base-image", - "docs/template/private-registries", - "docs/template/defining-template", - "docs/template/start-ready-command", - "docs/template/build", - "docs/template/logging", - "docs/template/error-handling", - { - "group": "Examples", - "pages": [ - "docs/template/examples/nextjs", - "docs/template/examples/nextjs-bun", - "docs/template/examples/expo", - "docs/template/examples/desktop", - "docs/template/examples/claude-code" - ] - }, - "docs/template/migration-v2", - { - "group": "Legacy Docs", - "pages": [ - "docs/sandbox-template", - "docs/sandbox-template/start-cmd", - "docs/sandbox-template/ready-cmd", - "docs/sandbox-template/customize-cpu-ram" - ] - } - ] - }, - { - "group": "Filesystem", - "pages": [ - "docs/filesystem", - "docs/filesystem/read-write", - "docs/filesystem/info", - "docs/filesystem/watch", - "docs/filesystem/upload", - "docs/filesystem/download" + "docs/templates/intro" ] }, { - "group": "Commands", + "group": "FAQ", "pages": [ - "docs/commands", - "docs/commands/streaming", - "docs/commands/background" - ] - }, - { - "group": "MCP Gateway", - "pages": [ - "docs/mcp", - "docs/mcp/quickstart", - "docs/mcp/available-servers", - "docs/mcp/custom-templates", - "docs/mcp/custom-servers", - "docs/mcp/examples" - ] - }, - { - "group": "CLI", - "pages": [ - "docs/cli", - "docs/cli/auth", - "docs/cli/list-sandboxes", - "docs/cli/shutdown-sandboxes" - ] - }, - { - "group": "Deployment", - "pages": ["docs/byoc"] - }, - { - "group": "Migration", - "pages": ["docs/migration/v2"] - }, - { - "group": "Troubleshooting", - "pages": [ - { - "group": "SDKs", - "pages": ["docs/troubleshooting/sdks/workers-edge-runtime"] - }, - { - "group": "Templates", - "pages": [ - "docs/troubleshooting/templates/build-authentication-error", - "docs/troubleshooting/templates/49999-port-not-open" - ] - } + "docs/faq" ] } ] diff --git a/docs.mdx b/docs.mdx index a330775..57cbfc9 100644 --- a/docs.mdx +++ b/docs.mdx @@ -4,37 +4,43 @@ sidebarTitle: Home icon: house --- -import { Concepts } from '/snippets/Concepts.jsx'; -import { CodeInterpreting } from '/snippets/CodeInterpreting.jsx'; import { Quickstart } from '/snippets/Quickstart.jsx'; +import { CodeInterpreting } from '/snippets/CodeInterpreting.jsx'; +import { Examples } from '/snippets/Examples.jsx'; +import { Reference } from '/snippets/Reference.jsx'; -Here you'll find all the guides, concepts, and SDK references for developing with E2B. +## What is E2B? - -```bash JavaScript & TypeScript -npm i @e2b/code-interpreter -``` -```bash Python -pip install e2b-code-interpreter -``` - +E2B provides isolated sandboxes that let agents safely execute code, process data, and run tools. Our [SDKs]() make it easy to start and manage these environments. -## What is E2B? -E2B is an [open-source](https://github.com/e2b-dev) infrastructure that allows you to run AI-generated code in secure isolated sandboxes in the cloud. -To start and control sandboxes, use our [Python SDK](https://pypi.org/project/e2b/) or [JavaScript SDK](https://www.npmjs.com/package/e2b). +## E2B Building Blocks + +A quick overview of the core building blocks you'll interact with when using E2B. + +- [**Sandbox**]() — A fast, secure Linux VM created on demand for your agent + +- [**Template**]() — Defines what environment a sandbox starts with + +## How to use the docs + +The documentation is split into three main sections: + +- [**Quickstart**](#quickstart) — Step-by-step tutorials that walk you through spinning up your first E2B sandboxes. + +- [**Examples**](#examples) — In-depth tutorials focused on specific use cases. Pick the topics that match what you're building. + +- [**API/SDK Reference**](https://e2b.dev/docs/sdk-reference) — A complete technical reference for every feature, component, and configuration option. + +
-Some of the typical use cases for E2B are AI data analysis or visualization, running AI-generated code of various languages, playground for coding agents, environment for codegen evals, or running full AI-generated apps like in [Fragments](https://github.com/e2b-dev/fragments). +## 🚀 Quickstart. -### Under the hood -The E2B Sandbox is a small isolated VM the can be started very quickly (~150ms). You can think of it as a small computer for the AI model. You can run many sandboxes at once. Typically, you run separate sandbox for each LLM, user, or AI agent session in your app. -For example, if you were building an AI data analysis chatbot, you would start the sandbox for every user session. + -## Quickstart - +
-## Code interpreting with AI - +## 🧠 Examples -## Learn the core concepts - + +
\ No newline at end of file diff --git a/docs/faq.mdx b/docs/faq.mdx new file mode 100644 index 0000000..15c02a2 --- /dev/null +++ b/docs/faq.mdx @@ -0,0 +1,9 @@ +--- +title: "FAQ" +description: "Frequently asked questions about E2B sandboxes, templates, pricing, security, performance, and common troubleshooting scenarios." +icon: "circle-question" +--- + +# FAQ + +Content coming soon. diff --git a/docs/sandbox/executing-code.mdx b/docs/sandbox/executing-code.mdx new file mode 100644 index 0000000..9af3719 --- /dev/null +++ b/docs/sandbox/executing-code.mdx @@ -0,0 +1,9 @@ +--- +title: "Executing Code" +description: "Run code and shell commands in E2B sandboxes with support for multiple languages, streaming output, background processes, and real-time execution control." +icon: "terminal" +--- + +# Executing Code + +Content coming soon. diff --git a/docs/sandbox/intro.mdx b/docs/sandbox/intro.mdx new file mode 100644 index 0000000..c543838 --- /dev/null +++ b/docs/sandbox/intro.mdx @@ -0,0 +1,9 @@ +--- +title: "Sandbox Intro" +description: "E2B sandboxes provide secure, isolated cloud environments for running untrusted code with full control over execution, filesystem, and networking." +icon: "cube" +--- + +# Sandbox Intro + +Content coming soon. diff --git a/docs/sandbox/persistence.mdx b/docs/sandbox/persistence.mdx index 29f3939..0f4bc88 100644 --- a/docs/sandbox/persistence.mdx +++ b/docs/sandbox/persistence.mdx @@ -1,295 +1,9 @@ --- -title: "Sandbox persistence" -sidebarTitle: Persistence +title: "Persistence" +description: "Manage persistent storage in E2B sandboxes with volumes that survive across sandbox sessions, enabling stateful workflows and long-term data retention." +icon: "database" --- - -Sandbox persistence is currently in public beta: -1. Consider [some limitations](#limitations-while-in-beta). -2. The persistence is free for all users during the beta. - +# Persistence -The sandbox persistence allows you to pause your sandbox and resume it later from the same state it was in when you paused it. - -This includes not only state of the sandbox's filesystem but also the sandbox's memory. This means all running processes, loaded variables, data, etc. - -## Sandbox State Transitions - -Understanding how sandboxes transition between different states is crucial for managing their lifecycle effectively. Here's a diagram showing the possible state transitions: - - - - - -### State descriptions - -- **Running**: The sandbox is actively running and can execute code. This is the initial state after creation. -- **Paused**: The sandbox execution is suspended but its state is preserved. -- **Killed**: The sandbox is terminated and all resources are released. This is a terminal state. - -### Changing sandbox's state - - -```js JavaScript & TypeScript -import { Sandbox } from '@e2b/code-interpreter' - -const sandbox = await Sandbox.create() // Starts in Running state - -// Pause the sandbox -await sandbox.betaPause() // Running → Paused - -// Resume the sandbox -await sandbox.connect() // Running/Paused → Running - -// Kill the sandbox (from any state) -await sandbox.kill() // Running/Paused → Killed -``` - -```python Python -from e2b_code_interpreter import Sandbox - -sandbox = Sandbox.create() # Starts in Running state - -# Pause the sandbox -sandbox.betaPause() # Running → Paused - -# Resume the sandbox -sandbox.connect() # Running/Paused → Running - -# Kill the sandbox (from any state) -sandbox.kill() # Running/Paused → Killed -``` - - -## Pausing sandbox -When you pause a sandbox, both the sandbox's filesystem and memory state will be saved. This includes all the files in the sandbox's filesystem and all the running processes, loaded variables, data, etc. - - -```js JavaScript & TypeScript highlight={8-9} -import { Sandbox } from '@e2b/code-interpreter' - -const sbx = await Sandbox.create() -console.log('Sandbox created', sbx.sandboxId) - -// Pause the sandbox -// You can save the sandbox ID in your database to resume the sandbox later -await sbx.betaPause() -console.log('Sandbox paused', sbx.sandboxId) -``` -```python Python highlight={8-9} -from e2b_code_interpreter import Sandbox - -sbx = Sandbox.create() -print('Sandbox created', sbx.sandbox_id) - -# Pause the sandbox -# You can save the sandbox ID in your database to resume the sandbox later -sbx.beta_pause() -print('Sandbox paused', sbx.sandbox_id) -``` - - - -## Resuming sandbox -When you resume a sandbox, it will be in the same state it was in when you paused it. -This means that all the files in the sandbox's filesystem will be restored and all the running processes, loaded variables, data, etc. will be restored. - - -```js JavaScript & TypeScript highlight={12-13} -import { Sandbox } from '@e2b/code-interpreter' - -const sbx = await Sandbox.create() -console.log('Sandbox created', sbx.sandboxId) - -// Pause the sandbox -// You can save the sandbox ID in your database to resume the sandbox later -await sbx.betaPause() -console.log('Sandbox paused', sbx.sandboxId) - -// Connect to the sandbox (it will automatically resume the sandbox, if paused) -const sameSbx = await sbx.connect() -console.log('Connected to the sandbox', sameSbx.sandboxId) -``` -```python Python highlight={12-13} -from e2b_code_interpreter import Sandbox - -sbx = Sandbox.create() -print('Sandbox created', sbx.sandbox_id) - -# Pause the sandbox -# You can save the sandbox ID in your database to resume the sandbox later -sbx.beta_pause() -print('Sandbox paused', sbx.sandbox_id) - -# Connect to the sandbox (it will automatically resume the sandbox, if paused) -same_sbx = sbx.connect() -print('Connected to the sandbox', same_sbx.sandbox_id) -``` - - -## Listing paused sandboxes -You can list all paused sandboxes by calling the `Sandbox.list` method and supplying the `state` query parameter. -More information about using the method can be found in [List Sandboxes](/docs/sandbox/list). - - -```js JavaScript & TypeScript highlight={4,7} -import { Sandbox, SandboxInfo } from '@e2b/code-interpreter' - -// List all paused sandboxes -const paginator = Sandbox.list({ query: { state: ['paused'] } }) - -// Get the first page of paused sandboxes -const sandboxes = await paginator.nextItems() - -// Get all paused sandboxes -while (paginator.hasNext) { - const items = await paginator.nextItems() - sandboxes.push(...items) -} -``` -```python Python highlight={4,7} -# List all paused sandboxes -from e2b_code_interpreter import Sandbox, SandboxQuery, SandboxState - -paginator = Sandbox.list(SandboxQuery(state=[SandboxState.PAUSED])) - -# Get the first page of paused sandboxes -sandboxes = paginator.next_items() - -# Get all paused sandboxes -while paginator.has_next: - items = paginator.next_items() - sandboxes.extend(items) -``` - - -## Removing paused sandboxes - -You can remove paused sandboxes by calling the `kill` method on the Sandbox instance. - - -```js JavaScript & TypeScript highlight={11,14} -import { Sandbox } from '@e2b/code-interpreter' - -const sbx = await Sandbox.create() -console.log('Sandbox created', sbx.sandboxId) - -// Pause the sandbox -// You can save the sandbox ID in your database to resume the sandbox later -await sbx.betaPause() - -// Remove the sandbox -await sbx.kill() - -// Remove sandbox by id -await Sandbox.kill(sbx.sandboxId) -``` -```python Python highlight={9,12} -from e2b_code_interpreter import Sandbox - -sbx = Sandbox.create() - -# Pause the sandbox -sbx.beta_pause() - -# Remove the sandbox -sbx.kill() - -# Remove sandbox by id -Sandbox.kill(sbx.sandbox_id) -``` - - -## Sandbox's timeout -When you connect to a sandbox, the sandbox's timeout is reset to the default timeout of an E2B sandbox - 5 minutes. - -You can pass a custom timeout to the `Sandbox.connect()`/`Sandbox.connect()` method like this: - - -```js JavaScript & TypeScript -import { Sandbox } from '@e2b/code-interpreter' - -const sbx = await Sandbox.connect(sandboxId, { timeoutMs: 60 * 1000 }) // 60 seconds -``` -```python Python -from e2b_code_interpreter import Sandbox - -sbx = Sandbox.connect(sandbox_id, timeout=60) # 60 seconds -``` - - - -### Auto-pause (beta) - -**Note: Auto-pause is currently in beta and available through `Sandbox.betaCreate()`/`Sandbox.beta_create()` method.** - -Sandboxes can now automatically pause after they time out. When a sandbox is paused, it stops consuming compute but preserves its state. The default inactivity timeout is 10 minutes. You can change the timeout by passing the `timeoutMs`/`timeout` parameter to the `Sandbox.connect()`/`Sandbox.connect()` method. - - -```js JavaScript & TypeScript -import { Sandbox } from '@e2b/code-interpreter' - -// Create sandbox with auto-pause enabled -const sandbox = await Sandbox.betaCreate({ - autoPause: true, - timeoutMs: 10 * 60 * 1000 // Optional: change the default timeout (10 minutes) -}) -``` -```python Python -from e2b_code_interpreter import Sandbox - -# Create sandbox with auto-pause enabled (Beta) -sandbox = Sandbox.beta_create( - auto_pause=True, # Auto-pause after the sandbox times out - timeout=10 * 60, # Optional: change the default timeout (10 minutes) -) -``` - - -The auto-pause is persistent, meaning that if your sandbox resumes and it times out, it will be automatically paused again. - -If you `.kill()` the sandbox, it will be permanently deleted and you won't be able to resume it. - - -```js JavaScript & TypeScript -import { Sandbox } from '@e2b/code-interpreter' - -// Create sandbox with auto-pause enabled (Beta) -const sandbox = await Sandbox.betaCreate({ - autoPause: true // Auto-pause after the sandbox times out -}) -``` -```python Python -from e2b_code_interpreter import Sandbox - -# Create sandbox with auto-pause enabled (Beta) -sandbox = Sandbox.beta_create( - auto_pause=True # Auto-pause after the sandbox times out -) -``` - - -## Network -If you have a service (for example a server) running inside your sandbox and you pause the sandbox, the service won't be accessible from the outside and all the clients will be disconnected. -If you resume the sandbox, the service will be accessible again but you need to connect clients again. - - -## Limitations while in beta - -### Lifecycle duration -- A sandbox can exist for **up to 30 days** from the initial `create` call. -- After 30 days, sandbox data **may be deleted** and the sandbox can no longer be resumed. -- Attempting to resume a deleted or non-existent sandbox will result in: - - `NotFoundError` in the JavaScript SDK - - `NotFoundException` in the Python SDK - -### Pause and resume performance -- Pausing a sandbox takes approximately **4 seconds per 1 GiB of RAM** -- Resuming a sandbox takes approximately **1 second** - -### Continuous runtime limits -- A sandbox can remain running (without being paused) for: - - **24 hours** on the **Pro tier** - - **1 hour** on the **Base tier** -- After a sandbox is paused and resumed, the continuous runtime limit is **reset** -- The **30-day total lifetime limit** still applies regardless of how many times the sandbox is paused or resumed +Content coming soon. diff --git a/docs/sandbox/reading-output.mdx b/docs/sandbox/reading-output.mdx new file mode 100644 index 0000000..66e7384 --- /dev/null +++ b/docs/sandbox/reading-output.mdx @@ -0,0 +1,9 @@ +--- +title: "Reading Output" +description: "Capture stdout, stderr, and exit codes from code execution in E2B sandboxes with support for real-time streaming, line-by-line processing, and buffered output handling." +icon: "scroll" +--- + +# Reading Output + +Content coming soon. diff --git a/docs/sandbox/security.mdx b/docs/sandbox/security.mdx new file mode 100644 index 0000000..50ee389 --- /dev/null +++ b/docs/sandbox/security.mdx @@ -0,0 +1,9 @@ +--- +title: "Security" +description: "Learn about E2B's security model including sandbox isolation, network policies, resource limits, and best practices for running untrusted code safely in production environments." +icon: "shield-halved" +--- + +# Security + +Content coming soon. diff --git a/docs/templates/intro.mdx b/docs/templates/intro.mdx new file mode 100644 index 0000000..f6ca82b --- /dev/null +++ b/docs/templates/intro.mdx @@ -0,0 +1,9 @@ +--- +title: "Templates Intro" +description: "Create custom sandbox templates with pre-installed dependencies, configurations, and tools to quickly spin up consistent development environments for your AI agents." +icon: "layer-group" +--- + +# Templates Intro + +Content coming soon. diff --git a/docs/use-cases/ai-data-analysis-visualization.mdx b/docs/use-cases/ai-data-analysis-visualization.mdx new file mode 100644 index 0000000..2b885e9 --- /dev/null +++ b/docs/use-cases/ai-data-analysis-visualization.mdx @@ -0,0 +1,9 @@ +--- +title: "AI Data Analysis & Visualization" +description: "Enable AI agents to analyze datasets, generate insights, create charts and visualizations, and perform statistical analysis using Python libraries like pandas, matplotlib, and seaborn." +icon: "chart-line" +--- + +# AI Data Analysis & Visualization + +Content coming soon. diff --git a/docs/use-cases/deep-research-agents.mdx b/docs/use-cases/deep-research-agents.mdx new file mode 100644 index 0000000..f8e013b --- /dev/null +++ b/docs/use-cases/deep-research-agents.mdx @@ -0,0 +1,9 @@ +--- +title: "Deep Research Agents" +description: "Build AI agents that perform comprehensive research by executing code, analyzing data, running experiments, and iterating on findings in isolated sandbox environments." +icon: "magnifying-glass-chart" +--- + +# Deep Research Agents + +Content coming soon. diff --git a/docs/use-cases/linux-desktop.mdx b/docs/use-cases/linux-desktop.mdx new file mode 100644 index 0000000..94c9e10 --- /dev/null +++ b/docs/use-cases/linux-desktop.mdx @@ -0,0 +1,9 @@ +--- +title: "Linux Desktop" +description: "Run full Linux desktop environments in E2B sandboxes with GUI support, window management, and remote access capabilities for browser automation, visual testing, and interactive applications." +icon: "desktop" +--- + +# Linux Desktop + +Content coming soon. diff --git a/docs/use-cases/reinforcement-learning.mdx b/docs/use-cases/reinforcement-learning.mdx new file mode 100644 index 0000000..8040ebd --- /dev/null +++ b/docs/use-cases/reinforcement-learning.mdx @@ -0,0 +1,9 @@ +--- +title: "Reinforcement Learning" +description: "Train and evaluate reinforcement learning agents in secure sandbox environments with support for simulation frameworks, custom environments, and parallel training workflows." +icon: "brain-circuit" +--- + +# Reinforcement Learning + +Content coming soon. diff --git a/docs/use-cases/vibe-coding.mdx b/docs/use-cases/vibe-coding.mdx new file mode 100644 index 0000000..363fb86 --- /dev/null +++ b/docs/use-cases/vibe-coding.mdx @@ -0,0 +1,9 @@ +--- +title: "Vibe Coding" +description: "Experience AI-powered coding with real-time code execution, instant feedback, and interactive development where AI agents write, test, and iterate on code in live sandbox environments." +icon: "wand-magic-sparkles" +--- + +# Vibe Coding + +Content coming soon.