Skip to main content

CLI

browsr is the remote-first command-line client for Browsr.

By default it connects to the Browsr API using your environment configuration. Use --local only when you explicitly want to launch a local browser instead of talking to the remote API.

Setup

export BROWSR_BASE_URL="https://api.browsr.dev"
export BROWSR_API_KEY="bak_..."

For bearer-token auth:

export BROWSR_BEARER_TOKEN="jwt_or_short_lived_token"

Execution model

Default behavior:

  • browsr navigate ... talks to the remote API
  • browsr exec ... talks to the remote API
  • browsr shell ... talks to the remote API

Local mode:

browsr --local exec '[{"command":"navigate_to","data":{"url":"https://example.com"}}]'

Common commands

browsr navigate https://example.com --session-id SESSION_ID

This sends a navigation command only. It does not automatically observe or screenshot.

Execute browser commands

browsr exec --session-id SESSION_ID \
'[{"command":"navigate_to","data":{"url":"https://example.com"}},{"command":"get_title"}]'

Observe session state

browsr observe --session-id SESSION_ID

Without screenshots:

browsr observe --session-id SESSION_ID --no-image

Raw CDP on relay sessions

browsr cdp --session-id RELAY_SESSION_ID Runtime.evaluate \
--params '{"expression":"1+1","returnByValue":true}'

Relay events

browsr sessions --relay
browsr relay-events --session-id RELAY_SESSION_ID --limit 20
browsr relay-events --session-id RELAY_SESSION_ID --clear

Scrape

browsr scrape https://example.com

Crawl

browsr crawl https://example.com --limit 20 --max-depth 2
browsr search "browsr relay debugging" --limit 5

Shell commands

Create a shell session:

browsr shell create --language python --timeout-secs 300

List shell sessions:

browsr shell sessions

Execute a command:

browsr shell exec --session-id SHELL_SESSION_ID 'python3 -c "print(1+1)"'

Stop a shell session:

browsr shell stop --session-id SHELL_SESSION_ID

Agent command

browsr run streams a task through the Browsr agent flow:

browsr run "Open the docs homepage and summarize the navigation sections"

What the CLI covers

The CLI is a thin client over the main API surface:

  • Browser sessions and command execution
  • Observation and browser-step style debugging
  • Relay CDP and relay events
  • Scrape, crawl, and search
  • Shell session lifecycle and shell execution

Use the CLI when you want quick terminal access to the remote API without writing code.