diff --git a/docs/api-key.mdx b/docs/api-key.mdx index a436f71e..b23e4ba8 100644 --- a/docs/api-key.mdx +++ b/docs/api-key.mdx @@ -10,12 +10,12 @@ To use the API key, you can either: ```js JavaScript & TypeScript -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' const sandbox = await Sandbox.create({ apiKey: 'YOUR_API_KEY' }) ``` ```python Python -from e2b_code_interpreter import Sandbox +from e2b import Sandbox sbx = Sandbox.create(api_key="YOUR_API_KEY") ``` diff --git a/docs/commands.mdx b/docs/commands.mdx index ffd1c222..d1975361 100644 --- a/docs/commands.mdx +++ b/docs/commands.mdx @@ -7,14 +7,14 @@ You can run terminal commands inside the sandbox using the `commands.run()` meth ```js JavaScript & TypeScript -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' const sandbox = await Sandbox.create() const result = await sandbox.commands.run('ls -l') console.log(result) ``` ```python Python -from e2b_code_interpreter import Sandbox +from e2b import Sandbox sandbox = Sandbox.create() result = sandbox.commands.run('ls -l') diff --git a/docs/commands/background.mdx b/docs/commands/background.mdx index 66e40b71..cf12e8e2 100644 --- a/docs/commands/background.mdx +++ b/docs/commands/background.mdx @@ -8,7 +8,7 @@ You can then later kill the command using the `commands.kill()` method. ```js JavaScript & TypeScript highlight={7} -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' const sandbox = await Sandbox.create() @@ -24,7 +24,7 @@ const command = await sandbox.commands.run('echo hello; sleep 10; echo world', { await command.kill() ``` ```python Python highlight={6} -from e2b_code_interpreter import Sandbox +from e2b import Sandbox sandbox = Sandbox.create() diff --git a/docs/commands/streaming.mdx b/docs/commands/streaming.mdx index 39bb2531..a7bc4334 100644 --- a/docs/commands/streaming.mdx +++ b/docs/commands/streaming.mdx @@ -8,7 +8,7 @@ or the `on_stdout`, `on_stderr` callbacks to the `commands.run()` method in Pyth ```js JavaScript & TypeScript -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' const sandbox = await Sandbox.create() @@ -23,7 +23,7 @@ const result = await sandbox.commands.run('echo hello; sleep 1; echo world', { console.log(result) ``` ```python Python -from e2b_code_interpreter import Sandbox +from e2b import Sandbox sandbox = Sandbox.create() diff --git a/docs/filesystem/download.mdx b/docs/filesystem/download.mdx index bdd178e8..e354d91f 100644 --- a/docs/filesystem/download.mdx +++ b/docs/filesystem/download.mdx @@ -8,7 +8,7 @@ You can download data from the sandbox using the `files.read()` method. ```js JavaScript & TypeScript import fs from 'fs' -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' const sandbox = await Sandbox.create() @@ -18,7 +18,7 @@ const content = await sandbox.files.read('/path/in/sandbox') fs.writeFileSync('/local/path', content) ``` ```python Python -from e2b_code_interpreter import Sandbox +from e2b import Sandbox sandbox = Sandbox.create() @@ -41,7 +41,7 @@ You can optionally set an expiration time for the URL so that it will be valid o ```js JavaScript & TypeScript import fs from 'fs' -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' // Start a secured sandbox (all operations must be authorized by default) const sandbox = await Sandbox.create(template, { secure: true }) diff --git a/docs/filesystem/info.mdx b/docs/filesystem/info.mdx index 47d8858e..747f864c 100644 --- a/docs/filesystem/info.mdx +++ b/docs/filesystem/info.mdx @@ -9,7 +9,7 @@ You can get information about a file or directory using the `files.getInfo()` / ```js JavaScript & TypeScript -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' const sandbox = await Sandbox.create() @@ -34,7 +34,7 @@ console.log(info) // } ``` ```python Python -from e2b_code_interpreter import Sandbox +from e2b import Sandbox sandbox = Sandbox.create() @@ -64,7 +64,7 @@ print(info) ```js JavaScript & TypeScript -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' const sandbox = await Sandbox.create() @@ -89,7 +89,7 @@ console.log(info) // } ``` ```python Python -from e2b_code_interpreter import Sandbox +from e2b import Sandbox sandbox = Sandbox.create() diff --git a/docs/filesystem/read-write.mdx b/docs/filesystem/read-write.mdx index 187b1503..7829f352 100644 --- a/docs/filesystem/read-write.mdx +++ b/docs/filesystem/read-write.mdx @@ -9,13 +9,13 @@ You can read files from the sandbox filesystem using the `files.read()` method. ```js JavaScript & TypeScript -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' const sandbox = await Sandbox.create() const fileContent = await sandbox.files.read('/path/to/file') ``` ```python Python -from e2b_code_interpreter import Sandbox +from e2b import Sandbox sandbox = Sandbox.create() file_content = sandbox.files.read('/path/to/file') @@ -28,14 +28,14 @@ You can write single files to the sandbox filesystem using the `files.write()` m ```js JavaScript & TypeScript -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' const sandbox = await Sandbox.create() await sandbox.files.write('/path/to/file', 'file content') ``` ```python Python -from e2b_code_interpreter import Sandbox +from e2b import Sandbox sandbox = Sandbox.create() @@ -49,7 +49,7 @@ You can also write multiple files to the sandbox. ```js JavaScript & TypeScript -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' const sandbox = await Sandbox.create() @@ -59,7 +59,7 @@ await sandbox.files.write([ ]) ``` ```python Python -from e2b_code_interpreter import Sandbox +from e2b import Sandbox sandbox = Sandbox.create() diff --git a/docs/filesystem/upload.mdx b/docs/filesystem/upload.mdx index befeb989..63e0b00a 100644 --- a/docs/filesystem/upload.mdx +++ b/docs/filesystem/upload.mdx @@ -10,7 +10,7 @@ You can upload data to the sandbox using the `files.write()` method. ```js JavaScript & TypeScript import fs from 'fs' -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' const sandbox = await Sandbox.create() @@ -20,7 +20,7 @@ const content = fs.readFileSync('/local/path') await sandbox.files.write('/path/in/sandbox', content) ``` ```python Python -from e2b_code_interpreter import Sandbox +from e2b import Sandbox sandbox = Sandbox.create() @@ -40,7 +40,7 @@ All you need to do is create a sandbox with the `secure: true` option. An upload You can optionally set an expiration time for the URL so that it will be valid only for a limited time. ```js JavaScript & TypeScript -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' // Start a secured sandbox (all operations must be authorized by default) const sandbox = await Sandbox.create(template, { secure: true }) @@ -83,7 +83,7 @@ content = sandbox.files.read('/path/in/sandbox') ```js JavaScript & TypeScript -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' const sandbox = await Sandbox.create() @@ -125,7 +125,7 @@ await sandbox.files.write(files) ``` ```python Python import os -from e2b_code_interpreter import Sandbox +from e2b import Sandbox sandbox = Sandbox.create() diff --git a/docs/filesystem/watch.mdx b/docs/filesystem/watch.mdx index 55fe18f4..868fde22 100644 --- a/docs/filesystem/watch.mdx +++ b/docs/filesystem/watch.mdx @@ -12,7 +12,7 @@ It's recommended not to collect or close watcher immediately after making a chan ```js JavaScript & TypeScript highlight={7-12} -import { Sandbox, FilesystemEventType } from '@e2b/code-interpreter' +import { Sandbox, FilesystemEventType } from 'e2b' const sandbox = await Sandbox.create() const dirname = '/home/user' @@ -29,7 +29,7 @@ const handle = await sandbox.files.watchDir(dirname, async (event) => { await sandbox.files.write(`${dirname}/my-file`, 'hello') ``` ```python Python highlight={7,12-16} -from e2b_code_interpreter import Sandbox, FilesystemEventType +from e2b import Sandbox, FilesystemEventType sandbox = Sandbox.create() dirname = '/home/user' @@ -59,7 +59,7 @@ When rapidly creating new folders (e.g., deeply nested path of folders), events ```js JavaScript & TypeScript highlight={13,17} -import { Sandbox, FilesystemEventType } from '@e2b/code-interpreter' +import { Sandbox, FilesystemEventType } from 'e2b' const sandbox = await Sandbox.create() const dirname = '/home/user' @@ -78,7 +78,7 @@ const handle = await sandbox.files.watchDir(dirname, async (event) => { await sandbox.files.write(`${dirname}/my-folder/my-file`, 'hello') ``` ```python Python highlight={7,9} -from e2b_code_interpreter import Sandbox, FilesystemEventType +from e2b import Sandbox, FilesystemEventType sandbox = Sandbox.create() dirname = '/home/user' diff --git a/docs/quickstart/upload-download-files.mdx b/docs/quickstart/upload-download-files.mdx index 5a16bf19..6c5f6f45 100644 --- a/docs/quickstart/upload-download-files.mdx +++ b/docs/quickstart/upload-download-files.mdx @@ -10,7 +10,7 @@ An alternative way to get your data to the sandbox is to create a [custom sandbo ## Upload file ```ts JavaScript & TypeScript -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' // Read local file relative to the current working directory const content = fs.readFileSync('local/file') @@ -21,7 +21,7 @@ await sbx.files.write('/home/user/my-file', content) ``` ```python Python -from e2b_code_interpreter import Sandbox +from e2b import Sandbox sbx = Sandbox.create() @@ -39,7 +39,7 @@ We're working on a better solution. ```ts JavaScript & TypeScript -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' // Read local file relative to the current working directory const fileA = fs.readFileSync('local/file/a') @@ -53,7 +53,7 @@ await sbx.files.write('/home/user/my-file-b', fileB) ``` ```python Python -from e2b_code_interpreter import Sandbox +from e2b import Sandbox sbx = Sandbox.create() @@ -82,7 +82,7 @@ To download a file, you need to first get the file's content and then write it t ```ts JavaScript & TypeScript -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' const sbx = await Sandbox.create() // Download file from the sandbox to absolute path '/home/user/my-file' @@ -92,7 +92,7 @@ fs.writeFileSync('local/file', content) ``` ```python Python -from e2b_code_interpreter import Sandbox +from e2b import Sandbox sbx = Sandbox.create() # Download file from the sandbox to absolute path '/home/user/my-file' @@ -111,7 +111,7 @@ We're working on a better solution. ```ts JavaScript & TypeScript -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' const sbx = await Sandbox.create() // Download file A from the sandbox by absolute path '/home/user/my-file-a' @@ -126,7 +126,7 @@ fs.writeFileSync('local/file/b', contentB) ``` ```python Python -from e2b_code_interpreter import Sandbox +from e2b import Sandbox sbx = Sandbox.create() # Download file A from the sandbox by absolute path '/home/user/my-file-a' diff --git a/docs/sandbox.mdx b/docs/sandbox.mdx index 6c37ccd3..cd48b7ec 100644 --- a/docs/sandbox.mdx +++ b/docs/sandbox.mdx @@ -11,7 +11,7 @@ Sandboxes can run continuously for up to 24 hours (Pro) or 1 hour (Base). For lo ```js JavaScript & TypeScript highlight={6} -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' // Create sandbox with and keep it running for 60 seconds. // 🚨 Note: The units are milliseconds. @@ -20,7 +20,7 @@ const sandbox = await Sandbox.create({ }) ``` ```python Python highlight={6} -from e2b_code_interpreter import Sandbox +from e2b import Sandbox # Create sandbox with and keep it running for 60 seconds. # 🚨 Note: The units are seconds. @@ -42,7 +42,7 @@ You can for example start with a sandbox with 1 minute timeout and then periodic ```js JavaScript & TypeScript -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' // Create sandbox with and keep it running for 60 seconds. const sandbox = await Sandbox.create({ timeoutMs: 60_000 }) @@ -52,7 +52,7 @@ const sandbox = await Sandbox.create({ timeoutMs: 60_000 }) await sandbox.setTimeout(30_000) ``` ```python Python -from e2b_code_interpreter import Sandbox +from e2b import Sandbox # Create sandbox with and keep it running for 60 seconds. sandbox = Sandbox.create(timeout=60) @@ -69,7 +69,7 @@ You can retrieve sandbox information like sandbox ID, template, metadata, starte ```js JavaScript & TypeScript -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' // Create sandbox with and keep it running for 60 seconds. const sandbox = await Sandbox.create({ timeoutMs: 60_000 }) @@ -90,7 +90,7 @@ console.log(info) ``` ```python Python -from e2b_code_interpreter import Sandbox +from e2b import Sandbox # Create sandbox with and keep it running for 60 seconds. sandbox = Sandbox.create(timeout=60) @@ -116,7 +116,7 @@ You can shutdown the sandbox any time even before the timeout is up by calling t ```js JavaScript & TypeScript -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' // Create sandbox with and keep it running for 60 seconds. const sandbox = await Sandbox.create({ timeoutMs: 60_000 }) @@ -125,7 +125,7 @@ const sandbox = await Sandbox.create({ timeoutMs: 60_000 }) await sandbox.kill() ``` ```python Python -from e2b_code_interpreter import Sandbox +from e2b import Sandbox # Create sandbox with and keep it running for 60 seconds. sandbox = Sandbox.create(timeout=60) diff --git a/docs/sandbox/connect.mdx b/docs/sandbox/connect.mdx index e62977e4..4a08bfa5 100644 --- a/docs/sandbox/connect.mdx +++ b/docs/sandbox/connect.mdx @@ -11,7 +11,7 @@ To connect to a running sandbox, you first need to retrieve its ID. You can do t ```js JavaScript & TypeScript -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' const sbx = await Sandbox.create() @@ -30,7 +30,7 @@ const sandboxId = runningSandboxes[0].sandboxId ``` ```python Python -from e2b_code_interpreter import Sandbox +from e2b import Sandbox sbx = Sandbox.create() @@ -53,7 +53,7 @@ Now that you have the sandbox ID, you can connect to the sandbox using the `Sand ```js JavaScript & TypeScript highlight={3} -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' const sandbox = await Sandbox.connect(sandboxId) @@ -64,7 +64,7 @@ console.log(`Running in sandbox ${sandbox.sandboxId} as "${result.stdout.trim()} ``` ```python Python highlight={3} -from e2b_code_interpreter import Sandbox +from e2b import Sandbox sandbox = Sandbox.connect(sandbox_id) diff --git a/docs/sandbox/internet-access.mdx b/docs/sandbox/internet-access.mdx index ae9f2b93..9169b0ba 100644 --- a/docs/sandbox/internet-access.mdx +++ b/docs/sandbox/internet-access.mdx @@ -10,7 +10,7 @@ You can control whether a sandbox has access to the internet by using the `allow ```js JavaScript & TypeScript -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' // Create sandbox with internet access enabled (default) const sandbox = await Sandbox.create({ allowInternetAccess: true }) @@ -19,7 +19,7 @@ const sandbox = await Sandbox.create({ allowInternetAccess: true }) const isolatedSandbox = await Sandbox.create({ allowInternetAccess: false }) ``` ```python Python -from e2b_code_interpreter import Sandbox +from e2b import Sandbox # Create sandbox with internet access enabled (default) sandbox = Sandbox.create(allow_internet_access=True) @@ -45,7 +45,7 @@ You can specify IP addresses, CIDR blocks, or domain names that the sandbox is a ```js JavaScript & TypeScript -import { Sandbox, ALL_TRAFFIC } from '@e2b/code-interpreter' +import { Sandbox, ALL_TRAFFIC } from 'e2b' // Deny all traffic except specific IPs const sandbox = await Sandbox.create({ @@ -63,7 +63,7 @@ const restrictedSandbox = await Sandbox.create({ }) ``` ```python Python -from e2b_code_interpreter import Sandbox, ALL_TRAFFIC +from e2b import Sandbox, ALL_TRAFFIC # Deny all traffic except specific IPs sandbox = Sandbox.create( @@ -88,7 +88,7 @@ You can allow traffic to specific domains by specifying hostnames in `allow out` ```js JavaScript & TypeScript -import { Sandbox, ALL_TRAFFIC } from '@e2b/code-interpreter' +import { Sandbox, ALL_TRAFFIC } from 'e2b' // Allow only traffic to google.com const sandbox = await Sandbox.create({ @@ -99,7 +99,7 @@ const sandbox = await Sandbox.create({ }) ``` ```python Python -from e2b_code_interpreter import Sandbox, ALL_TRAFFIC +from e2b import Sandbox, ALL_TRAFFIC # Allow only traffic to google.com sandbox = Sandbox.create( @@ -119,7 +119,7 @@ You can also use wildcards to allow all subdomains of a domain: ```js JavaScript & TypeScript -import { Sandbox, ALL_TRAFFIC } from '@e2b/code-interpreter' +import { Sandbox, ALL_TRAFFIC } from 'e2b' // Allow traffic to any subdomain of mydomain.com const sandbox = await Sandbox.create({ @@ -130,7 +130,7 @@ const sandbox = await Sandbox.create({ }) ``` ```python Python -from e2b_code_interpreter import Sandbox, ALL_TRAFFIC +from e2b import Sandbox, ALL_TRAFFIC # Allow traffic to any subdomain of mydomain.com sandbox = Sandbox.create( @@ -146,7 +146,7 @@ You can combine domain names with IP addresses and CIDR blocks: ```js JavaScript & TypeScript -import { Sandbox, ALL_TRAFFIC } from '@e2b/code-interpreter' +import { Sandbox, ALL_TRAFFIC } from 'e2b' // Allow traffic to specific domains and IPs const sandbox = await Sandbox.create({ @@ -157,7 +157,7 @@ const sandbox = await Sandbox.create({ }) ``` ```python Python -from e2b_code_interpreter import Sandbox, ALL_TRAFFIC +from e2b import Sandbox, ALL_TRAFFIC # Allow traffic to specific domains and IPs sandbox = Sandbox.create( @@ -179,7 +179,7 @@ When both `allow out` and `deny out` are specified, **allow rules always take pr ```js JavaScript & TypeScript -import { Sandbox, ALL_TRAFFIC } from '@e2b/code-interpreter' +import { Sandbox, ALL_TRAFFIC } from 'e2b' // Even though ALL_TRAFFIC is denied, 1.1.1.1 and 8.8.8.8 are explicitly allowed const sandbox = await Sandbox.create({ @@ -190,7 +190,7 @@ const sandbox = await Sandbox.create({ }) ``` ```python Python -from e2b_code_interpreter import Sandbox, ALL_TRAFFIC +from e2b import Sandbox, ALL_TRAFFIC # Even though ALL_TRAFFIC is denied, 1.1.1.1 and 8.8.8.8 are explicitly allowed sandbox = Sandbox.create( @@ -208,7 +208,7 @@ The `ALL_TRAFFIC` constant represents the CIDR range `0.0.0.0/0`, which matches ```js JavaScript & TypeScript -import { Sandbox, ALL_TRAFFIC } from '@e2b/code-interpreter' +import { Sandbox, ALL_TRAFFIC } from 'e2b' // Deny all outbound traffic const sandbox = await Sandbox.create({ @@ -218,7 +218,7 @@ const sandbox = await Sandbox.create({ }) ``` ```python Python -from e2b_code_interpreter import Sandbox, ALL_TRAFFIC +from e2b import Sandbox, ALL_TRAFFIC # Deny all outbound traffic sandbox = Sandbox.create( @@ -234,7 +234,7 @@ Every sandbox has a public URL that can be used to access running services insid ```js JavaScript & TypeScript highlight={6} -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' const sandbox = await Sandbox.create() @@ -243,7 +243,7 @@ const host = sandbox.getHost(3000) console.log(`https://${host}`) ``` ```python Python highlight={6} -from e2b_code_interpreter import Sandbox +from e2b import Sandbox sandbox = Sandbox.create() @@ -272,7 +272,7 @@ By default, sandbox URLs are publicly accessible. You can restrict access to req ```js JavaScript & TypeScript -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' // Create sandbox with restricted public access const sandbox = await Sandbox.create({ @@ -304,7 +304,7 @@ console.log(response2.status) // 200 ``` ```python Python import requests -from e2b_code_interpreter import Sandbox +from e2b import Sandbox # Create sandbox with restricted public access sandbox = Sandbox.create( @@ -343,7 +343,7 @@ In this example we will start a simple HTTP server that listens on port 3000 and ```js JavaScript & TypeScript -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' const sandbox = await Sandbox.create() @@ -363,7 +363,7 @@ await process.kill() ``` ```python Python import requests -from e2b_code_interpreter import Sandbox +from e2b import Sandbox sandbox = Sandbox.create() @@ -434,7 +434,7 @@ You can customize the `Host` header that gets sent to services running inside th ```js JavaScript & TypeScript -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' // Create sandbox with custom host masking const sandbox = await Sandbox.create({ @@ -447,7 +447,7 @@ const sandbox = await Sandbox.create({ // Requests to the sandbox will have Host header set to for example: localhost:8080 ``` ```python Python -from e2b_code_interpreter import Sandbox +from e2b import Sandbox # Create sandbox with custom host masking sandbox = Sandbox.create( diff --git a/docs/sandbox/lifecycle-events-api.mdx b/docs/sandbox/lifecycle-events-api.mdx index 219bbc18..e7ae900d 100644 --- a/docs/sandbox/lifecycle-events-api.mdx +++ b/docs/sandbox/lifecycle-events-api.mdx @@ -13,7 +13,7 @@ Query Parameters: ```js JavaScript & TypeScript -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' const sbx = await Sandbox.create() @@ -87,7 +87,7 @@ console.log(teamSandboxEvents) ``` ```python Python import requests -from e2b_code_interpreter import Sandbox +from e2b import Sandbox sbx = Sandbox.create() diff --git a/docs/sandbox/list.mdx b/docs/sandbox/list.mdx index 4d836e8f..dcdcb564 100644 --- a/docs/sandbox/list.mdx +++ b/docs/sandbox/list.mdx @@ -14,7 +14,7 @@ The `Sandbox.list()` method supports pagination. In the [advanced pagination](/d ```js JavaScript & TypeScript highlight={6,11,14,24} - import { Sandbox, SandboxInfo } from '@e2b/code-interpreter' + import { Sandbox, SandboxInfo } from 'e2b' const sandbox = await Sandbox.create( { @@ -40,7 +40,7 @@ The `Sandbox.list()` method supports pagination. In the [advanced pagination](/d const nextPage = await paginator.nextItems() ``` ```python Python highlight={5,9,12,22} - from e2b_code_interpreter import Sandbox, SandboxInfo + from e2b import Sandbox, SandboxInfo sandbox = Sandbox.create( metadata={ @@ -87,7 +87,7 @@ Filter sandboxes by their current state. The state parameter can contain either ```js JavaScript & TypeScript highlight={9,13} - import { Sandbox } from '@e2b/code-interpreter' + import { Sandbox } from 'e2b' // Create a sandbox. const sandbox = await Sandbox.create() @@ -102,7 +102,7 @@ Filter sandboxes by their current state. The state parameter can contain either const sandboxes = await paginator.nextItems() ``` ```python Python highlight={9,14} - from e2b_code_interpreter import Sandbox, SandboxQuery, SandboxState + from e2b import Sandbox, SandboxQuery, SandboxState # Create a sandbox with metadata. sandbox = Sandbox.create() @@ -123,7 +123,7 @@ Filter sandboxes by the metadata key value pairs specified during Sandbox creati ```js JavaScript & TypeScript highlight={6-8,15,18} - import { Sandbox } from '@e2b/code-interpreter' + import { Sandbox } from 'e2b' // Create sandbox with metadata. const sandbox = await Sandbox.create({ @@ -144,7 +144,7 @@ Filter sandboxes by the metadata key value pairs specified during Sandbox creati const sandboxes = await paginator.nextItems() ``` ```python Python highlight={6-8,16-17} - from e2b_code_interpreter import Sandbox, SandboxQuery, SandboxState + from e2b import Sandbox, SandboxQuery, SandboxState # Create sandbox with metadata. sandbox = Sandbox.create( @@ -176,7 +176,7 @@ For more granular pagination, you can set custom per-page item limit (default an ```js JavaScript & TypeScript highlight={4-5,16} - import { Sandbox } from '@e2b/code-interpreter' + import { Sandbox } from 'e2b' const paginator = Sandbox.list({ limit: 100, @@ -194,7 +194,7 @@ For more granular pagination, you can set custom per-page item limit (default an await paginator.nextItems() ``` ```python Python highlight={5-6,13} - from e2b_code_interpreter import Sandbox + from e2b import Sandbox # List running sandboxes that has `userId` key with value `123` and `env` key with value `dev`. paginator = Sandbox.list( @@ -214,7 +214,7 @@ You can fetch all pages by looping through the paginator while checking if there ```js JavaScript & TypeScript highlight={7} - import { Sandbox } from '@e2b/code-interpreter' + import { Sandbox } from 'e2b' const paginator = Sandbox.list() @@ -226,7 +226,7 @@ You can fetch all pages by looping through the paginator while checking if there } ``` ```python Python highlight={7} - from e2b_code_interpreter import Sandbox, SandboxQuery + from e2b import Sandbox, SandboxQuery paginator = Sandbox.list() @@ -247,7 +247,7 @@ You can fetch all pages by looping through the paginator while checking if there ```js JavaScript & TypeScript highlight={11} - import { Sandbox } from '@e2b/code-interpreter' + import { Sandbox } from 'e2b' // Create a sandbox. const sandbox = await Sandbox.create({ @@ -266,7 +266,7 @@ You can fetch all pages by looping through the paginator while checking if there console.log('Running sandbox template id:', runningSandbox.templateId) ``` ```python Python highlight={11} - from e2b_code_interpreter import Sandbox + from e2b import Sandbox # Create a sandbox. sandbox = Sandbox.create( @@ -295,7 +295,7 @@ This can be useful when you have a large number of sandboxes and want to find on ```js JavaScript & TypeScript highlight={6-8,15} - import { Sandbox } from '@e2b/code-interpreter' + import { Sandbox } from 'e2b' // Create sandbox with metadata. const sandbox = await Sandbox.create({ @@ -314,7 +314,7 @@ This can be useful when you have a large number of sandboxes and want to find on }) ``` ```python Python highlight={7-9,17-18} - from e2b_code_interpreter import Sandbox + from e2b import Sandbox from e2b.sandbox.sandbox_api import SandboxQuery # Create sandbox with metadata. diff --git a/docs/sandbox/metadata.mdx b/docs/sandbox/metadata.mdx index 026c4362..0fdae6a0 100644 --- a/docs/sandbox/metadata.mdx +++ b/docs/sandbox/metadata.mdx @@ -14,7 +14,7 @@ You specify metadata when creating a sandbox and can access it later through lis ```js JavaScript & TypeScript highlight={6} -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' // Create sandbox with metadata. const sandbox = await Sandbox.create({ @@ -33,7 +33,7 @@ const runningSandboxes = await paginator.nextItems() console.log(runningSandboxes[0].metadata) ``` ```python Python highlight={6} -from e2b_code_interpreter import Sandbox +from e2b import Sandbox # Create sandbox with metadata. sandbox = Sandbox.create( diff --git a/docs/sandbox/metrics.mdx b/docs/sandbox/metrics.mdx index 99769f47..a8a05515 100644 --- a/docs/sandbox/metrics.mdx +++ b/docs/sandbox/metrics.mdx @@ -13,7 +13,7 @@ The metrics are collected every 5 seconds. ```js JavaScript & TypeScript highlight={9} -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' const sbx = await Sandbox.create() console.log('Sandbox created', sbx.sandboxId) @@ -52,7 +52,7 @@ console.log('Sandbox metrics:', metrics) ``` ```python Python highlight={10} from time import sleep -from e2b_code_interpreter import Sandbox +from e2b import Sandbox sbx = Sandbox.create() print('Sandbox created', sbx.sandbox_id) diff --git a/docs/sandbox/persistence.mdx b/docs/sandbox/persistence.mdx index e6555a9f..40e315f3 100644 --- a/docs/sandbox/persistence.mdx +++ b/docs/sandbox/persistence.mdx @@ -39,7 +39,7 @@ flowchart TD ```js JavaScript & TypeScript -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' const sandbox = await Sandbox.create() // Starts in Running state @@ -54,7 +54,7 @@ await sandbox.kill() // Running/Paused → Killed ``` ```python Python -from e2b_code_interpreter import Sandbox +from e2b import Sandbox sandbox = Sandbox.create() # Starts in Running state @@ -74,7 +74,7 @@ When you pause a sandbox, both the sandbox's filesystem and memory state will be ```js JavaScript & TypeScript highlight={8-9} -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' const sbx = await Sandbox.create() console.log('Sandbox created', sbx.sandboxId) @@ -85,7 +85,7 @@ await sbx.pause() console.log('Sandbox paused', sbx.sandboxId) ``` ```python Python highlight={8-9} -from e2b_code_interpreter import Sandbox +from e2b import Sandbox sbx = Sandbox.create() print('Sandbox created', sbx.sandbox_id) @@ -104,7 +104,7 @@ This means that all the files in the sandbox's filesystem will be restored and a ```js JavaScript & TypeScript highlight={12-13} -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' const sbx = await Sandbox.create() console.log('Sandbox created', sbx.sandboxId) @@ -119,7 +119,7 @@ const sameSbx = await sbx.connect() console.log('Connected to the sandbox', sameSbx.sandboxId) ``` ```python Python highlight={12-13} -from e2b_code_interpreter import Sandbox +from e2b import Sandbox sbx = Sandbox.create() print('Sandbox created', sbx.sandbox_id) @@ -141,7 +141,7 @@ More information about using the method can be found in [List Sandboxes](/docs/s ```js JavaScript & TypeScript highlight={4,7} -import { Sandbox, SandboxInfo } from '@e2b/code-interpreter' +import { Sandbox, SandboxInfo } from 'e2b' // List all paused sandboxes const paginator = Sandbox.list({ query: { state: ['paused'] } }) @@ -157,7 +157,7 @@ while (paginator.hasNext) { ``` ```python Python highlight={4,7} # List all paused sandboxes -from e2b_code_interpreter import Sandbox, SandboxQuery, SandboxState +from e2b import Sandbox, SandboxQuery, SandboxState paginator = Sandbox.list(SandboxQuery(state=[SandboxState.PAUSED])) @@ -177,7 +177,7 @@ You can remove paused sandboxes by calling the `kill` method on the Sandbox inst ```js JavaScript & TypeScript highlight={11,14} -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' const sbx = await Sandbox.create() console.log('Sandbox created', sbx.sandboxId) @@ -193,7 +193,7 @@ await sbx.kill() await Sandbox.kill(sbx.sandboxId) ``` ```python Python highlight={9,12} -from e2b_code_interpreter import Sandbox +from e2b import Sandbox sbx = Sandbox.create() @@ -213,12 +213,12 @@ When you connect to a sandbox, the timeout resets. The default is 5 minutes, but ```js JavaScript & TypeScript -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' const sbx = await Sandbox.connect(sandboxId, { timeoutMs: 60 * 1000 }) // 60 seconds ``` ```python Python -from e2b_code_interpreter import Sandbox +from e2b import Sandbox sbx = Sandbox.connect(sandbox_id, timeout=60) # 60 seconds ``` diff --git a/docs/sandbox/pty.mdx b/docs/sandbox/pty.mdx index 2c5db488..f2f8bb89 100644 --- a/docs/sandbox/pty.mdx +++ b/docs/sandbox/pty.mdx @@ -17,7 +17,7 @@ Use `sandbox.pty.create()` to start an interactive bash shell. ```js JavaScript & TypeScript -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' const sandbox = await Sandbox.create() @@ -38,7 +38,7 @@ console.log('Terminal PID:', terminal.pid) ``` ```python Python -from e2b_code_interpreter import Sandbox +from e2b import Sandbox sandbox = Sandbox() @@ -66,7 +66,7 @@ PTY sessions have a configurable timeout that controls the session duration. The ```js JavaScript & TypeScript -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' const sandbox = await Sandbox.create() @@ -79,7 +79,7 @@ const terminal = await sandbox.pty.create({ ``` ```python Python -from e2b_code_interpreter import Sandbox +from e2b import Sandbox sandbox = Sandbox() @@ -100,7 +100,7 @@ Use `sendInput()` in JavaScript or `send_stdin()` in Python to send data to the ```js JavaScript & TypeScript -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' const sandbox = await Sandbox.create() @@ -118,7 +118,7 @@ await sandbox.pty.sendInput( ``` ```python Python -from e2b_code_interpreter import Sandbox +from e2b import Sandbox sandbox = Sandbox() @@ -140,7 +140,7 @@ When the user's terminal window changes size, notify the PTY with `resize()`. Th ```js JavaScript & TypeScript -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' const sandbox = await Sandbox.create() @@ -158,7 +158,7 @@ await sandbox.pty.resize(terminal.pid, { ``` ```python Python -from e2b_code_interpreter import Sandbox +from e2b import Sandbox sandbox = Sandbox() @@ -182,7 +182,7 @@ You can disconnect from a PTY session while keeping it running, then reconnect l ```js JavaScript & TypeScript -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' const sandbox = await Sandbox.create() @@ -215,7 +215,7 @@ await reconnected.wait() ```python Python import time -from e2b_code_interpreter import Sandbox +from e2b import Sandbox sandbox = Sandbox() @@ -255,7 +255,7 @@ Terminate the PTY session with `kill()`. ```js JavaScript & TypeScript -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' const sandbox = await Sandbox.create() @@ -274,7 +274,7 @@ console.log('Killed:', killed) // true if successful ``` ```python Python -from e2b_code_interpreter import Sandbox +from e2b import Sandbox sandbox = Sandbox() @@ -299,7 +299,7 @@ Use `wait()` to wait for the terminal session to end (e.g., when the user types ```js JavaScript & TypeScript -import { Sandbox } from '@e2b/code-interpreter' +import { Sandbox } from 'e2b' const sandbox = await Sandbox.create() @@ -318,7 +318,7 @@ console.log('Exit code:', result.exitCode) ``` ```python Python -from e2b_code_interpreter import Sandbox +from e2b import Sandbox sandbox = Sandbox() diff --git a/docs/sandbox/secured-access.mdx b/docs/sandbox/secured-access.mdx index d01ce3db..d98f23b1 100644 --- a/docs/sandbox/secured-access.mdx +++ b/docs/sandbox/secured-access.mdx @@ -41,13 +41,13 @@ Disabling secured access is discouraged because it creates security vulnerabilit ```js JavaScript & TypeScript - import { Sandbox } from '@e2b/code-interpreter' + import { Sandbox } from 'e2b' const sandbox = await Sandbox.create({ secure: false }) // Explicitly disable ``` ```python Python - from e2b_code_interpreter import Sandbox + from e2b import Sandbox sandbox = Sandbox.create(secure=False) # Explicitly disable ```