Skip to content
microsandbox 0.8.3

microsandbox 0.8.3

Pypi •[email protected] • November 26, 2026

Lightweight VM sandboxes for Python applications that need hardware-level isolation for AI agents, tools, tests, and untrusted code.

The microsandbox Python package provides async Python bindings to the microsandbox runtime. It creates microVM-backed sandboxes from OCI images or other rootfs sources, then exposes command execution, guest filesystem access, networking, secrets, volumes, metrics, logs, snapshots, and SSH/SFTP through Python-friendly classes and dataclasses.

For the full API reference and longer guides, use the docs site:

A complete runtime in the configured ( MSB_HOME , or ~/.microsandbox by default) takes precedence over wheel binaries. Explicit binary paths still win. A partial installation errors instead of falling back to the wheel. This also applies to the packaged CLI entry points.

Hardware VM isolation with a guest Linux kernel

Async sandbox lifecycle, execution, filesystem, metrics, and logs APIs

OCI image, bind-rootfs, disk-image, and snapshot-based sandboxes

Named volumes, bind mounts, tmpfs mounts, and disk-image mounts

Network policies, DNS filtering, TLS interception, secrets, and port publishing

Rootfs patches before boot

Detached sandboxes that can outlive the Python process

Typed Python surface with StrEnum s, frozen dataclasses, event objects, .pyi stubs, and py.typed

Linux with KVM, macOS with Apple Silicon, or Windows 11 with WHP enabled

Windows support is currently preview; see the Windows troubleshooting guide for WHP and runtime setup notes.

Python wheels bundle the matching msb runtime and libkrunfw library. Source checkouts and unreleased local builds can override runtime paths with MSB_PATH , MSB_LIBKRUNFW_PATH , or microsandbox.set_libkrunfw_path(...) .

async with awaits graceful shutdown of its owned local run. It preserves persisted state except for configured ephemeral cleanup and leaves detached, independently connected, and remote runs alone. Cleanup errors are raised; a body exception remains available as their cause. detach() relinquishes automatic shutdown while keeping the object usable.

At normal interpreter exit, the SDK stops its native async runtime and waits for native blocking work already in progress before Python finalizes. Await operations and close sandbox contexts explicitly when you need their results or cleanup to complete; process exit is not a substitute for sandbox lifecycle management.

Image imports from stdin and SSH stdio connections require exclusive use of their process input/output streams. Cancelling these operations releases the streams, including when a pipe remains open without input. On Unix, the SDK temporarily enables nonblocking I/O and restores the original blocking mode when the operation ends.

Reusable Lifecycle Convergence

Use connect_or_create when a stable name should converge on one persisted sandbox. Existing configuration wins; creation arguments are used only if creation is necessary. Handles retain a stable id , so lifecycle calls on stale receivers refuse to act on a replacement that reused the name.

These snippets assume you already have a live sandbox: Sandbox .

Forking copies a running or paused local sandbox's disk and execution state into an independent child. Memory uses copy-on-write automatically. The source keeps its running or paused state. Host resources require explicit bindings; see forking and resource bindings .

Use await sandbox.fork_many(["alice", "bob"]) to capture once for several children. Inspect every returned outcome: one child's startup failure does not remove successful siblings. See the fork API reference .

Restoring starts from a saved snapshot instead. Use cow_memory=True to request copy-on-write memory for a full-snapshot restore. A generation describes snapshot-history progression; a branch describes a distinct path through that history. The former live branch APIs and old CoW restore names remain deprecated aliases. See restore migration notes for the old-to-new names and language-specific deprecation notices.

Filesystem Operations

Network, DNS, and Ports

Secrets use placeholder substitution. The real value stays on the host and is substituted only for allowed network destinations.

Storage Usage and Runtime Cache Cleanup

Storage.usage() reports the selected local backend's aggregate storage. Sandbox and snapshot handles also provide storage_usage() for their managed files. Reports contain raw integer byte counts; None means unknown. Logical sizes and allocated-block observations do not measure exclusive physical ownership on filesystems that copy-on-write blocks.

Pruning preserves durable snapshots, sandbox disks, named volumes, and stable lock files. Pending handoffs, live or paused VMs, and retained baselines protect their RAM. The report lists skipped entries and per-file errors, including partial success; physical_bytes_reclaimed remains None . Remote backend storage operations raise UnsupportedError . Static storage calls retain the backend selected when called, and handle methods retain the backend that created the handle.

