Skip to main content

langchain-instabox

Run Deep Agents in instabox sandboxes: cloud Linux machines for agents. The agent's shell commands and file tools run in the sandbox, not on your machine.

pip install langchain-instabox
export INSTABOX_API_KEY=ibk_...

Create the key on API keys in the dashboard. It needs machines:read, machines:write and machines:delete. Add images:read to start sandboxes from snapshots.

Use it as a Deep Agents backend

from deepagents import create_deep_agent
from instabox import Client

from langchain_instabox import InstaboxSandbox

client = Client()  # reads INSTABOX_API_KEY
machine = client.machines.create(delete_after_seconds=3600)
prompt = "Write and run a Python script that prints the first 10 primes"
try:
    backend = InstaboxSandbox(client=client, machine=machine)
    agent = create_deep_agent(model="anthropic:claude-sonnet-4-5", backend=backend)
    agent.invoke({"messages": [{"role": "user", "content": prompt}]})
finally:
    client.machines.delete(machine.id, confirm=machine.id)

InstaboxSandbox(client=..., machine=..., timeout=1800) wraps a sandbox you already have: pass a Machine or its ID or name. Commands run with bash -lc as the sandbox user, starting in /data/home.

  • A command runs for at most 600 seconds. A longer timeout is capped at 600, and a command that runs out of time exits with 124 and a note in its output.
  • Output is capped at 1 MiB per command. Longer output comes back with truncated=True.
  • A sandbox pauses after 30 idle minutes by default. The next command resumes it first.
  • File paths must be absolute. Writing a file creates missing parent directories.

Use it from Deep Agents Code

Installing the package registers an instabox sandbox provider for the dcode CLI:

dcode install langchain-instabox --package
dcode --sandbox instabox

dcode creates a sandbox, runs the session in it and deletes it at the end. To keep working in one sandbox across sessions, pass its ID or name with --sandbox-id: dcode then leaves it alone when the session ends, and resumes it if it was paused. --sandbox-snapshot NAME starts the new sandbox from one of your snapshots (by ID or name).

Settings, as environment variables (each also works with a DEEPAGENTS_CODE_ prefix):

Variable Meaning
INSTABOX_API_KEY API key (required)
INSTABOX_TEMPLATE Template for new sandboxes, such as universal or minimal (default: instabox's default template)
INSTABOX_DELETE_AFTER Seconds (60 to 86400) after which instabox deletes a new sandbox, even if dcode exits without cleaning up
INSTABOX_API_URL API server (default https://api.instabox.sh)

The same settings can go in ~/.deepagents/config.toml as provider params: template, name, metadata, delete_after and timeout.

Tests

pip install -e . pytest pytest-asyncio pytest-timeout langchain-tests
pytest tests/unit_tests
INSTABOX_API_KEY=ibk_... pytest tests/integration_tests  # creates and deletes a sandbox

The integration tests run Deep Agents' standard sandbox suite (SandboxIntegrationTests).

License

Apache-2.0

Metadata

Release files for langchain-instabox 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langchain-instabox 0.1.0
File Size Uploaded Provenance Actions
langchain_instabox-0.1.0.tar.gz 10.6 kB With provenance Details for langchain_instabox-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for langchain-instabox 0.1.0
File Interpreter ABI Platform Actions
langchain_instabox-0.1.0-py3-none-any.whl Python 3 none any Details for langchain_instabox-0.1.0-py3-none-any.whl

Total release size: 18.7 kB

Release files / langchain_instabox-0.1.0.tar.gz

Download URL langchain_instabox-0.1.0.tar.gz
Size 10.6 kB
Tags Source
SHA-256 checksum
How to use checksums
b7964ff36d86e4b1f9c543c752746cb68bd40ea0f363e06e20f3b4f10388adbd
BLAKE2b-256 checksum
How to use checksums
3f0b123f61ce88dd75e18a0d336e1a8958ce207a700508f2b7d9f9fbb3fe195e
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 20, 2026.

Transparency log

Release files / langchain_instabox-0.1.0-py3-none-any.whl

Download URL langchain_instabox-0.1.0-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ad405b2341db6808da1ccbba4666fe02393685f4fae7898963f4aca19ba60347
BLAKE2b-256 checksum
How to use checksums
7e44f86cc5940d363149f7f85f07b0b196d54c7a119eb98d3d3a6afe0a5119eb
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 20, 2026.

Transparency log

Security for langchain-instabox 0.1.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.

Select from 2 files

Attestation for langchain_instabox-0.1.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 20, 2026.

Transparency log

A 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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page