Skip to main content

Secure runtime for AI agents, and tools -- free and open-source from Celesto AI 🧡

Project description

SmolVM

Disposable sandboxes for AI agents

CodeQL Run Tests License Python 3.10+

DocsExamplesSlack


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.

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

  1. Install the package.
pip install smolvm
  1. Run the one-time setup for your machine.
smolvm setup

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

  1. Check that the runtime is ready.
smolvm doctor

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.

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

smolvm-0.0.7.tar.gz (212.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

smolvm-0.0.7-py3-none-any.whl (154.5 kB view details)

Uploaded Python 3

File details

Details for the file smolvm-0.0.7.tar.gz.

File metadata

  • Download URL: smolvm-0.0.7.tar.gz
  • Upload date:
  • Size: 212.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for smolvm-0.0.7.tar.gz
Algorithm Hash digest
SHA256 f9cdf1c5b21642ddbbfbcc2700a8fee935d68116eae9b8bbd36a7c0060e8f700
MD5 27d49b74d312aa0841d345113e1ace90
BLAKE2b-256 80b69af2d0e1ebd41100b93d0eb25a4181de7ed85afe238bb4bf0867a3c6a989

See more details on using hashes here.

Provenance

The following attestation bundles were made for smolvm-0.0.7.tar.gz:

Publisher: publish.yml on CelestoAI/SmolVM

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file smolvm-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: smolvm-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 154.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for smolvm-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 8cf89b8b480de340f62102640b81bfb97a6bf044ca1dde9b2cf4808738d0a268
MD5 4e5a1c4e2ba2021224ddcc0ee9fe3eb1
BLAKE2b-256 6ff1591a78e6141a81945b11bd298fb118e6c8b9bcd7a598f5d29677a90721d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for smolvm-0.0.7-py3-none-any.whl:

Publisher: publish.yml on CelestoAI/SmolVM

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page