Skip to main content
The BAP CLI lets AI coding agents automate browsers from the shell. It defaults to installed Chrome, keeps a persistent daemon running, and supports composite actions that batch multiple steps into one command.

Installation

1

Install the CLI globally

npm i -g @browseragentprotocol/cli
Or run without installing:
npx @browseragentprotocol/cli goto https://example.com
2

Install Playwright browsers (if needed)

BAP prefers your installed Chrome. If Chrome is not available: bash npx playwright install chromium
3

Install the skill file for your AI agent

bash bap install-skill This auto-detects 13 AI agent platforms (Claude Code, Codex CLI, Gemini CLI, Cursor, GitHub Copilot, Windsurf, Roo Code, and more) and installs the SKILL.md guidance file.
4

Run the guided demo

bap demo
Walks you through navigate, observe, click, and screenshot step by step.

First Commands

# Open a page and observe interactive elements
bap goto https://example.com --observe

# Click a link by visible text
bap click text:"More information..."

# Take a screenshot
bap screenshot
The BAP server starts automatically on first use and stays running as a background daemon. Use bap close-all to stop it.

Composite Actions

The killer feature of BAP CLI is bap act — batch multiple browser steps in one command:
bap act fill:label:"Email"="user@example.com" \
        fill:label:"Password"="secret123" \
        click:role:button:"Sign in"
Step syntax: action:selector=value for fill/type, action:selector for click/check/hover.

Observation

# Interactive elements (default max 50)
bap observe

# Full accessibility tree
bap observe --full

# Form fields only
bap observe --forms

# Incremental: only changes since last observation
bap observe --diff

# Minimal response (fewer tokens)
bap observe --tier=minimal

Fused Operations

Combine navigation or actions with observation in a single server call:
# Navigate + observe in one roundtrip
bap goto https://example.com --observe

# Act + observe in one roundtrip
bap act click:text:"Next" --observe

# Act + observe with minimal response tier
bap act click:e3 --observe --tier=interactive

Structured Extraction

# Extract specific fields
bap extract --fields="title,price,rating"

# Extract a list of items
bap extract --list="product"

# Extract using a JSON schema
bap extract --schema=product.json

Sessions and Tabs

# Named sessions (persist across commands)
bap -s=research goto https://example.com
bap -s=shopping goto https://store.com

# List sessions and tabs
bap sessions
bap tabs

# Tab management
bap tab-new https://other.com
bap tab-select 2

Global Options

-s=<name>              Named session
-p, --port <N>         Server port (default: 9222)
-b, --browser <name>   chrome, chromium, firefox, webkit, edge
--headless             Headless mode for CI/background runs
--no-headless          Show browser window (default)
--profile <path>       Chrome profile directory
--no-profile           Fresh browser, no user profile
--stealth              Reduce bot detection fingerprint
--connect              Auto-attach to running Chrome via CDP
-v, --verbose          Verbose output

Output

Commands produce concise, agent-friendly stdout:
### Page
- URL: https://example.com/dashboard
- Title: Dashboard
### Snapshot
[Snapshot](.bap/snapshot-2026-02-16T19-30-42.yml)
Files are saved to .bap/ in the current directory: snapshots (.yml), screenshots (.png), extractions (.json).

Migrating from playwright-cli

BAP is a drop-in replacement. All e<N> refs from snapshots work identically:
playwright-clibap
playwright-cli open [url]bap open [url]
playwright-cli click e15bap click e15
playwright-cli fill e5 "text"bap fill e5 "text"
playwright-cli snapshotbap snapshot
playwright-cli screenshotbap screenshot
BAP adds composite actions, semantic selectors, smart observation, and structured extraction on top.