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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

langchain_microsandbox-0.0.2.tar.gz (171.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

langchain_microsandbox-0.0.2-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file langchain_microsandbox-0.0.2.tar.gz.

File metadata

  • Download URL: langchain_microsandbox-0.0.2.tar.gz
  • Upload date:
  • Size: 171.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for langchain_microsandbox-0.0.2.tar.gz
Algorithm Hash digest
SHA256 1573d95cfb1b9287c828812d60b7309bfb6fffb881e664be00721c59f9a6b5af
MD5 5e91c84dcc45273a06a3549da52c305a
BLAKE2b-256 a2fe13c38d32760105ba9f50320def17a84c5d63ffce40a4c0345c0b2cfe4482

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_microsandbox-0.0.2.tar.gz:

Publisher: release.yml on kenwoodjw/langchain-microsandbox

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_microsandbox-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_microsandbox-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 dcf3fce58aeb126059147d8ae81334c356bd61738684561830073ec796441b30
MD5 1358a44d873e2d64df5d8f70e9dbe539
BLAKE2b-256 bb3a485e0988f1af17168d025dd27fc11a70287b4a9c1e2fb1896c70a44840d4

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_microsandbox-0.0.2-py3-none-any.whl:

Publisher: release.yml on kenwoodjw/langchain-microsandbox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 files

0.0.1

2 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