Python exports typed errors for the common SDK categories and falls back to MicrosandboxError for unmapped runtime variants. Catch specific errors when you need category-specific handling, and catch MicrosandboxError as the broad SDK base class.

Installed wheels bundle the runtime files. The setup helpers are useful for source checkouts, shared runtime installs, and surfacing setup failures at process startup.

From the repository root, run an example against the SDK project:

Runtime integration tests require local virtualization support and runtime artifacts:

Release files for microsandbox 0.8.3

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

Built distributions (wheels)

Total release size: 266.0 MB

Release files / microsandbox-0.8.3-cp310-abi3-win_arm64.whl

Release files / microsandbox-0.8.3-cp310-abi3-win_amd64.whl

Release files / microsandbox-0.8.3-cp310-abi3-manylinux_2_28_x86_64.whl

Release files / microsandbox-0.8.3-cp310-abi3-manylinux_2_28_aarch64.whl

Release files / microsandbox-0.8.3-cp310-abi3-macosx_14_0_arm64.whl

Security for microsandbox 0.8.3

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.

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

Nov 26, 2026 5 release files No provenance

Nov 24, 2026 5 release files No provenance

Nov 23, 2026 5 release files No provenance

Nov 18, 2026 5 release files No provenance

Nov 12, 2026 5 release files No provenance

Nov 8, 2026 5 release files No provenance

Nov 1, 2026 5 release files No provenance

Oct 31, 2026 5 release files No provenance

Oct 24, 2026 5 release files No provenance

Oct 23, 2026 5 release files No provenance

Oct 22, 2026 5 release files No provenance

Oct 9, 2026 5 release files No provenance

Oct 5, 2026 5 release files No provenance

Oct 1, 2026 5 release files No provenance

Sep 30, 2026 5 release files No provenance

Sep 25, 2026 5 release files No provenance

Sep 24, 2026 5 release files No provenance

Sep 17, 2026 5 release files No provenance

Sep 17, 2026 5 release files No provenance

Sep 16, 2026 5 release files No provenance

Sep 9, 2026 5 release files No provenance

Sep 4, 2026 5 release files No provenance

Aug 29, 2026 5 release files No provenance

Aug 24, 2026 5 release files No provenance

Aug 22, 2026 5 release files No provenance

Aug 21, 2026 5 release files No provenance

Aug 19, 2026 5 release files No provenance

Aug 19, 2026 5 release files No provenance

Aug 18, 2026 5 release files No provenance

Aug 15, 2026 5 release files No provenance

Jul 29, 2026 5 release files No provenance

Jul 25, 2026 5 release files No provenance

Jul 7, 2026 5 release files No provenance

Jul 7, 2026 5 release files No provenance

Yanked reason: missing migrations for proper downgrade

Jul 5, 2026 5 release files No provenance

Jul 4, 2026 5 release files No provenance

Jul 1, 2026 5 release files No provenance

Jun 28, 2026 5 release files No provenance

Jun 27, 2026 5 release files No provenance

Jun 24, 2026 3 release files No provenance

Jun 22, 2026 3 release files No provenance

Jun 14, 2026 3 release files No provenance

Jun 10, 2026 3 release files No provenance

Jun 5, 2026 3 release files No provenance

Jun 1, 2026 3 release files No provenance

May 30, 2026 3 release files No provenance

May 28, 2026 3 release files No provenance

May 27, 2026 3 release files No provenance

May 27, 2026 3 release files No provenance

May 13, 2026 3 release files No provenance

May 7, 2026 3 release files No provenance

May 3, 2026 3 release files No provenance

Apr 30, 2026 3 release files No provenance

Apr 29, 2026 3 release files No provenance

Apr 29, 2026 3 release files No provenance

Apr 28, 2026 3 release files No provenance

Apr 18, 2026 3 release files No provenance

Apr 15, 2026 3 release files No provenance

May 22, 2025 2 release files No provenance

May 22, 2025 2 release files No provenance

May 21, 2025 2 release files No provenance

May 20, 2025 2 release files No provenance

May 20, 2025 2 release files No provenance

May 20, 2025 2 release files No provenance

May 20, 2025 2 release files No provenance

Apr 2, 2025 2 release files No provenance

Extracted Entities

Platforms (3)

Tools (1)