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_smoke

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.1.tar.gz (169.3 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.1-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_microsandbox-0.0.1.tar.gz
  • Upload date:
  • Size: 169.3 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.1.tar.gz
Algorithm Hash digest
SHA256 b24a798213218037312a88c2fea3e67055cea69e2ae920e7693df4e44048dc57
MD5 6de0dda39468a9ac87cafafb53a0d9c2
BLAKE2b-256 2191ef1fa33fcb83ebc83b6225b8ac3ce62bd59bcfb008eeba15543e4ee363df

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_microsandbox-0.0.1.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.1-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_microsandbox-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 499b01cb97e84f88fb753907837d8595f1a096db2f29b3dccc6d63c6ee79df90
MD5 791a601eee938ac0e2b4b7c080f431c0
BLAKE2b-256 b91737cc739b6324799857d4a581045ea106cbe2050a24cd0c5c5ce28178b4f5

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_microsandbox-0.0.1-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

0.0.2

2 files

This release

0.0.1 This release

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