Quicksand gives AI agents hardware-isolated Linux VMs with zero system dependencies. Install from PyPI on macOS, Windows, or Linux and boot any Docker or OCI container image with no Docker daemon or root privileges required. Control execution, network isolation, host file mounts, and snapshot/restore through a clean async Python API.
- external-sandbox: Tools for running coding agents against external sandboxes.
- MagenticLite: An experimental agent that works across the browser and local file system.
- quick-sandbox v0.14.0 / quicksand-core v0.15.0 / quicksand-kernel v0.1.0 (2026-12-03)
- 📦 Dockerless OCI images: Pull and boot container images directly from Docker Hub, GHCR, or any OCI registry via
Sandbox(image="docker://..."), without Docker even installed. - 🪶 Smaller, unified images: All shipped images now share
quicksand-kernel, shrinking Alpine to ~8 MB and Ubuntu to ~48 MB (now published directly on PyPI).
- 📦 Dockerless OCI images: Pull and boot container images directly from Docker Hub, GHCR, or any OCI registry via
- quick-sandbox v0.13.0 / quicksand-core v0.14.0 (2026-10-14)
- 🔁 Bidirectional port forwarding:
Forward(Guest(...), Host(...))lets guests reach services on the host, such as proxies, databases, and APIs.
- 🔁 Bidirectional port forwarding:
- quick-sandbox v0.12.0 / quicksand-core v0.13.0 (2026-09-14)
- 👥 Guest OS users:
create_user()andexecute(user=...)run commands as separate accounts with their own home directories. - 📥 Streaming stdin:
execute(stdin=...)streams input to commands while output streams back.
- 👥 Guest OS users:
See the changelog for details.
Install directly from PyPI to boot any OCI or Docker container image in a real VM. Bundled QEMU and the shared guest kernel are included by default (no Docker daemon and no root privileges required):
pip install quick-sandboxOr include any of Quicksand's pre-built sandbox packages (alpine, ubuntu, alpine-desktop, ubuntu-desktop, agent, cua, or all):
pip install 'quick-sandbox[alpine]' # AlpineSandbox (bundled wheel, ~8 MB)
pip install 'quick-sandbox[ubuntu]' # UbuntuSandbox (bundled wheel, ~48 MB)
pip install 'quick-sandbox[ubuntu-desktop]' # UbuntuDesktopSandbox (GHCR OCI-backed)
pip install 'quick-sandbox[agent]' # AgentSandbox (GHCR OCI-backed)Prefer to pre-cache an OCI or PyPI image without installing extras into your Python environment? Use quicksand pull:
quicksand pull python:3.12-slim
quicksand pull pypi://quicksand-alpinePrefer your own system QEMU instead of the bundled binary? Install quicksand-core and quicksand-kernel directly:
pip install quicksand-core quicksand-kernelBoot any container image from Docker Hub, GHCR, or any OCI registry:
import asyncio
from quicksand import Sandbox
async def main():
async with Sandbox(image="python:3.12-slim") as sb:
result = await sb.execute("python3 --version")
print(result.stdout)
asyncio.run(main())Or open an interactive shell from the terminal:
quicksand run alpine:3.23Distroless and scratch images without /bin/sh work too by passing an argument list to execute():
async with Sandbox(image="gcr.io/distroless/python3-debian12") as sb:
result = await sb.execute(["/usr/bin/python3", "-c", "print('hi')"])
print(result.stdout)Or boot a pre-built image package straight from PyPI:
async with Sandbox(image="pypi://quicksand-alpine") as sb:
result = await sb.execute("cat /etc/os-release")See the Docker & OCI Images guide for custom Dockerfiles, registry auth, and PyPI image packages.
Every pre-built environment ships as a Sandbox subclass (AlpineSandbox, UbuntuSandbox, AlpineDesktopSandbox, UbuntuDesktopSandbox, AgentSandbox, CuaSandbox) — see all pre-built packages:
from quicksand import UbuntuSandbox, NetworkMode
async with UbuntuSandbox(network_mode=NetworkMode.FULL) as sb:
result = await sb.execute("apt-get update && apt-get install -y python3")
print(result.stdout, result.exit_code)Share host directories into the VM at boot or on the fly.
# At boot
async with Sandbox(
image="ubuntu",
mounts=[Mount("./workspace", "/mnt/workspace")],
) as sb:
...
# Or dynamically on a running sandbox
handle = await sb.mount("/tmp/data", "/mnt/data")
await sb.execute("ls /mnt/data")
await sb.unmount(handle)Sandboxes are network-isolated by default. Opt in to internet access with NetworkMode.FULL. Port forwards work in either direction: Forward(Host(...), Guest(...)) exposes a guest port on the host, and Forward(Guest(...), Host(...)) exposes a host service inside the guest, even when the sandbox is otherwise offline.
async with Sandbox(
image="ubuntu",
network_mode=NetworkMode.FULL,
port_forwards=[
Forward(Host(8080), Guest(80)), # host:8080 -> guest:80
Forward(Guest(3128), Host(8080)), # guest 10.0.2.101:3128 -> host:8080
],
) as sb:
...Give multiple agents independent Linux user accounts in a single sandbox VM.
async with Sandbox(image="ubuntu") as sb:
alice = await sb.create_user("alice")
bob = await sb.create_user("bob")
await alice.execute("cat > hello.txt", stdin="Hello from Alice!\n")
await bob.execute("cat > hello.txt", stdin="Hello from Bob!\n")
for user in (alice, bob):
result = await user.execute("whoami && pwd && cat hello.txt")
print(result.stdout)
await sb.delete_user(user.name)Save the VM's disk state to a directory. Load it later, even on a different machine.
await sb.execute("pip install numpy pandas")
await sb.save("my-env") # VM keeps running
# Load later
async with Sandbox(image="my-env") as sb:
await sb.execute("python3 -c 'import numpy; print(numpy.__version__)'")Capture the full VM state and roll back if something goes wrong.
await sb.checkpoint("before-experiment")
await sb.execute("apt install -y something-risky")
await sb.revert("before-experiment") # the VM snaps back to the checkpointDesktop packages provide a full Xfce4 graphical environment with a browser:
from quicksand import UbuntuDesktopSandbox, Key
async with UbuntuDesktopSandbox() as sb:
await sb.screenshot("screen.png")
await sb.type_text("hello world")
await sb.press_key(Key.RET)
await sb.mouse_move(500, 300)
await sb.mouse_click("left")Or pass the GHCR image directly to Sandbox(image="ghcr.io/microsoft/quicksand/ubuntu-desktop", enable_display=True).
Here are the main Sandbox configuration options:
Sandbox(
# OCI ref, pypi:// package, local image, or save name
image="python:3.12-slim",
# Guest RAM (default: "512M")
memory="2G",
# Virtual CPU cores (default: 1)
cpus=4,
# Host directories shared into the VM at boot
mounts=[Mount("/host", "/guest")],
# NONE, MOUNTS_ONLY (default), or FULL internet access
network_mode=NetworkMode.FULL,
# Forward TCP ports in either direction (host -> guest, guest -> host)
port_forwards=[Forward(Host(8080), Guest(80)), Forward(Guest(3128), Host(8080))],
# Expand the guest filesystem on boot
disk_size="10G",
# Attach virtual GPU, keyboard, and mouse for screenshot/type_text/mouse control
enable_display=True,
# Auto-save VM state on stop
save="my-save-name",
)In addition to booting any OCI container image directly with Sandbox(image=...), Quicksand ships six first-class sandbox packages on PyPI. Each exports a pre-configured Sandbox subclass:
| Package / extra | Sandbox class | Backing image | What is it |
|---|---|---|---|
quick-sandbox[alpine] |
AlpineSandbox |
Bundled in wheel (~8 MB) | Alpine 3.23 headless (fastest boot, offline) |
quick-sandbox[ubuntu] |
UbuntuSandbox |
Bundled in wheel (~48 MB) | Ubuntu 24.04 headless (offline) |
quick-sandbox[alpine-desktop] |
AlpineDesktopSandbox |
ghcr.io/microsoft/quicksand/alpine-desktop |
Alpine 3.23 + Xfce4 + Chromium |
quick-sandbox[ubuntu-desktop] |
UbuntuDesktopSandbox |
ghcr.io/microsoft/quicksand/ubuntu-desktop |
Ubuntu 24.04 + Xfce4 + Firefox ESR |
quick-sandbox[agent] |
AgentSandbox |
ghcr.io/microsoft/quicksand/agent |
Ubuntu 24.04 + Python 3.12, uv, build-essential, requests, pyyaml, ddgs, markitdown |
quick-sandbox[cua] |
CuaSandbox |
ghcr.io/microsoft/quicksand/cua |
Ubuntu 24.04 + Python 3.12, Xvfb, x11vnc, noVNC, Playwright, Chromium |
All images share the ~15 MB quicksand-kernel package at boot. quicksand-alpine and quicksand-ubuntu fit under PyPI's 100 MB wheel limit and bundle their disk images directly in the wheel for offline first boot; the four larger packages are tiny pure-Python wrappers pinned to their matching multi-arch GHCR OCI image tag (which you can also boot directly via Sandbox(image="ghcr.io/microsoft/quicksand/<name>")).
git clone https://github.com/microsoft/quicksand.git
cd quicksand
uv sync
uv run uvr build --all-packages| Topic | Guide | Under the Hood |
|---|---|---|
| Installation | Installing packages | QEMU binaries, kernels, qcow2 disks |
| Docker & OCI Images | Container images, custom Dockerfiles, registry auth | OCI pull, ext4 builder VM, image caching |
| Sandbox Lifecycle | Creating and configuring sandboxes | -m, -smp, -accel, machine types |
| Running Commands | execute(), streaming, exit codes |
Kernel boot, agent tokens, hostfwd |
| File Exchange | Mounts, hot-mounts, getting data in/out | CIFS via guestfwd, 9p via -fsdev |
| Save and Rollback | Checkpoints, reverts, persistent saves | qcow2 overlays, savevm, blockdev-snapshot-sync |
| Desktop Control | Screenshots, keyboard, mouse | VNC, GPU, USB tablet, QMP input injection |
| Network and Isolation | Network modes, port forwarding | SLIRP NAT, restrict=on, guestfwd |
| Performance | What makes it fast | io_uring, IOThreads, TCG vs KVM |
| Guide | When to use |
|---|---|
| Creating Images | Build a new image package |
| Extending the Sandbox | Add a method, OS, architecture, or QEMU flag |
| Testing | Run or write tests |
| Releasing | Cut a release |
Full guides: User Guide | Under the Hood | Contributor Guide
