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.6.tar.gz (213.0 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.6-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_e2b-0.0.6.tar.gz
  • Upload date:
  • Size: 213.0 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.6.tar.gz
Algorithm Hash digest
SHA256 d835df2c229e4b0879f44c0d4666873b33ce89901aba645bd870e4a13832e1c3
MD5 a0f305ffa58cff586c19c4a721de0d60
BLAKE2b-256 1d9e3a59e5169746c6951c8b4ddfc09e3540e96d8845ebe33b7e98900bf7259b

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_e2b-0.0.6.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.6-py3-none-any.whl.

File metadata

  • Download URL: langchain_e2b-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 11.1 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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 ca2e627835234e9e4ab6d9ce95e9e16bbc9ce2c4f88027c6ccf7157bbd2a4f19
MD5 d8d313e5f19b4079b953fa141aac78a3
BLAKE2b-256 3e190ec2edc2f2540e278518415ee9b6822167e234d6fff9a8ab09513e904135

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_e2b-0.0.6-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