SmolVM
Run code, start a browser, and give AI agents an isolated workspace. SmolVM is a Python SDK and CLI that lets you spin up a disposable sandbox in under a second. Use it whenever your app or AI agent needs a safe place to run shell commands, open a browser, or execute untrusted code — without touching your host machine.What you can do
Run code safely
Execute untrusted code in a clean sandbox instead of on your host machine
Start a browser
Launch a real browser session you can automate or watch live
Power your agents
Plug SmolVM into agent frameworks for shell, browser, and computer-use workflows
Quick example
with block handles the full lifecycle — it creates the sandbox on entry and tears it down on exit.
Use cases
| What you want to do | Where to start |
|---|---|
| Run code in a clean sandbox | Quickstart |
| Build an agent with a sandboxed shell (Agentor) | Agentor integration |
| Start a disposable browser session | Browser sessions |
| Let a model click and type on websites | Computer-use with OpenAI |
| Let an agent drive a browser via CLI | PydanticAI with agent-browser |
| Give an agent a shell tool | AI agent integration |
| Keep one sandbox across turns | Reusable sandbox |
| Pass env vars into the guest | Environment variables |
SDK or CLI?
Use the SDK when SmolVM is part of your application or agent loop and you want to create sandboxes from Python code. Use the CLI when you want to inspect the runtime, start a browser from the terminal, or script local workflows:Start a browser from the CLI
You can launch an isolated browser session directly from the terminal. This is useful for quick testing, scripting, or handing the CDP endpoint to an external tool.session_id plus local browser URLs. Use the session ID to manage the session:
cdp_url in the response can be passed to any CDP client. For example, the PydanticAI agent-browser integration extracts the localhost port from that URL and hands it to agent-browser --cdp.
To open the live browser view in your default browser:
How isolation works
SmolVM runs your work inside a separate guest system instead of on your host. On Linux it uses Firecracker microVMs — very small virtual machines backed by KVM. On macOS it uses QEMU. You get a simple Python API and CLI, but every command executes in its own environment. Unlike containers that share the host kernel, microVMs provide hardware-level isolation. An escape would require a hypervisor exploit, not just a kernel vulnerability.Performance
Typical lifecycle timings (p50) on a standard Linux host:| Phase | Time |
|---|---|
| Create + Start | ~572ms |
| SSH ready | ~2.1s |
| Command execution | ~43ms |
| Stop + Delete | ~751ms |
| Full lifecycle (boot, run, teardown) | ~3.5s |
Measured on AMD Ryzen 7 7800X3D (8C/16T), Ubuntu Linux, KVM/Firecracker backend.
Get started
Quickstart
Set up SmolVM and run your first sandbox in minutes
Installation
Detailed installation instructions for Linux and macOS
AI agent integration
Plug SmolVM into PydanticAI, OpenAI Agents, LangChain, and more
API reference
Explore the complete API documentation