Overview
BrowserSessionConfig controls how a browser session is created. Use it to set the viewport size, choose a backend, enable video recording, or allocate more memory and disk for browser-heavy workloads.
If you create a BrowserSession without a config, SmolVM uses sensible defaults that work for most use cases.
Import
Fields
Runtime backend. Options:
"firecracker", "qemu", or None (auto-detect). Firecracker is used on Linux with KVM, QEMU elsewhere.Browser engine to use. Currently
"chromium" is the only supported value.Browser launch mode. Options:
"headless" or "headed". Headed mode enables the noVNC live-view.Persistent browser profile name. When set, browser state (cookies, localStorage) persists across sessions that share the same profile name.
Browser window dimensions. Defaults to 1280x720 if omitted.
Record a video of the browser session. Recordings can be retrieved with
collect_artifacts().Allow file downloads inside the browser.
Guest memory in MiB. Browser sessions default to 1024 MiB, which is higher than a basic sandbox.
Root filesystem size in MiB.
BrowserViewport
Controls the browser window dimensions.Viewport width in pixels.
Viewport height in pixels.
Examples
Default configuration
High-resolution viewport
Video recording
Persistent browser profile
Related
- BrowserSession - Launch and control browser sessions
- BrowserSessionInfo - Runtime information for a browser session