From 2ee04ad7d50b8c0a6d74e729ea541781c1c04bce Mon Sep 17 00:00:00 2001 From: "mintlify[bot]" <109931778+mintlify[bot]@users.noreply.github.com> Date: Fri, 31 Oct 2025 18:43:33 +0000 Subject: [PATCH 1/8] Update docs.mdx --- docs.mdx | 81 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 41 insertions(+), 40 deletions(-) diff --git a/docs.mdx b/docs.mdx index a330775..2790cd4 100644 --- a/docs.mdx +++ b/docs.mdx @@ -1,40 +1,41 @@ ---- -title: "E2B Documentation" -sidebarTitle: Home -icon: house ---- - -import { Concepts } from '/snippets/Concepts.jsx'; -import { CodeInterpreting } from '/snippets/CodeInterpreting.jsx'; -import { Quickstart } from '/snippets/Quickstart.jsx'; - -Here you'll find all the guides, concepts, and SDK references for developing with E2B. - - -```bash JavaScript & TypeScript -npm i @e2b/code-interpreter -``` -```bash Python -pip install e2b-code-interpreter -``` - - -## 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). - -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). - -### 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 - - -## Learn the core concepts - - +--- +title: "E2B Documentation - AI Sandbox Infrastructure" +description: "Complete Guides, Concepts, And SDK References For Developing With E2B's Secure Cloud Sandboxes For AI-Generated Code Execution And Data Analysis." +sidebarTitle: Home +icon: house +--- + +import { Concepts } from '/snippets/Concepts.jsx'; +import { CodeInterpreting } from '/snippets/CodeInterpreting.jsx'; +import { Quickstart } from '/snippets/Quickstart.jsx'; + +Here you'll find all the guides, concepts, and SDK references for developing with E2B. + + +```bash JavaScript & TypeScript +npm i @e2b/code-interpreter +``` +```bash Python +pip install e2b-code-interpreter +``` + + +## 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). + +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). + +### 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 + + +## Learn the core concepts + + From 6a684b4caf62811dd41b922a12931a07fd7f3ff4 Mon Sep 17 00:00:00 2001 From: "mintlify[bot]" <109931778+mintlify[bot]@users.noreply.github.com> Date: Fri, 31 Oct 2025 18:43:57 +0000 Subject: [PATCH 2/8] Update docs/api-key.mdx --- docs/api-key.mdx | 83 ++++++++++++++++++++++++------------------------ 1 file changed, 42 insertions(+), 41 deletions(-) diff --git a/docs/api-key.mdx b/docs/api-key.mdx index ce52f08..2da718a 100644 --- a/docs/api-key.mdx +++ b/docs/api-key.mdx @@ -1,41 +1,42 @@ ---- -title: "API Key" -icon: "key" ---- - -To use the API key, you can either: - -- **Set the API key as the `E2B_API_KEY` environment variable** to avoid passing it each time you create a sandbox. -- Or pass it directly to the `Sandbox` constructor as shown below: - - -```js JavaScript & TypeScript -import { Sandbox } from '@e2b/code-interpreter' - -const sandbox = await Sandbox.create({ apiKey: 'YOUR_API_KEY' }) -``` -```python Python -from e2b_code_interpreter import Sandbox - -sbx = Sandbox.create(api_key="YOUR_API_KEY") -``` - - -## Where to find API key - -You can get your API key at [dashboard](https://e2b.dev/dashboard?tab=keys). - -
- -# Access Token - -The access token is used only in the CLI and is **not needed in the SDK**. There's no need to set it when logging into the CLI using `e2b auth login`. - - -To authenticate without the browser, you can set `E2B_ACCESS_TOKEN` as an environment variable. This is useful for CI/CD pipelines. - - -## Where to find Access token - -You can get your **Access token key** at the [dashboard](https://e2b.dev/dashboard/account). - +--- +title: "API Key Authentication For E2B Sandboxes" +description: "Learn How To Set Up And Use E2B API Keys For Sandbox Authentication, Including Environment Variables And Direct Constructor Methods For Secure Access." +icon: "key" +--- + +To use the API key, you can either: + +- **Set the API key as the `E2B_API_KEY` environment variable** to avoid passing it each time you create a sandbox. +- Or pass it directly to the `Sandbox` constructor as shown below: + + +```js JavaScript & TypeScript +import { Sandbox } from '@e2b/code-interpreter' + +const sandbox = await Sandbox.create({ apiKey: 'YOUR_API_KEY' }) +``` +```python Python +from e2b_code_interpreter import Sandbox + +sbx = Sandbox.create(api_key="YOUR_API_KEY") +``` + + +## Where to find API key + +You can get your API key at [dashboard](https://e2b.dev/dashboard?tab=keys). + +
+ +# Access Token + +The access token is used only in the CLI and is **not needed in the SDK**. There's no need to set it when logging into the CLI using `e2b auth login`. + + +To authenticate without the browser, you can set `E2B_ACCESS_TOKEN` as an environment variable. This is useful for CI/CD pipelines. + + +## Where to find Access token + +You can get your **Access token key** at the [dashboard](https://e2b.dev/dashboard/account). + From cf82200d85a7f8cc68d8c272585c2c93162fda01 Mon Sep 17 00:00:00 2001 From: "mintlify[bot]" <109931778+mintlify[bot]@users.noreply.github.com> Date: Fri, 31 Oct 2025 18:44:30 +0000 Subject: [PATCH 3/8] Update docs/byoc.mdx --- docs/byoc.mdx | 141 +++++++++++++++++++++++++------------------------- 1 file changed, 71 insertions(+), 70 deletions(-) diff --git a/docs/byoc.mdx b/docs/byoc.mdx index 50b974f..3c5d10e 100644 --- a/docs/byoc.mdx +++ b/docs/byoc.mdx @@ -1,70 +1,71 @@ ---- -title: "BYOC (Bring Your Own Cloud)" -sidebarTitle: Bring Your Own Cloud ---- - -BYOC (Bring Your Own Cloud) allows you to deploy E2B sandboxes to your own cloud infrastructure within your VPC. - -BYOC is currently only available for AWS. We are working on adding support for Google Cloud and Azure. - - -BYOC is offered to enterprise customers only. -If you’re interested in BYOC offering, please book a call with our team [here](https://e2b.dev/contact) or contact us at [enterprise@e2b.dev](mailto:enterprise@e2b.dev). - - -## Architecture - -Sandbox templates, snapshots, and runtime logs are stored within the customer's BYOC VPC. -Anonymized system metrics such as cluster memory and cpu are sent to the E2B Cloud for observability and cluster management purposes. - -All potentially sensitive traffic, such as sandbox template build source files, -sandbox traffic, and logs, is transmitted directly from the client to the customer's BYOC VPC without ever touching the E2B Cloud infrastructure. - -### Glossary -- **BYOC VPC**: The customer's Virtual Private Network where the E2B sandboxes are deployed. For example your AWS account. -- **E2B Cloud**: The managed service that provides the E2B platform, observability and cluster management. -- **OAuth Provider**: Customer-managed service that provides user and E2B Cloud with access to the cluster. - - - - - -### BYOC Cluster Components -- **Orchestrator**: Represents a node that is responsible for managing sandboxes and their lifecycle. Optionally, it can also run the template builder component. -- **Edge Controller**: Routes traffic to sandboxes, exposes API for cluster management, and gRPC proxy used by E2B control plane to communicate with orchestrators. -- **Monitoring**: Collector that receives sandbox and build logs and system metrics from orchestrators and edge controllers. Only anonymized metrics are sent to the E2B Cloud for observability purposes. -- **Storage**: Persistent storage for sandbox templates, snapshots, and runtime logs. Image container repository for template images. - -## Onboarding - -Customers can initiate the onboarding process by reaching out to us. -Customers need to have a dedicated AWS account and know the region they will use. -After that, we will receive the IAM role needed for managing account resources. -For AWS account quota limits may need to be increased. - -Terraform configuration and machine images will be used for provisioning BYOC cluster. -When provisioning is done and running, we will create a new team under your E2B account that can be used by SDK/CLI the same way as it is hosted on E2B Cloud. - -## FAQ - - - - Cluster is forwarding anonymized metrics such as machine cpu/memory usage to E2B Control plane for advanced observability and alerting. - The whole observability stack is anonymized and does not contain any sensitive information. - - - A cluster can be scaled horizontally by adding more orchestrators and edge controllers. - The autoscaler is currently in V1 not capable of automatically scale orchestrator nodes that are needed for sandbox spawning. - This feature is coming in the next versions. - - - Yes. Load balancer that is handling all requests coming to sandbox can be configured as internal and VPC peering - with additional customer’s VPC can be configured so sandbox traffic can stay in the private network. - - - Data sent between the E2B Cloud and your BYOC VPC is encrypted using TLS. - - VPC peering can be established to allow direct communication between the E2B Cloud and your BYOC VPC. - When using VPC peering, the load balancer can be configured as private without a public IP address. - - \ No newline at end of file +--- +title: "BYOC - Deploy E2B Sandboxes In Your Cloud" +description: "Deploy E2B Sandboxes To Your Own AWS Infrastructure Within Your VPC. Enterprise-Grade Security With Full Control Over Data And Compliance Requirements." +sidebarTitle: Bring Your Own Cloud +--- + +BYOC (Bring Your Own Cloud) allows you to deploy E2B sandboxes to your own cloud infrastructure within your VPC. + +BYOC is currently only available for AWS. We are working on adding support for Google Cloud and Azure. + + +BYOC is offered to enterprise customers only. +If you're interested in BYOC offering, please book a call with our team [here](https://e2b.dev/contact) or contact us at [enterprise@e2b.dev](mailto:enterprise@e2b.dev). + + +## Architecture + +Sandbox templates, snapshots, and runtime logs are stored within the customer's BYOC VPC. +Anonymized system metrics such as cluster memory and cpu are sent to the E2B Cloud for observability and cluster management purposes. + +All potentially sensitive traffic, such as sandbox template build source files, +sandbox traffic, and logs, is transmitted directly from the client to the customer's BYOC VPC without ever touching the E2B Cloud infrastructure. + +### Glossary +- **BYOC VPC**: The customer's Virtual Private Network where the E2B sandboxes are deployed. For example your AWS account. +- **E2B Cloud**: The managed service that provides the E2B platform, observability and cluster management. +- **OAuth Provider**: Customer-managed service that provides user and E2B Cloud with access to the cluster. + + + + + +### BYOC Cluster Components +- **Orchestrator**: Represents a node that is responsible for managing sandboxes and their lifecycle. Optionally, it can also run the template builder component. +- **Edge Controller**: Routes traffic to sandboxes, exposes API for cluster management, and gRPC proxy used by E2B control plane to communicate with orchestrators. +- **Monitoring**: Collector that receives sandbox and build logs and system metrics from orchestrators and edge controllers. Only anonymized metrics are sent to the E2B Cloud for observability purposes. +- **Storage**: Persistent storage for sandbox templates, snapshots, and runtime logs. Image container repository for template images. + +## Onboarding + +Customers can initiate the onboarding process by reaching out to us. +Customers need to have a dedicated AWS account and know the region they will use. +After that, we will receive the IAM role needed for managing account resources. +For AWS account quota limits may need to be increased. + +Terraform configuration and machine images will be used for provisioning BYOC cluster. +When provisioning is done and running, we will create a new team under your E2B account that can be used by SDK/CLI the same way as it is hosted on E2B Cloud. + +## FAQ + + + + Cluster is forwarding anonymized metrics such as machine cpu/memory usage to E2B Control plane for advanced observability and alerting. + The whole observability stack is anonymized and does not contain any sensitive information. + + + A cluster can be scaled horizontally by adding more orchestrators and edge controllers. + The autoscaler is currently in V1 not capable of automatically scale orchestrator nodes that are needed for sandbox spawning. + This feature is coming in the next versions. + + + Yes. Load balancer that is handling all requests coming to sandbox can be configured as internal and VPC peering + with additional customer's VPC can be configured so sandbox traffic can stay in the private network. + + + Data sent between the E2B Cloud and your BYOC VPC is encrypted using TLS. + + VPC peering can be established to allow direct communication between the E2B Cloud and your BYOC VPC. + When using VPC peering, the load balancer can be configured as private without a public IP address. + + From d4a6cd1b4701d853cc8686a75f779a419fd56c3f Mon Sep 17 00:00:00 2001 From: "mintlify[bot]" <109931778+mintlify[bot]@users.noreply.github.com> Date: Fri, 31 Oct 2025 18:44:41 +0000 Subject: [PATCH 4/8] Update docs/cli.mdx --- docs/cli.mdx | 73 ++++++++++++++++++++++++++-------------------------- 1 file changed, 37 insertions(+), 36 deletions(-) diff --git a/docs/cli.mdx b/docs/cli.mdx index 268fc3d..530ee96 100644 --- a/docs/cli.mdx +++ b/docs/cli.mdx @@ -1,36 +1,37 @@ ---- -title: "E2B CLI" -sidebarTitle: Installation ---- - -E2B CLI is a command line tool that allows you to list, kill running sandboxes, and manage [sandbox templates](/docs/template/quickstart). - -## Installation - -**Using Homebrew (on macOS)** - - -```bash Terminal -brew install e2b -``` - - -**Using NPM** - -You can install E2B CLI using the following command: - - -```bash Terminal -npm i -g @e2b/cli -``` - - -### Beta CLI - -The latest beta version of the CLI can be installed from NPM using the following command: - - -```bash Terminal -npm i -g @e2b/cli@beta -``` - +--- +title: "E2B CLI - Command Line Tool For Sandboxes" +description: "Install And Use The E2B Command Line Interface To List, Kill Running Sandboxes, And Manage Custom Sandbox Templates With Homebrew Or NPM Installation." +sidebarTitle: Installation +--- + +E2B CLI is a command line tool that allows you to list, kill running sandboxes, and manage [sandbox templates](/docs/template/quickstart). + +## Installation + +**Using Homebrew (on macOS)** + + +```bash Terminal +brew install e2b +``` + + +**Using NPM** + +You can install E2B CLI using the following command: + + +```bash Terminal +npm i -g @e2b/cli +``` + + +### Beta CLI + +The latest beta version of the CLI can be installed from NPM using the following command: + + +```bash Terminal +npm i -g @e2b/cli@beta +``` + From 7a3aadc7cec1fc64d6529bb244bf303fa782fd14 Mon Sep 17 00:00:00 2001 From: "mintlify[bot]" <109931778+mintlify[bot]@users.noreply.github.com> Date: Fri, 31 Oct 2025 18:44:50 +0000 Subject: [PATCH 5/8] Update docs/cli/auth.mdx --- docs/cli/auth.mdx | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/docs/cli/auth.mdx b/docs/cli/auth.mdx index 488b141..94c3526 100644 --- a/docs/cli/auth.mdx +++ b/docs/cli/auth.mdx @@ -1,12 +1,13 @@ ---- -title: "Authentication in CLI" -sidebarTitle: Authentication ---- - -You must authenticate with E2B CLI before using it. Run the following command to sign in into your E2B account: - - -```bash Terminal -e2b auth login -``` - \ No newline at end of file +--- +title: "Authenticate E2B CLI With Your Account" +description: "Sign In To Your E2B Account Using The CLI Authentication Command To Access Sandbox Management And Template Building Features Securely." +sidebarTitle: Authentication +--- + +You must authenticate with E2B CLI before using it. Run the following command to sign in into your E2B account: + + +```bash Terminal +e2b auth login +``` + From 8ddcd011624e9beb2986d5774bd8cf3f7a4ccb54 Mon Sep 17 00:00:00 2001 From: "mintlify[bot]" <109931778+mintlify[bot]@users.noreply.github.com> Date: Fri, 31 Oct 2025 18:45:04 +0000 Subject: [PATCH 6/8] Update docs/cli/list-sandboxes.mdx --- docs/cli/list-sandboxes.mdx | 111 ++++++++++++++++++------------------ 1 file changed, 56 insertions(+), 55 deletions(-) diff --git a/docs/cli/list-sandboxes.mdx b/docs/cli/list-sandboxes.mdx index 4ecc837..5ff24c7 100644 --- a/docs/cli/list-sandboxes.mdx +++ b/docs/cli/list-sandboxes.mdx @@ -1,55 +1,56 @@ ---- -title: "List sandboxes" ---- - -You can list all sandboxes using the following command: - - -```bash Terminal -e2b sandbox list -``` - - -This will return running sandboxes, you can specify `--state` to get paused or both. - -### Filter by state - -To filter the sandboxes by their state you can specify the `--state` flag, which can either be "**running**", "**paused**" or both. - -```bash -e2b sandbox list --state running,paused -``` - -### Filter by metadata - -To filter the sandboxes by their metadata, use the `--metadata` flag. - -```bash -e2b sandbox list --metadata key1=value1,key2=value2 -``` - -### List limit - -To limit the amount of sandboxes returned by the command, use the `--limit` flag. - -```bash -e2b sandbox list --limit 10 -``` - -By default, the command will return all sandboxes. - -### Output format - -To output the sandboxes in JSON format, use the `--format` flag. - -**Pretty print (default)** - -```bash -e2b sandbox list --format pretty -``` - -**JSON** - -```bash -e2b sandbox list --format json -``` +--- +title: "List All Running And Paused Sandboxes" +description: "Use E2B CLI To List Sandboxes With Filtering By State, Metadata, And Custom Limits. Output Results In Pretty Print Or JSON Format For Easy Integration." +--- + +You can list all sandboxes using the following command: + + +```bash Terminal +e2b sandbox list +``` + + +This will return running sandboxes, you can specify `--state` to get paused or both. + +### Filter by state + +To filter the sandboxes by their state you can specify the `--state` flag, which can either be "**running**", "**paused**" or both. + +```bash +e2b sandbox list --state running,paused +``` + +### Filter by metadata + +To filter the sandboxes by their metadata, use the `--metadata` flag. + +```bash +e2b sandbox list --metadata key1=value1,key2=value2 +``` + +### List limit + +To limit the amount of sandboxes returned by the command, use the `--limit` flag. + +```bash +e2b sandbox list --limit 10 +``` + +By default, the command will return all sandboxes. + +### Output format + +To output the sandboxes in JSON format, use the `--format` flag. + +**Pretty print (default)** + +```bash +e2b sandbox list --format pretty +``` + +**JSON** + +```bash +e2b sandbox list --format json +``` From ff1ac67f2d86876c6397f6083790148f0931a439 Mon Sep 17 00:00:00 2001 From: "mintlify[bot]" <109931778+mintlify[bot]@users.noreply.github.com> Date: Fri, 31 Oct 2025 18:45:16 +0000 Subject: [PATCH 7/8] Update docs/cli/shutdown-sandboxes.mdx --- docs/cli/shutdown-sandboxes.mdx | 91 +++++++++++++++++---------------- 1 file changed, 46 insertions(+), 45 deletions(-) diff --git a/docs/cli/shutdown-sandboxes.mdx b/docs/cli/shutdown-sandboxes.mdx index 54c12f9..bc1d081 100644 --- a/docs/cli/shutdown-sandboxes.mdx +++ b/docs/cli/shutdown-sandboxes.mdx @@ -1,45 +1,46 @@ ---- -title: "Shutdown running sandboxes" ---- - -You can shutdown single or all running sandboxes with the E2B CLI. - -## Shutdown single or multiple sandboxes - -To shutdown a single or multiple sandboxes, run the following command: - - -```bash Terminal -e2b sandbox kill -``` - - -## Shutdown all sandboxes - -To shutdown all running sandboxes, run the following command: - - -```bash Terminal -e2b sandbox kill --all -``` - - -Further, you can filter the sandboxes to be shutdown by state, metadata or both. - - -```bash Terminal -e2b sandbox kill --all --state=running,paused -``` - - - -```bash Terminal -e2b sandbox kill --all --metadata=key=value -``` - - - -```bash Terminal -e2b sandbox kill --all --state=running,paused --metadata=key=value -``` - +--- +title: "Shutdown Running Sandboxes With E2B CLI" +description: "Kill Single, Multiple, Or All Running Sandboxes Using The E2B CLI. Filter By State And Metadata To Manage Your Sandbox Instances Efficiently." +--- + +You can shutdown single or all running sandboxes with the E2B CLI. + +## Shutdown single or multiple sandboxes + +To shutdown a single or multiple sandboxes, run the following command: + + +```bash Terminal +e2b sandbox kill +``` + + +## Shutdown all sandboxes + +To shutdown all running sandboxes, run the following command: + + +```bash Terminal +e2b sandbox kill --all +``` + + +Further, you can filter the sandboxes to be shutdown by state, metadata or both. + + +```bash Terminal +e2b sandbox kill --all --state=running,paused +``` + + + +```bash Terminal +e2b sandbox kill --all --metadata=key=value +``` + + + +```bash Terminal +e2b sandbox kill --all --state=running,paused --metadata=key=value +``` + From d6ef5a2f72adf61dd12164c5100166e9762b93b1 Mon Sep 17 00:00:00 2001 From: "mintlify[bot]" <109931778+mintlify[bot]@users.noreply.github.com> Date: Fri, 31 Oct 2025 18:45:35 +0000 Subject: [PATCH 8/8] Update docs/quickstart.mdx --- docs/quickstart.mdx | 142 ++++++++++++++++++++++---------------------- 1 file changed, 71 insertions(+), 71 deletions(-) diff --git a/docs/quickstart.mdx b/docs/quickstart.mdx index ea933b0..3243fac 100644 --- a/docs/quickstart.mdx +++ b/docs/quickstart.mdx @@ -1,71 +1,71 @@ ---- -title: Running your first Sandbox -description: This guide will show you how to start your first E2B Sandbox. ---- - - - -Every new E2B account get $100 in credits. You can sign up [here](https://e2b.dev/auth/sign-up). - - -1. Navigate to the E2B Dashboard. -2. Copy your API key. -3. Paste your E2B API key into your .env file. - -```bash .env -E2B_API_KEY=e2b_*** -``` - - -Install the E2B SDK to your project by running the following command in your terminal. - -```javascript JavaScript & TypeScript -npm i @e2b/code-interpreter dotenv -``` -```python Python -pip install e2b-code-interpreter python-dotenv -``` - - - -We'll write the minimal code for starting Sandbox, executing Python inside it and listing all files inside the root directory. - -```javascript JavaScript & TypeScript -// index.ts -import 'dotenv/config' -import { Sandbox } from '@e2b/code-interpreter' - -const sbx = await Sandbox.create() // By default the sandbox is alive for 5 minutes -const execution = await sbx.runCode('print("hello world")') // Execute Python inside the sandbox -console.log(execution.logs) - -const files = await sbx.files.list('/') -console.log(files) -``` -```python Python -# main.py -from dotenv import load_dotenv -load_dotenv() -from e2b_code_interpreter import Sandbox - -sbx = Sandbox.create() # By default the sandbox is alive for 5 minutes -execution = sbx.run_code("print('hello world')") # Execute Python inside the sandbox -print(execution.logs) - -files = sbx.files.list("/") -print(files) -``` - - - -Run the code with the following command: - -```bash JavaScript & TypeScript -npx tsx ./index.ts -``` -```bash Python -python main.py -``` - - - +--- +title: "Running Your First E2B Sandbox - Quick Start" +description: "Get Started With E2B In Minutes. Create An Account, Install The SDK, And Run Your First Secure Cloud Sandbox For AI-Generated Code Execution." +--- + + + +Every new E2B account get $100 in credits. You can sign up [here](https://e2b.dev/auth/sign-up). + + +1. Navigate to the E2B Dashboard. +2. Copy your API key. +3. Paste your E2B API key into your .env file. + +```bash .env +E2B_API_KEY=e2b_*** +``` + + +Install the E2B SDK to your project by running the following command in your terminal. + +```javascript JavaScript & TypeScript +npm i @e2b/code-interpreter dotenv +``` +```python Python +pip install e2b-code-interpreter python-dotenv +``` + + + +We'll write the minimal code for starting Sandbox, executing Python inside it and listing all files inside the root directory. + +```javascript JavaScript & TypeScript +// index.ts +import 'dotenv/config' +import { Sandbox } from '@e2b/code-interpreter' + +const sbx = await Sandbox.create() // By default the sandbox is alive for 5 minutes +const execution = await sbx.runCode('print("hello world")') // Execute Python inside the sandbox +console.log(execution.logs) + +const files = await sbx.files.list('/') +console.log(files) +``` +```python Python +# main.py +from dotenv import load_dotenv +load_dotenv() +from e2b_code_interpreter import Sandbox + +sbx = Sandbox.create() # By default the sandbox is alive for 5 minutes +execution = sbx.run_code("print('hello world')") # Execute Python inside the sandbox +print(execution.logs) + +files = sbx.files.list("/") +print(files) +``` + + + +Run the code with the following command: + +```bash JavaScript & TypeScript +npx tsx ./index.ts +``` +```bash Python +python main.py +``` + + +