langchain-wbxsandbox
WBX Sandbox backend for Deep Agents. It lets a deep agent run shell commands and work with files inside a WBX sandbox instead of on your own machine. WBX Sandbox is listed among the sandbox integrations in the LangChain documentation.
Each WBX sandbox is a Firecracker microVM with its own Linux kernel and disk, started from
a template (for example base, Debian with Python) on servers in Europe. Network access follows
your team's network rules and can be restricted per sandbox (no network, or allowed destinations
only). The sandbox and its data are destroyed when you kill it or when its lifetime runs out.
What the agent gets:
- the
executetool and the file tools (ls,read_file,write_file,edit_file,glob,grep), all running inside the microVM – root access,pip,npmandaptavailable - templates for Python, data analysis, a real browser, Node.js and more (templates)
- network control: full internet, an allowlist or no network at all (network)
- billing per second of vCPU and memory (pricing)
- the
wbxsandbox provider for Deep Agents Code (dcode --sandbox wbx)
Beyond this backend, the same account gives you background jobs and batches with price limits, signed execution receipts, public HTTPS URLs, metrics and an MCP server for AI assistants – see the documentation.
Install
pip install langchain-wbxsandbox
Requires Python 3.11+. Installs deepagents and the WBX Sandbox Python SDK (wbxsandbox).
Set up your API key
Create an API key in the WBX Sandbox portal (API keys) and set it in the environment:
export WBXSANDBOX_API_KEY="..."
# optional, defaults to https://sandbox.wbx.cz
export WBXSANDBOX_URL="https://sandbox.wbx.cz"
Use with a deep agent
from deepagents import create_deep_agent
from langchain_wbxsandbox import WBXSandbox
# Creates a sandbox from the "base" template; it is destroyed when the block ends.
with WBXSandbox.create(template="base", lifetime=1800) as sandbox:
agent = create_deep_agent(
model="anthropic:claude-sonnet-4-6",
system_prompt="You are a coding assistant. Use the sandbox to run code.",
backend=sandbox,
)
result = agent.invoke(
{
"messages": [
{
"role": "user",
"content": "Write fib.py that prints the first 10 Fibonacci numbers and run it.",
}
]
}
)
print(result["messages"][-1].content)
The model string needs the matching LangChain provider package, for example
pip install langchain-anthropic and ANTHROPIC_API_KEY.
The agent gets the execute tool and the file tools (ls, read_file, write_file,
edit_file, glob, grep), all running inside the sandbox.
Sandbox lifecycle
from langchain_wbxsandbox import WBXSandbox
# Create: template, lifetime (seconds until automatic destruction) and the default
# limit for one command (seconds). Other options go to wbxsandbox.Sandbox.create(),
# for example internet=False, allow=["pypi.org"], env={...}, metadata={...},
# name="my-project" with on_timeout="pause" (the sandbox falls asleep with its files
# instead of being destroyed), from_snapshot="snap_...", ip="dual" or
# compute_class="performance" – see https://sandbox.wbx.cz/docs/sdk.
sandbox = WBXSandbox.create(template="base", lifetime=3600, timeout=600)
print(sandbox.id)
# Run a command directly.
result = sandbox.execute("python3 --version")
print(result.exit_code, result.output)
# Reattach later (for example in the next turn of a conversation).
same = WBXSandbox.connect(sandbox.id)
# Destroy the sandbox with its disk and memory.
sandbox.kill()
You can also wrap a sandbox created with the SDK:
import wbxsandbox
from langchain_wbxsandbox import WBXSandbox
sb = wbxsandbox.Sandbox.create(template="code-interpreter", timeout=900)
backend = WBXSandbox(sandbox=sb)
Start agents from a prepared environment with a snapshot:
setup = WBXSandbox.create(template="fullstack")
setup.execute(
"pip install -q pandas && git clone https://github.com/you/project /home/user/project"
)
snap = setup.sandbox.snapshot(name="ready") # disk copy, kept until you delete it
setup.kill()
sandbox = WBXSandbox.create(from_snapshot=snap.id) # starts with everything installed
Behaviour worth knowing:
execute()runs the command with/bin/sh -c. Output is stdout followed by stderr, marked as<stderr>…</stderr>. A command that exceeds its timeout is stopped and returns exit code124.timeout=0means no limit.- Commands run as root inside the sandbox. A file without any read permission bit is reported
as
permission_deniedbydownload_files(), as on a system where the agent runs as an unprivileged user. - Uploads create missing parent directories. Relative paths are rejected with
invalid_path.
Deep Agents Code (dcode)
The package registers the wbx sandbox provider for
Deep Agents Code, so
after installing it next to deepagents-code no configuration is needed:
pip install langchain-wbxsandbox
export WBXSANDBOX_API_KEY="..."
dcode --sandbox wbx # new sandbox, deleted when the session ends
dcode --sandbox wbx --sandbox-id sb_... # work in an existing sandbox (it is kept)
dcode --sandbox wbx --sandbox-snapshot-name ready # start from a snapshot (name or snap_...)
dcode --sandbox wbx --sandbox-setup setup.sh # run a setup script first
-
New sandboxes use the
fullstacktemplate (Python, Node.js, git); the working directory is/home/user. SetWBXSANDBOX_TEMPLATEfor another template. -
A sandbox lives two hours and then falls asleep instead of being destroyed; the next command wakes it, so a long session keeps working. A sandbox left behind (for example after a crash) is deleted one day after it falls asleep.
-
WBXSANDBOX_API_KEYandWBXSANDBOX_URLcan also be set with theDEEPAGENTS_CODE_prefix. -
Options for
wbxsandbox.Sandbox.create()go to~/.deepagents/config.toml:[sandboxes.providers.wbx.params] compute_class = "performance" internet = true
Deep Agents Code needs Python 3.14; the backend itself works from Python 3.11.
Pricing
Sandboxes are billed by the WBX Sandbox platform – see https://sandbox.wbx.cz/pricing.
Development
pip install -e . --group test --group lint
pytest tests/unit_tests --disable-socket --allow-unix-socket # offline
WBXSANDBOX_API_KEY=... pytest tests/integration_tests # creates and kills real sandboxes
ruff check . && ruff format --check .
The integration tests run the LangChain standard sandbox suite (SandboxIntegrationTests)
against a real sandbox and destroy it afterwards. On Python 3.14 the test group also installs
deepagents-code, and the tests of the wbx provider run too (offline and against real
sandboxes).
License
MIT – see LICENSE.
Metadata
Release files for langchain-wbxsandbox 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| langchain_wbxsandbox-0.2.0.tar.gz | 16.9 kB | With provenance | Details for langchain_wbxsandbox-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| langchain_wbxsandbox-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for langchain_wbxsandbox-0.2.0-py3-none-any.whl |
Total release size: 29.3 kB
Release files / langchain_wbxsandbox-0.2.0.tar.gz
| Download URL | langchain_wbxsandbox-0.2.0.tar.gz |
|---|---|
| Size | 16.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ade459cbe789a9f712c1d009b7359f99f2db5e2c932ff796a6c5f1c643f833c2
|
|
BLAKE2b-256 checksum How to use checksums |
c579aaca34f8829469a9e870ff96f2f19db1773d0c228b1f95ccf5a2d56d4d54
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Transparency logRelease files / langchain_wbxsandbox-0.2.0-py3-none-any.whl
| Download URL | langchain_wbxsandbox-0.2.0-py3-none-any.whl |
|---|---|
| Size | 12.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bfa864ca8d96f61ab342cb042fb6b4a46d1e4c1344acec1d619ca2063cbedb15
|
|
BLAKE2b-256 checksum How to use checksums |
6bab280095cbf9958166a0515508887402cb7c61a5542617a2b52d4208a2ddd5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Transparency logSecurity for langchain-wbxsandbox 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for langchain_wbxsandbox-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.