Skip to main content

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

Project description

SmolVM

Run code, start a browser, and give AI agents an isolated workspace

License Python 3.10+

DocsExamplesSlack


SmolVM is a Python SDK and CLI for running code and browser tasks inside disposable sandboxes. Use it when your app or agent needs a clean place to execute commands, open websites, or keep risky work away from your machine.

What you can do

  • Run untrusted code in a clean sandbox instead of on your host.
  • Start a real browser session that you can automate or watch live.
  • Plug SmolVM into agent tools for shell use, browser use, and computer-use workflows.

Start here

  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

Quickstart: Run a command in a sandbox

from smolvm import SmolVM

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

Run the full example:

python examples/quickstart_sandbox.py

From the CLI: Start an isolated browser

Start a disposable browser session and print the local URLs you can use for automation or live view.

smolvm browser start --live --json

The JSON response includes the session_id plus local browser URLs. Use the session ID in the next commands.

The cdp_url can also be passed to external CDP clients. examples/agent_tools/pydanticai_agent_browser.py shows a minimal flow that extracts the localhost port from that URL and hands it to agent-browser --cdp.

smolvm browser list
smolvm browser stop <session_id>

If you want to open the live browser view in your default browser:

smolvm browser open <session_id>

Other useful CLI commands:

  • smolvm create --name my-sandbox
  • smolvm ssh my-sandbox
  • smolvm env list <vm_id>
  • smolvm list
  • smolvm stop my-sandbox

Use cases

Outcome Start here
Run code in a clean sandbox examples/quickstart_sandbox.py
Start a disposable browser session examples/browser_session.py
Let a model click and type on websites examples/agent_tools/computer_use_browser.py
Let PydanticAI drive the browser through agent-browser examples/agent_tools/pydanticai_agent_browser.py
Give an agent a shell tool examples/agent_tools/openai_agents_tool.py, examples/agent_tools/langchain_tool.py, examples/agent_tools/pydanticai_tool.py
Keep one sandbox across turns examples/agent_tools/pydanticai_reusable_tool.py
Pass env vars into the guest examples/env_injection.py

Advanced example: examples/openclaw.py

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

SDK or CLI?

Use the SDK when SmolVM is part of your app or agent loop and you want to create sandboxes from Python code.

Use the CLI when you want to inspect the runtime manually, start a browser from the terminal, or script local workflows around smolvm doctor, smolvm browser, smolvm env, smolvm create, and smolvm list.

Why isolation matters

SmolVM keeps risky work off your host by running it inside a separate guest system. On Linux it uses Firecracker microVMs, which are very small virtual machines backed by KVM. On macOS it uses QEMU. You still get a simple Python SDK and CLI, but the work happens in its own environment instead of sharing your main machine directly.

Security notes

SmolVM is built for local, agent-style workflows. By default, SSH host keys are accepted on first connection to keep setup simple. Use it on trusted machines and networks, and avoid exposing guest SSH endpoints publicly without extra controls. See SECURITY.md for the full policy and scope.

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

Run the benchmark yourself:

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

Measured on AMD Ryzen 7 7800X3D (8C/16T), Ubuntu Linux, KVM/Firecracker backend.

More

📄 License

Apache 2.0 License - 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.dev0.tar.gz (194.5 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.dev0-py3-none-any.whl (139.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: smolvm-0.0.7.dev0.tar.gz
  • Upload date:
  • Size: 194.5 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.dev0.tar.gz
Algorithm Hash digest
SHA256 75a385c8fc49a5a31bddac6db5f5e1427bf3526f72af41300e9f5e586a8ba8be
MD5 efa46d389204e456402a9aed3c172b0b
BLAKE2b-256 1634285359013dc3926e102ffbce49caf4469e7462b34b45d9dd20da47e44304

See more details on using hashes here.

Provenance

The following attestation bundles were made for smolvm-0.0.7.dev0.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.dev0-py3-none-any.whl.

File metadata

  • Download URL: smolvm-0.0.7.dev0-py3-none-any.whl
  • Upload date:
  • Size: 139.6 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.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 d01b80431bf3540f8fa15f1df7751569eaa273f6c1590671b61577ac81047d7d
MD5 d8e77d324c792200b12aee07a028dc5d
BLAKE2b-256 e4e9a3227220e5e9f643066295a68cf3df0b14b1bae4e67a933ebb6bee862e8e

See more details on using hashes here.

Provenance

The following attestation bundles were made for smolvm-0.0.7.dev0-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