microsoft/quicksand
Sobre
Quickly sandbox your AI agent.
IA e aprendizado de máquinaCrescimento medido de estrelas
- em 24 h
- +1
- em 7 dias
- +7
- em 15 dias
- +14
- em 1 mês
- Coletando histórico
Variações líquidas em períodos sobrepostos, não totais diários. Medições ausentes ficam em branco. Estrelas indicam interesse, não qualidade.
README.md
OriginalQuicksand

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 required. Control execution, network isolation, host file mounts, and snapshot/restore through a clean async Python API.
🤝 Notable Projects
- external-sandbox: Tools for running coding agents against external sandboxes.
- MagenticLite: An experimental agent that works across the browser and local file system.
🚀 Recent Releases
- 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.
Installation
Install directly from PyPI to boot any OCI or Docker container image in a real VM. Bundled QEMU and quicksand-kernel are included by default (no Docker daemon and no root required):
pip install quick-sandbox
Or include a pre-built offline base image (alpine ~8 MB or ubuntu ~48 MB):
pip install 'quick-sandbox[alpine]'
You can also add extra images with the CLI:
quicksand install alpine # or: quicksand install ubuntu
Prefer your own system QEMU instead of the bundled binary? Install quicksand-core and quicksand-kernel directly:
pip install quicksand-core quicksand-kernel
Usage
Boot any container image without Docker or root
Boot any container image from Docker Hub, GHCR, or any OCI registry:
import asyncio
from quicksand import Sandbox
async def main():
async with Sandbox(image="docker://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 docker://alpine:3.23
Distroless and scratch images without /bin/sh work too by passing an argument list to execute():
async with Sandbox(image="docker://gcr.io/distroless/python3-debian12") as sb:
result = await sb.execute(["/usr/bin/python3", "-c", "print('hi')"])
print(result.stdout)
See the Docker & OCI Images guide for custom Dockerfiles, .qsi image export, and registry auth.
Pre-built images & running commands
Pre-built images (alpine, ubuntu, and more) work completely offline once installed:
async with Sandbox(image="ubuntu", network_mode=NetworkMode.FULL) as sb:
result = await sb.execute("apt-get update && apt-get install -y python3")
print(result.stdout, result.exit_code)
Mount host directories
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)
Configure networking
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:
...
Multiple Linux users
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 and load
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__)'")
Checkpoint and revert
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 checkpoint
Control a desktop
Desktop images provide a full Xfce4 graphical environment with a browser. Install one with quicksand install ubuntu-desktop or quicksand install alpine-desktop.
async with Sandbox(image="ubuntu-desktop", enable_display=True) 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")
Configuration
Here are the main Sandbox configuration options:
Sandbox(
# docker:// OCI ref, .qsi path, local/packaged image name, or save name
image="docker://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",
)
Available images
In addition to pulling any container image from an OCI registry (or building from a local Dockerfile), Quicksand ships pre-built standalone pristine rootfs packages that all share the ~15 MB quicksand-kernel package at boot:
| Image | Install command | Approx. wheel size | What is it |
|---|---|---|---|
alpine |
quicksand install alpine |
~8 MB (PyPI) | Alpine 3.23 headless (fastest boot) |
ubuntu |
quicksand install ubuntu |
~48 MB (PyPI) | Ubuntu 24.04 headless |
alpine-desktop |
quicksand install alpine-desktop |
~340 MB | Alpine 3.23 + Xfce4 + Chromium |
ubuntu-desktop |
quicksand install ubuntu-desktop |
~320 MB | Ubuntu 24.04 + Xfce4 + Firefox ESR |
quicksand-agent |
quicksand install agent |
~330 MB | Ubuntu 24.04 + Python 3.12, uv, build-essential, requests, pyyaml, ddgs, markitdown |
quicksand-cua |
quicksand install cua |
~770 MB | Ubuntu 24.04 + Python 3.12, Xvfb, x11vnc, noVNC, Playwright, Chromium |
quicksand-alpine, quicksand-ubuntu, and quicksand-kernel are well under PyPI's 100 MB wheel limit and install directly from PyPI. Larger desktop, agent, and CUA wheels (>100 MB) are hosted on GitHub Releases and downloaded automatically via quicksand install or on first use.
Building from source
git clone https://github.com/microsoft/quicksand.git
cd quicksand
uv sync
uv run uvr build --all-packages
Documentation
| Topic | Guide | Under the Hood |
|---|---|---|
| Installation | Installing packages | QEMU binaries, kernels, qcow2 disks |
| Docker & OCI Images | Container images, custom Dockerfiles, export | 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 |
Contributing
| 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
Explore projetos relacionados
Carregando…