โจ Features
- ๐ Secure Isolation: Hardware-level virtualization (utilizing Firecracker) for strong sandbox boundaries.
- โก Blazing Fast: MicroVMs boot in sub-second time with minimal overhead.
- ๐ Python Native: Clean, high-level SDK for managing VM lifecycles and command execution.
- ๐ Automatic Networking: Built-in NAT, port forwarding, and SSH tunneling.
- ๐ ๏ธ Custom Images: Build specialized Debian-based rootfs images with your own tools.
- ๐งน Auto-Cleanup: Integrated resource management to keep your host system clean.
๐ค Why SmolVM?
AI agents often need to execute arbitrary code (Python, JS, shell scripts) generated by LLMs. Running this code directly on your host or in standard containers can be risky.- MicroVM-based Security: Unlike containers that share the host kernel, SmolVM uses KVM-backed microVMs. This provides a significantly smaller attack surface and stronger hardware-level isolation.
- Agent-First Design: SmolVM abstracts away the complexity of microVM networking, storage, and TAP devices into a simple, pythonic API.
๐ Quickstart
Prerequisites
- Linux + Firecracker backend: KVM support (Ubuntu/Debian/Fedora).
- macOS + QEMU backend: Homebrew and QEMU (
qemu-system-*).
Installation
Linux
MacOS
Basic Usage
Initialize a VM with no arguments for an auto-configured, SSH-ready environment:Port Forwarding
Expose a guest application to your local machine securely.expose_local prefers host-local iptables forwarding and automatically falls back to an SSH tunnel when needed.
Environment Variables
Inject environment variables into a running VM. Variables are persisted in/etc/profile.d/smolvm_env.sh and apply to new SSH/login shell sessions.
Reconnect to an existing VM
You can also reconnect to a running VM by its ID:Disk isolation defaults
SmolVM now defaults to isolated per-VM disks (disk_mode="isolated"), so each VM gets its own writable rootfs clone (sandbox-by-default).
If you intentionally want shared/persistent image behavior across VMs, set: