Browser CLI for agents and terminals
Browser CLI for agents and terminals.
Install and authorize
The CLI is a Python tool; use Python 3.11 or later and uv. Install from the maintained repository:
uv tool install --force git+https://github.com/lexmount/browser-cli.git
browser-cli --version
browser-cli auth login --open
browser-cli auth status
browser-cli doctor --jsonRun login on a machine where your browser can reach the local callback. The browser authorization flow stores credentials locally; do not paste them into chat. Headless setups can inspect browser-cli auth login --help for supported alternatives. For an existing API Key, use the environment variables from getting started.
Create, inspect, and close
browser-cli session create --browser-mode normalCopy the returned session ID into SESSION_ID. This is an identifier, not the authenticated connection URL:
set -eu
SESSION_ID='replace-with-returned-session-id'
trap 'browser-cli session close --session-id "$SESSION_ID"' EXIT
browser-cli action open-url --session-id "$SESSION_ID" --url https://example.com --wait-until domcontentloaded
browser-cli action page-info --session-id "$SESSION_ID"
browser-cli action snapshot --session-id "$SESSION_ID" --max-chars 4000
browser-cli session close --session-id "$SESSION_ID"
trap - EXITSave the block as inspect.sh and run bash inspect.sh after replacing the session ID. Expect the page title Example Domain. The EXIT trap closes the session if an action fails; the final close handles success. If your shell or machine is forcibly terminated, inspect the console for abandoned sessions.
Discover without guessing
Use browser-cli action --help and browser-cli action <command> --help for installed-version flags. browser-cli commands --names-only lists command paths. An agent can inspect, act, and inspect again rather than assuming a click succeeded. A snapshot is an observation, not proof of a completed transaction.
Keep CLI/runtime versions with bug reports. Do not use --reveal-connect-url in shared logs. CLI availability does not imply a website grants access or that every action is supported by every browser mode.
