Leap0 integration for LangChain Deep Agents: a BaseSandbox backend that runs shell commands and file transfers inside a Leap0 sandbox.
Leap0 is enterprise-grade cloud sandboxes for AI agents. Launch isolated sandboxes in ~200ms. Give every agent its own compute, filesystem, and network boundary while your agents run safely.
pip install langchain-leap0Set your API key (see Leap0 for account and key management):
export LEAP0_API_KEY="your-key"Minimal usage with the [leap0](https://pypi.org/project/leap0/) SDK and Leap0Sandbox:
from leap0 import Leap0Client
from langchain_leap0 import Leap0Sandbox
client = Leap0Client()
sandbox = client.sandboxes.create()
backend = Leap0Sandbox(client=client, sandbox=sandbox)
try:
result = backend.execute("echo 'Hello LangChain from Leap0.dev'")
print(result.output)
finally:
client.sandboxes.delete(sandbox)
client.close()Runnable scripts for Deep Agents sandboxes. Environment variables and run commands are documented in each example’s module docstring. LangChain sandbox integration tests: make integration_test.
| Script | Summary |
|---|---|
examples/basic_sandbox.py |
Minimal: create a sandbox, Leap0Sandbox.execute(), teardown. Requires LEAP0_API_KEY. |
examples/deep_agent_sandbox.py |
create_deep_agent(..., backend=Leap0Sandbox(...)) — agent task to create and run a Python script; prints the agent invocation result. Requires LEAP0_API_KEY, OPENAI_API_KEY; optional OPENAI_MODEL (default openai:gpt-4o). |
From the repo root:
uv run python examples/basic_sandbox.py
uv run python examples/deep_agent_sandbox.pyFrom this directory (alongside leap0-python in the Leap0 workspace). Uses pyproject.toml dependencies; run:
cd langchain-leap0
uv sync --all-groupsFrom the package root:
# Unit tests
make test
# LangChain standard sandbox integration tests
make integration_testIntegration tests require:
export LEAP0_API_KEY="your-key"Full documentation is available at leap0.dev/docs.
Apache License 2.0. See LICENSE for details.