Microsandbox runtime¶
The microsandbox runtime runs a tool in a microsandbox (msb) microVM with its own kernel, instead of a container on the host's kernel. Use it when you want a kernel exploit inside the sandbox not to reach your machine. Images are still built with Docker and copied into msb.
Requirements¶
- Docker, to build the images.
- msb 0.7.12 or newer on your
PATH. - Hardware virtualization: KVM on Linux, Hypervisor.framework on macOS.
- On WSL 2 (Windows 11), nested virtualization:
-
Add this to
%UserProfile%\.wslconfig:[wsl2] nestedVirtualization=true -
Restart WSL:
wsl --shutdown. - Check that
/dev/kvmexists inside WSL.
Usage¶
agentic run --runtime microsandbox claude
Or per project, overridden for one run with --runtime docker:
[run]
runtime = "microsandbox"
The first run of an image copies it into msb, which takes a while. Later runs reuse the copy until the image is rebuilt. agentic clean removes the copies too.
What's different from Docker¶
- Filesystem: the VM's root is writable but discarded on exit. The workspace, tool home and
--volumemounts work as with Docker. - Network: without the proxy, the VM can't reach your LAN or the host. The allowlist is enforced by msb unless you pick agentic-proxy, and msb injects credentials itself.
- Ports: forwarded with
--proxytoo. - Named volumes: stored as
agentic-<name>. See Volumes. - Limits:
cpus(rounded up to a whole number) andmemoryapply to the VM.pids_limitis ignored.
Docker in the VM¶
agentic run --runtime microsandbox --dind claude
--dind starts a Docker daemon inside the tool's VM. It needs no --base docker: the first such run builds <image>-dockerd, the tool image plus Docker, and uses that instead. It's rebuilt after the tool image changes and removed with it.
- Root in the VM: dockerd runs as root, so the tool can reach root in the VM. The VM stays the boundary: msb enforces the allowlist, read-only mounts and credentials from the host side.
- Storage: images, containers and volumes live on a private 20G disk, deleted when the VM exits.
- Limits: the daemon shares the VM's
cpusandmemory;[run.dind]limits are ignored. - Ports: published ports are on
localhostin the VM, not on your machine.
HTTPS in inner containers¶
With --proxy, msb inspects HTTPS with its own CA, which inner containers don't trust. Give a container the VM's CA bundle:
docker run -v /etc/ssl/certs/ca-certificates.crt:/etc/ssl/certs/ca-certificates.crt:ro <image>
For docker build steps that fetch over HTTPS:
- Copy the bundle into the build context:
cp /etc/ssl/certs/ca-certificates.crt . - Add it in the Dockerfile before those steps:
COPY ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
Limitations¶
- msb writes each run's terminal output to its
exec.log, so a secret printed to the terminal ends up on disk. - A VM escape lands in msb's process on the host, which runs as your user.
agentic prunedoesn't stop VMs. If agentic and its watchdog were both killed, find the VM withagentic ps --alland stop it withmsb stop <name>.