Launch a browser session or attach to an existing Chrome DevTools Protocol endpoint.
open
Theopen command launches a browser and navigates to a URL, creating a new named session. It is the starting point for any interactive workflow: once a session is open, exec, snapshot, and pages all work against it.
When to use open
- At the start of script authoring when you need live page state to decide how the workflow should work.
- When the user needs to log in manually before automation begins (use
--headed). - Any time you need a fresh, isolated browser instance on a specific URL.
Flags
The URL to open. Passed as the first positional argument.
Run the browser in headed (visible) mode. This is the default when neither
flag is passed.
Run the browser in headless mode. Useful for automated runs that don’t need a
visible window.
Name for this session. If omitted, Libretto generates a unique name
automatically. Use a consistent name to target the session with later
commands.
Viewport size in
WIDTHxHEIGHT format, for example 1920x1080. Falls back to
the value in .libretto/config.json, then 1366x768.Browser provider to use. One of
local, kernel, or browserbase. Defaults to local.Resolution order: --provider flag → LIBRETTO_PROVIDER env var → provider field in .libretto/config.json → "local".If a saved auth profile exists for the URL’s domain,
open automatically
loads it, injecting the saved cookies and localStorage into the new session
before navigating. You can override this by passing --auth-profile
explicitly, or skip profile loading by not having a saved profile for that
domain.Examples
Cloud browser providers
By default,open launches a local Chromium instance. You can instead run the browser in the cloud using the --provider flag (or LIBRETTO_PROVIDER env var, or provider in .libretto/config.json).
Available providers
| Provider | Value | Required environment variables |
|---|---|---|
| Local Chromium (default) | local | None |
| Kernel | kernel | KERNEL_API_KEY |
| Browserbase | browserbase | BROWSERBASE_API_KEY, BROWSERBASE_PROJECT_ID |
Configuration
You can set the provider in three ways (highest precedence first):- CLI flag:
--provider kernel(or-p kernel) - Environment variable:
LIBRETTO_PROVIDER=kernel - Config file: add
"provider": "kernel"to.libretto/config.json
local.
Examples
Cloud providers ignore
--headed / --headless and --viewport flags since
the browser runs remotely. The session is always headless from the local
machine’s perspective.connect
Theconnect command attaches to an existing Chrome DevTools Protocol (CDP) endpoint rather than launching a new browser. Use it to drive a browser that is already running, for example one started with --remote-debugging-port, an Electron application, or any other CDP-compatible target.
When to use connect
- You have an existing browser process you want to automate without restarting it.
- You are driving an Electron app exposed over CDP.
- You want to attach to a remote browser in a CI environment that has already navigated to the right state.
Flags
The CDP endpoint URL to connect to. This can be either an HTTP or WebSocket
URL and is passed as the first positional argument. Example:
http://127.0.0.1:9222.Name for this session. Recommended to set explicitly when using
connect so
you can reference it later.After connecting
Once connected, all session-scoped commands work normally against the attached browser:exec: run Playwright TypeScript codesnapshot: capture a screenshot and analyze the pagepages: list open pages
Examples
exec
Execute Playwright TypeScript against the open page.
snapshot
Capture a screenshot and analyze page state.