Skip to main content

E2B sandbox integration for Deep Agents

Project description

langchain-e2b

PyPI - Version PyPI - License PyPI - Downloads

Quick Install

pip install langchain-e2b

Deep Agents SDK

from e2b import Sandbox
from langchain_e2b import E2BSandbox

e2b_sandbox = Sandbox.create()
backend = E2BSandbox(sandbox=e2b_sandbox)

try:
    result = backend.execute("echo hello")
    print(result.output)
finally:
    e2b_sandbox.kill()

For async agents, use E2B's async SDK with the async backend:

from e2b import AsyncSandbox
from langchain_e2b import AsyncE2BSandbox

e2b_sandbox = await AsyncSandbox.create()
backend = AsyncE2BSandbox(sandbox=e2b_sandbox)

try:
    result = await backend.aexecute("echo hello")
    print(result.output)
finally:
    await e2b_sandbox.kill()

Deep Agents Code

Install langchain-e2b into the dcode environment, then run with the E2B sandbox provider:

dcode --install langchain-e2b --package
export E2B_API_KEY=...
dcode --sandbox e2b

What is this?

langchain-e2b adapts an existing E2B sandbox to the Deep Agents sandbox protocol. It uses the low-level e2b SDK so Deep Agents can run shell commands and move files through the standard Deep Agents sandbox interface.

For SDK use, this package intentionally does not hide E2B sandbox lifecycle management. Use the E2B SDK to create, connect to, configure, and kill sandboxes, then pass the connected sandbox object to E2BSandbox.

For Deep Agents Code, the package also exposes a dcode sandbox provider entry point. The provider creates, reconnects to, and deletes E2B sandboxes for dcode --sandbox e2b.

Contributing

Contributions are welcome. Keep the adapter focused on implementing the Deep Agents sandbox backend protocol over the official E2B SDK.

Development

uv sync --group test
make test
make lint

Integration tests require E2B_API_KEY:

E2B_API_KEY=... make integration_tests

Project details


Download files

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

Source Distribution

langchain_e2b-0.0.5.tar.gz (212.7 kB view details)

Uploaded Source

Built Distribution

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

langchain_e2b-0.0.5-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file langchain_e2b-0.0.5.tar.gz.

File metadata

  • Download URL: langchain_e2b-0.0.5.tar.gz
  • Upload date:
  • Size: 212.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for langchain_e2b-0.0.5.tar.gz
Algorithm Hash digest
SHA256 99dadff01fa1bcdb2d03361fe1f3ed74daf20c4c60b1a2965ee95dd4fa2083ca
MD5 e5fa29bc5ef668861fc18b7043bd0f9e
BLAKE2b-256 bd154c5e284292a9c1aa2c0f5ee449dde13823782582d2e518db4050801ad806

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_e2b-0.0.5.tar.gz:

Publisher: release.yml on e2b-dev/langchain-e2b

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file langchain_e2b-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: langchain_e2b-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for langchain_e2b-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d315b6b92c18402cd900983e7a30bed1022a08f3ea11d7fbd417cc1bc152c755
MD5 ace2186228a69f9d17698843173eaf0f
BLAKE2b-256 a53df6fc9e31cf5a111fdbd38a515bd286ccbc531658486d9b26e0b8eb10c941

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_e2b-0.0.5-py3-none-any.whl:

Publisher: release.yml on e2b-dev/langchain-e2b

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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