Skip to main content

E2B SDK that give agents cloud environments

Project description

e2b logo

Last 1 month downloads for the Python SDK

What is E2B?

E2B 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 or Python SDK.

Run your first Sandbox

1. Install SDK

pip install e2b

2. Get your E2B API key

  1. Sign up to E2B here.
  2. Get your API key here.
  3. Set environment variable with your API key
E2B_API_KEY=e2b_***

3. Start a sandbox and run commands

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:

pip install e2b-code-interpreter
from e2b_code_interpreter import Sandbox

with Sandbox.create() as sandbox:
    execution = sandbox.run_code("x = 1; x += 1; x")
    print(execution.text)  # outputs 2

5. Check docs

Visit E2B documentation.

6. E2B cookbook

Visit our Cookbook to get inspired by examples with different LLMs and AI frameworks.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

e2b-2.29.0.tar.gz (167.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

e2b-2.29.0-py3-none-any.whl (315.7 kB view details)

Uploaded Python 3

File details

Details for the file e2b-2.29.0.tar.gz.

File metadata

  • Download URL: e2b-2.29.0.tar.gz
  • Upload date:
  • Size: 167.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.10.20 Linux/6.8.0-1052-azure

File hashes

Hashes for e2b-2.29.0.tar.gz
Algorithm Hash digest
SHA256 1a856dfb7f836f112b1f0443bedace279a154f7985ce09b057f61e2a824fe1a5
MD5 d9130e313e5db5cb5f669f3468125cf3
BLAKE2b-256 dbe2504769a849f89edbcadce83b5cf6cbc19af7d061aab84893a2fa84d52e17

See more details on using hashes here.

File details

Details for the file e2b-2.29.0-py3-none-any.whl.

File metadata

  • Download URL: e2b-2.29.0-py3-none-any.whl
  • Upload date:
  • Size: 315.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.10.20 Linux/6.8.0-1052-azure

File hashes

Hashes for e2b-2.29.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ae22a249f55c7e486ff3aa0e2a6fa0eb88d9d67e44dff70217a6afb03c8b27c9
MD5 3b15a503e65039a6d2962f92f8d3d4e8
BLAKE2b-256 ef910feef4ee81f9db3f4f58eeb2319d4956499887ad7a5b7771f1d03e049167

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page