Overview
SmolVM can start a browser or a full desktop inside a disposable sandbox. You can give an agent a connection address for automation, open a web viewer to watch the screen, or connect a desktop-control tool. UseSmolVM.browser() when your agent needs Chromium for web tasks. Use SmolVM.desktop() when your agent needs the whole desktop environment, such as a window manager, visible apps, or a VNC-compatible computer-use driver. VNC means Virtual Network Computing, a standard way for tools to view and control a remote screen.
Import
Choose a mode
| Factory | Best for | URLs returned |
|---|---|---|
SmolVM.browser(headless=True) | Browser automation with Playwright or another automation client | cdp_url |
SmolVM.browser(headless=False) | Browser automation plus a visible screen | cdp_url, viewer_url, display_url |
SmolVM.desktop() | Full desktop computer-use agents | viewer_url, display_url |
Start a headless browser
Headless browser mode gives automation tools a Chromium connection address. It is the smallest browser mode because it does not start the live screen viewer.browser_headless.py
Local browser automation URL for Playwright or another browser automation client.
Start a visible browser
Visible browser mode gives you both automation and a live screen. Use it when you want an agent to drive Chromium while a person can watch what happens.browser_visible.py
Web URL you can open in your own browser to watch or interact with the sandbox screen.
VNC URL for desktop viewers and computer-use agents that need direct screen control.
Start a full desktop
Desktop mode starts the full display environment instead of only Chromium. Use it for agents that need desktop apps, window focus, or a VNC-compatible driver such as a computer-use agent driver.desktop.py
Desktop sandboxes focus on screen access. They return
None for cdp_url; use SmolVM.browser() when you need a browser automation address.Class methods
SmolVM.browser
Use
True for browser automation only. Use False to also start the visible viewer and VNC display endpoint.Existing browser sandbox ID to reconnect to. Omit it to create a new sandbox.
Runtime backend. Options are
"firecracker", "qemu", "libkrun", and "auto".Browser profile name. Reuse a profile ID to keep browser state such as cookies and local storage across persistent sessions.
Keep the sandbox record after the current Python process exits. Use this when another script needs to reconnect later with
session_id.Maximum session lifetime in minutes.
Browser or desktop screen size. You can pass
BrowserViewport(width=1440, height=900) or {"width": 1440, "height": 900}.Screen width in pixels when
viewport is omitted.Screen height in pixels when
viewport is omitted.Record the visible session. Retrieve recordings with
collect_artifacts() before the sandbox stops.Allow Chromium downloads inside the sandbox.
Environment variables to set inside the sandbox.
Folders to share with the sandbox.
Guest memory in MiB.
Root filesystem size in MiB.
Maximum seconds to wait for the sandbox, display services, and browser to become ready.
Local directory for sandbox state. Omit it to use SmolVM’s default state directory.
Local directory for runtime sockets. Omit it to use SmolVM’s default socket directory.
SSH private key path used for setup and file transfer inside the sandbox.
Callback that receives progress messages while the sandbox starts.
SmolVM.desktop
SmolVM.browser().
Use Playwright with browser mode
playwright_browser.py
Install Playwright in your local Python environment before using
connect_playwright(): pip install playwright.Related
- Browser and desktop options - Configure viewport, resources, profiles, and recording
- Display sandbox object - Read returned URLs and lifecycle state
- SmolVM - General sandbox management
- AI agent integration - Use SmolVM with agent frameworks
