Skip to main content

Overview

SmolVM.browser() and SmolVM.desktop() return a sandbox object that is ready to use. Read its URLs to connect tools, use its lifecycle methods to stop it, and use browser helpers when the sandbox runs Chromium. The same object works as a context manager, so the sandbox stops when the with block exits.

URLs and identifiers

str
Stable browser or desktop sandbox ID.
str
ID of the underlying SmolVM sandbox.
str | None
Browser automation URL for Playwright or another Chrome DevTools Protocol client. Available in browser mode.
str | None
Alias for cdp_url.
str | None
Web URL you can open in your own browser to watch or interact with the screen. Available for visible browser and desktop modes.
str | None
VNC URL for desktop viewers and computer-use agents. VNC means Virtual Network Computing, a standard way to view and control a remote screen. Available for visible browser and desktop modes.
Path | None
Local folder where collected logs, downloads, recordings, and other session artifacts are stored.
str
Current lifecycle state for the sandbox, such as created, starting, ready, stopping, or error.

Lifecycle methods

stop

Stops the sandbox and releases its VM resources.

delete

Alias for stop(). Use it when you want the same naming style as regular SmolVM sandboxes.

close

Releases local client resources, such as an open Playwright connection, while leaving a persistent sandbox record available for reconnect.

open_viewer

Opens viewer_url in your default browser and returns whether the local browser accepted the request.

Browser helpers

These helpers are available when the object came from SmolVM.browser().

connect_playwright

Connects Playwright to the running Chromium browser over cdp_url.
Install Playwright locally before calling this method: pip install playwright.

screenshot

Captures the current browser page and saves a PNG on your machine.
str | Path
required
Local file path for the screenshot.
bool
default:"True"
Capture the full page when possible.

push_file

Copies a file from your machine into the sandbox.

pull_file

Copies a file from the sandbox to your machine.

collect_artifacts

Collects guest logs, downloads, and recordings into artifacts_dir. Returns the archive path when artifacts are available.

logs

Returns recent host and guest logs for the sandbox.

Example

display_sandbox.py
Last modified on June 12, 2026