Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Default to base e2b SDK in READMEs (#1232)

Berrya240f99db523
diff --git a/README.md b/README.md
index 9a265c92c..4da465df6 100644
--- a/README.md
+++ b/README.md
@@ -19,10 +19,7 @@
<img width="100%" src="/readme-assets/preview.png" alt="Cover image">
--->
## What is E2B?
-[E2B](https://www.e2b.dev/) is an open-source infrastructure that allows you to run AI-generated code in secure isolated sandboxes in the cloud. To start and control sandboxes, use our [JavaScript SDK](https://www.npmjs.com/package/@e2b/code-interpreter) or [Python SDK](https://pypi.org/project/e2b_code_interpreter).
-
-> [!NOTE]
-> This repository contains the core E2B SDK that's used in our main [E2B Code Interpreter SDK](https://github.com/e2b-dev/code-interpreter).
+[E2B](https://www.e2b.dev/) is an open-source infrastructure that allows you to run AI-generated code in secure isolated sandboxes in the cloud. To start and control sandboxes, use our [JavaScript SDK](https://www.npmjs.com/package/e2b) or [Python SDK](https://pypi.org/project/e2b).
## Run your first Sandbox
@@ -30,12 +27,12 @@
JavaScript / TypeScript
```
-npm i @e2b/code-interpreter
+npm i e2b
```
Python
```
-pip install e2b-code-interpreter
+pip install e2b
```
### 2. Get your E2B API key
@@ -44,35 +41,49 @@ pip install e2b-code-interpreter
3. Set environment variable with your API key
```
E2B_API_KEY=e2b_***
-```
+```
-### 3. Execute code with code interpreter inside Sandbox
+### 3. Start a sandbox and run commands
JavaScript / TypeScript
```ts
-import { Sandbox } from '@e2b/code-interpreter'
+import Sandbox from 'e2b'
const sandbox = await Sandbox.create()
-await sandbox.runCode('x = 1')
-
-const execution = await sandbox.runCode('x+=1; x')
-console.log(execution.text) // outputs 2
+const result = await sandbox.commands.run('echo "Hello from E2B!"')
+console.log(result.stdout) // Hello from E2B!
```
Python
```py
-from e2b_code_interpreter import Sandbox
+from e2b import Sandbox
with Sandbox.create() as sandbox:
- sandbox.run_code("x = 1")
- execution = sandbox.run_code("x+=1; x")
- print(execution.text) # outputs 2
+ result = sandbox.commands.run('echo "Hello from E2B!"')
+ print(result.stdout) # Hello from E2B!
+```
+
+### 4. Code execution with Code Interpreter
+
+If you need to execute code with `runCode()`/`run_code()`, install the [Code Interpreter SDK](https://github.com/e2b-dev/code-interpreter):
+
+```
+npm i @e2b/code-interpreter # JavaScript/TypeScript
+pip install e2b-code-interpreter # Python
+```
+
+```ts
+import { Sandbox } from '@e2b/code-interpreter'
+
+const sandbox = await Sandbox.create()
+const execution = await sandbox.runCode('x = 1; x += 1; x')
+console.log(execution.text) // outputs 2
```
-### 4. Check docs
+### 5. Check docs
Visit [E2B documentation](https://e2b.dev/docs).
-### 5. E2B cookbook
+### 6. E2B cookbook
Visit our [Cookbook](https://github.com/e2b-dev/e2b-cookbook/tree/main) to get inspired by examples with different LLMs and AI frameworks.
## Self-hosting
diff --git a/packages/js-sdk/README.md b/packages/js-sdk/README.md
index f996a74ba..8be92bdee 100644
--- a/packages/js-sdk/README.md
+++ b/packages/js-sdk/README.md
@@ -13,14 +13,14 @@
<img width="100%" src="/readme-assets/preview.png" alt="Cover image">
--->
## What is E2B?
-[E2B](https://www.e2b.dev/) is an open-source infrastructure that allows you to run AI-generated code in secure isolated sandboxes in the cloud. To start and control sandboxes, use our [JavaScript SDK](https://www.npmjs.com/package/@e2b/code-interpreter) or [Python SDK](https://pypi.org/project/e2b_code_interpreter).
+[E2B](https://www.e2b.dev/) is an open-source infrastructure that allows you to run AI-generated code in secure isolated sandboxes in the cloud. To start and control sandboxes, use our [JavaScript SDK](https://www.npmjs.com/package/e2b) or [Python SDK](https://pypi.org/project/e2b).
## Run your first Sandbox
### 1. Install SDK
```bash
-npm i @e2b/code-interpreter
+npm i e2b
```
### 2. Get your E2B API key
@@ -29,22 +29,36 @@ npm i @e2b/code-interpreter
3. Set environment variable with your API key
```
E2B_API_KEY=e2b_***
-```
+```
-### 3. Execute code with code interpreter inside Sandbox
+### 3. Start a sandbox and run commands
```ts
-import { Sandbox } from '@e2b/code-interpreter'
+import Sandbox from 'e2b'
+
+const sandbox = await Sandbox.create()
+const result = await sandbox.commands.run('echo "Hello from E2B!"')
+console.log(result.stdout) // Hello from E2B!
+```
+
+### 4. Code execution with Code Interpreter
+
+If you need `runCode()`, install the [Code Interpreter SDK](https://github.com/e2b-dev/code-interpreter):
-const sbx = await Sandbox.create()
-await sbx.runCode('x = 1')
+```bash
+npm i @e2b/code-interpreter
+```
+
+```ts
+import { Sandbox } from '@e2b/code-interpreter'
-const execution = await sbx.runCode('x+=1; x')
+const sandbox = await Sandbox.create()
+const execution = await sandbox.runCode('x = 1; x += 1; x')
console.log(execution.text) // outputs 2
```
-### 4. Check docs
+### 5. Check docs
Visit [E2B documentation](https://e2b.dev/docs).
-### 5. E2B cookbook
+### 6. E2B cookbook
Visit our [Cookbook](https://github.com/e2b-dev/e2b-cookbook/tree/main) to get inspired by examples with different LLMs and AI frameworks.
diff --git a/packages/python-sdk/README.md b/packages/python-sdk/README.md
index f0737c6e4..c688d33ef 100644
--- a/packages/python-sdk/README.md
+++ b/packages/python-sdk/README.md
@@ -10,14 +10,14 @@
## What is E2B?
-[E2B](https://www.e2b.dev/) is an open-source infrastructure that allows you to run AI-generated code in secure isolated sandboxes in the cloud. To start and control sandboxes, use our [JavaScript SDK](https://www.npmjs.com/package/@e2b/code-interpreter) or [Python SDK](https://pypi.org/project/e2b_code_interpreter).
+[E2B](https://www.e2b.dev/) is an open-source infrastructure that allows you to run AI-generated code in secure isolated sandboxes in the cloud. To start and control sandboxes, use our [JavaScript SDK](https://www.npmjs.com/package/e2b) or [Python SDK](https://pypi.org/project/e2b).
## Run your first Sandbox
### 1. Install SDK
```
-pip install e2b-code-interpreter
+pip install e2b
```
### 2. Get your E2B API key
@@ -26,21 +26,36 @@ pip install e2b-code-interpreter
3. Set environment variable with your API key
```
E2B_API_KEY=e2b_***
-```
+```
-### 3. Execute code with code interpreter inside Sandbox
+### 3. Start a sandbox and run commands
+
+```py
+from e2b import Sandbox
+
+with Sandbox.create() as sandbox:
+ result = sandbox.commands.run('echo "Hello from E2B!"')
+ print(result.stdout) # Hello from E2B!
+```
+
+### 4. Code execution with Code Interpreter
+
+If you need `run_code()`, install the [Code Interpreter SDK](https://github.com/e2b-dev/code-interpreter):
+
+```
+pip install e2b-code-interpreter
+```
```py
from e2b_code_interpreter import Sandbox
with Sandbox.create() as sandbox:
- sandbox.run_code("x = 1")
- execution = sandbox.run_code("x+=1; x")
+ execution = sandbox.run_code("x = 1; x += 1; x")
print(execution.text) # outputs 2
```
-### 4. Check docs
+### 5. Check docs
Visit [E2B documentation](https://e2b.dev/docs).
-### 5. E2B cookbook
+### 6. E2B cookbook
Visit our [Cookbook](https://github.com/e2b-dev/e2b-cookbook/tree/main) to get inspired by examples with different LLMs and AI frameworks.