Skip to main content

langchain-microsandbox

CI PyPI

Community-maintained Microsandbox integration for Deep Agents. It adapts an existing microsandbox.Sandbox to the current Deep Agents BaseSandbox interface.

This project targets the current local microVM-based Microsandbox SDK. It does not use the legacy PythonSandbox server/JSON-RPC API.

Requirements

  • Python 3.11 or newer.
  • deepagents>=0.7.0,<0.8.0.
  • microsandbox>=0.6.8,<0.7.0.
  • A platform supported by Microsandbox: Apple Silicon macOS, glibc-based Linux with KVM, or Windows with Windows Hypervisor Platform.
  • A sandbox image containing python3, because inherited Deep Agents file and search operations execute small Python helpers inside the guest.

Install

uv add langchain-microsandbox

Usage

Microsandbox's Python SDK is asynchronous, so construct the backend with await MicrosandboxSandbox.create(...).

from deepagents import create_deep_agent
from microsandbox import Sandbox

from langchain_microsandbox import MicrosandboxSandbox


sandbox = await Sandbox.create(
    "deepagents-session",
    image="python:3.13-slim",
    ephemeral=True,
)
try:
    backend = await MicrosandboxSandbox.create(sandbox)
    agent = create_deep_agent(backend=backend)
    result = await agent.ainvoke(
        {
            "messages": [
                {
                    "role": "user",
                    "content": "Create a small Python package and run pytest.",
                }
            ]
        }
    )
finally:
    await sandbox.stop()

The adapter does not own the sandbox lifecycle. The application that creates a sandbox must also stop it and choose the appropriate persistence or removal policy. In the example above, ephemeral=True removes sandbox state when the sandbox stops.

Both synchronous and asynchronous Deep Agents backend methods are available. Async calls use the Microsandbox SDK directly. Sync calls use a compatibility bridge that is safe to call from a thread that already has a running asyncio event loop.

Development

Install the locked development environment:

uv sync --all-groups

Run the local checks:

make check

Integration tests start a real ephemeral microVM and require working local virtualization:

uv run msb doctor
make integration_test

Use make integration_smoke for a faster command, timeout, and file-transfer subset while iterating locally.

See CONTRIBUTING.md for the complete development and release workflow.

License

MIT

Metadata

Release files for langchain-microsandbox 0.0.2

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-microsandbox 0.0.2
File Size Uploaded
langchain_microsandbox-0.0.2.tar.gz 171.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for langchain-microsandbox 0.0.2
File Interpreter ABI Platform
langchain_microsandbox-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 180.2 kB

Release files / langchain_microsandbox-0.0.2.tar.gz

Download URL langchain_microsandbox-0.0.2.tar.gz
Size 171.6 kB
Tags Source
SHA-256 checksum
How to use checksums
1573d95cfb1b9287c828812d60b7309bfb6fffb881e664be00721c59f9a6b5af
BLAKE2b-256 checksum
How to use checksums
a2fe13c38d32760105ba9f50320def17a84c5d63ffce40a4c0345c0b2cfe4482
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 24, 2026.

Transparency log

Release files / langchain_microsandbox-0.0.2-py3-none-any.whl

Download URL langchain_microsandbox-0.0.2-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dcf3fce58aeb126059147d8ae81334c356bd61738684561830073ec796441b30
BLAKE2b-256 checksum
How to use checksums
bb3a485e0988f1af17168d025dd27fc11a70287b4a9c1e2fb1896c70a44840d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 24, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

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