Skip to main content
SmolVM is a lightning-fast, secure microVM runtime for AI agents and tools. This guide will get you up and running with a working sandbox in under 5 minutes.
1

Check Prerequisites

SmolVM uses hardware virtualization for strong isolation. Requirements vary by platform:
Requirements:
  • KVM support (check with ls /dev/kvm)
  • Ubuntu, Debian, or Fedora recommended
  • Root access for initial setup
Verify KVM:
If /dev/kvm doesn’t exist, enable virtualization in your BIOS/UEFI or enable nested virtualization if running in a VM.
2

Install SmolVM

Install the Python package:
Run the system setup script to install Firecracker and configure permissions:
This script will:
  • Install Firecracker and required dependencies
  • Configure KVM permissions
  • Set up networking tools (nftables, iproute2)
  • Configure sudoers for runtime operations (optional)
The --configure-runtime flag sets up scoped NOPASSWD sudo for SmolVM operations, avoiding password prompts during VM lifecycle management.
3

Run Your First Sandbox

Create a simple Python script to test SmolVM:
Run the script:
You should see:
The VM boots in under 1 second on most systems! SmolVM is optimized for AI agent workflows.
4

Try the Context Manager Pattern

For automatic cleanup, use SmolVM as a context manager:
The context manager automatically handles VM lifecycle - it starts on entry and stops/deletes on exit.
5

Customize VM Resources

Configure memory and disk size for your workload:
Default values:
  • Memory: 512 MiB
  • Disk: 512 MiB
  • Minimum disk size: 64 MiB

Next Steps

Now that you have SmolVM running, explore these topics:

Port Forwarding

Learn about port forwarding and local exposure

API Reference

Explore the complete SmolVM API

AI Agent Integration

Integrate SmolVM with AI agents and tool calling

Custom Images

Build specialized VM images with your own tools

Troubleshooting

Linux only - If you see “KVM device missing”:
  1. Check virtualization support:
    If nothing appears, enable virtualization in BIOS/UEFI.
  2. Load KVM modules:
  3. Check permissions:
  4. Add your user to kvm group:
If VM starts but SSH times out:
  1. Wait longer - First boot downloads and builds the Alpine image (30-60s)
  2. Check VM status:
  3. Increase timeout:
  4. Check networking:
If you see permission errors:
  1. Re-run system setup:
  2. Check group membership:
  3. Refresh groups without logout:
  4. Verify sudoers configuration:
If the VM starts but vm.run() fails:
  1. Verify SSH-capable image:
  2. Check boot args:
  3. Auto-config mode uses SSH by default:
  4. Manual config requires SSH boot args:
If QEMU isn’t detected:
  1. Install via Homebrew:
  2. Verify installation:
  3. Run setup script:
If Firecracker installation fails:
  1. Check internet connectivity:
  2. Manual download (Linux):
  3. Skip deps if already installed:

Verify Installation

Run the diagnostic command to check everything is configured correctly:
This will verify:
  • Backend detection (Firecracker on Linux, QEMU on macOS)
  • KVM availability (Linux only)
  • Required system tools
  • Network configuration
For CI/CD environments, use:

Performance Expectations

SmolVM is optimized for speed. Typical timings on modern hardware:
First boot takes longer (30-60s) as it downloads and builds the Alpine base image. Subsequent boots use the cached image.

What’s Next?

You’ve successfully set up SmolVM! Here are some recommended next steps:
  1. Learn the API - Explore port forwarding, environment variables, and VM persistence
  2. Build Custom Images - Create specialized images with pre-installed tools
  3. Integrate with AI Agents - Use SmolVM as a secure execution environment for LLM-generated code
  4. Optimize Performance - Learn about disk modes, memory sizing, and network configuration
Join our Slack community to get help and share your use cases!