English | Português Brasileiro
browser-automation-cli
One-shot Chrome CDP automation for AI agents. BORN, EXECUTE, FINALIZE, DIE.
What is it
- Single-process browser automation CLI for AI agents
- Talks to system Chrome or Chromium through chromiumoxide CDP
- No daemon, no npm packaging, no remote telemetry
- Lifecycle is always BORN, EXECUTE, FINALIZE, DIE
- JSON envelopes on stdout for programmatic agents
- XDG config and paths via
configcommands only
The Pain
- Agent workflows need multi-step browser work without a sticky daemon
- Node and npm browser stacks add runtime weight and supply-chain surface
- Session-based tools leave orphan Chrome processes and unclear ownership
- JSON contracts often drift from real CLI flags and exit codes
- Product settings outside XDG
configmake agent prompts fragile
Why browser-automation-cli
- One process owns one Chrome lifecycle from launch to kill fallback
- Multi-step work uses
run --scriptNDJSON in the same process - Accessibility snapshot refs
@eNstay valid only inside that process --jsonenvelopes are stable for programmatic agents- Install path is pure Rust via cargo
- v0.1.2 ships config, mitm, workflow, local scrape/crawl/map/search/parse, print-pdf, monitor, qr, find-paths, LLM extract, and expanded schema discovery
Superpowers
- Navigation and page lifecycle:
goto,back,forward,reload,page - Input:
press,write,type,keys,hover,drag,fill-form,upload - Observation:
view,grab,extract,text,attr,scroll,assert - Wait: multi
--textvalues resolve as OR (any text wins) - Scrape:
scrapewith--format text|markdown|html|links|metadata|raw-html|screenshot|summary|product|brandingand--engine http|browser(browser engine applies formats via outerHTML) - Local scrape/crawl/map/search/parse surface:
batch-scrape,crawl,map,search(cleansuddg=SERP redirects),parse(PDF/DOCX/xlsx/ods +--redact-pii) - Extract LLM:
extract --llm --question --schema-json(XDGopenrouter_api_key,llm_base_url,llm_model) - Capture:
consoleandnetwith optional global capture flags - DevTools depth:
eval,emulate,resize,perf,lighthouse(XDGlighthouse_path),heap - PDF print:
print-pdfone-shot CDPPage.printToPDF - Monitor:
monitor check --url --baseline [--write-baseline] - Utilities (no Chrome):
qr encode|decode,find-paths - Assert aliases:
url_contains/text_contains;attrfalls back to DOM properties - Scroll aliases in
run:dy/dxfordelta_y/delta_x - Optional categories: memory, extensions, third-party, webmcp
- Experimental: vision
click-at, screencast with ffmpeg export - MITM one-shot:
mitm startbinds127.0.0.1only (hudsucker) - Workflow DAG:
workflow run|resume|statuswith SQLite journal (resume skips ok) - XDG config:
config path|init|show|set|getfor config.toml - Discovery:
doctor(incl. XDG browsers_dir),commands(56 names),schema --cmd(goto/eval/type/scroll/assert expanded),completions - Fail-fast multi-step:
runreturns partialdata.stepson error envelopes
Quick Start
Installation
- Local development install:
- From crates.io after the first publish:
- Runtime needs Chrome or Chromium on the shell path (or
config set chrome_path) - Optional:
ffmpegfor screencast file export - Optional:
lighthousebinary for lighthouse audits (orconfig set lighthouse_path)
Usage
- Always pass
--jsonfor agent pipelines - Keep human diagnostics on stderr with
-qwhen piping - Use
--timeoutfor wall-clock process budget in seconds - Use
run --scriptfor multi-step sessions that need shared@eNrefs - Prefer CLI flags for one-off agent calls; use
configfor durable XDG defaults - Logging detail:
--verbose/--debug/-q, orconfig set log_level - Localize human suggestions with
--lang pt-BRorconfig set lang pt-BR - Optional scrape
--webhook-urlposts the result once to an operator URL (not product telemetry)
Commands
- Discovery:
doctor,commands,schema,version,completions - Config:
config path,config init,config show,config set,config get - Navigate:
goto,back,forward,reload - Snapshot and input:
view,press,write,type,keys,wait,hover,drag,fill-form,upload - Content:
extract,text,scroll,attr,assert,grab - Scrape and discovery:
scrape,batch-scrape,crawl,map,search,parse - PDF and monitor:
print-pdf,monitor - Utilities:
qr,find-paths - Tabs and dialogs:
page,dialog,cookie - Capture:
console,net - MITM:
mitm status|list|get|har|export|domains|apis|init-ca|start - Workflow:
workflow run|resume|status - Advanced:
eval,emulate,resize,perf,lighthouse,screencast,heap - Categories:
extension,devtools3p,webmcp - Multi-step:
run,exec - Inventory: 56 top-level command names (
commands --json), including DevTools parity tools plusprint-pdf,monitor,qr,find-paths, scrape surface, MITM, workflow, and config
Configuration
- Prefer CLI flags for one-off agent calls
- Use
config path|init|show|set|getfor XDG config.toml - Product settings only via flags and
config set(XDG) - Logging:
--verbose/--debug/-q, or XDGconfig set log_level - Color:
config set color true|false - Chrome binary: shell path or XDG
config set chrome_path - Lighthouse binary: shell path or XDG
config set lighthouse_path - Config keys:
lang,timeout,artifacts_dir,ignore_robots,namespace,encryption_key,color,log_level,chrome_path,lighthouse_path,openrouter_api_key,llm_base_url,llm_model config initcreates XDG layout and default config.tomlconfig pathprints resolved config, data, cache, state, and browsers_dir paths- CLI flags override values stored in config.toml
- Doctor reports XDG browsers_dir among readiness checks
Features
- This crate has no Cargo feature flags
- Optional categories are process flags, not compile-time features
--category-memoryenables deep heap tools--category-extensionsenables extension tools--category-third-partyenables third-party DevTools helpers--category-webmcpenables webmcp tools--experimental-visionenablesclick-at--experimental-screencastenables screencast export with ffmpeg
Targets
- Documented for
x86_64-unknown-linux-gnu - Documented for
x86_64-apple-darwin - Documented for
aarch64-apple-darwin - Documented for
x86_64-pc-windows-msvc - Documented for
aarch64-unknown-linux-musl - Not supported on
wasm32-unknown-unknown(Chrome CDP requires a desktop browser) - docs.rs metadata declares these targets explicitly after the 2026-05-01 multi-target change
MSRV
- Minimum Supported Rust Version is 1.88.0
- Policy: bump MSRV only in minor or major releases with CHANGELOG note
- Local docs:
timeout 180 cargo doc --no-deps
Integration Patterns
- Claude Code, Codex, Cursor, and shell agents spawn one process per action
- Multi-step agent plans must use
run --scriptinstead of chaining separate processes - Parse stdout with
jaqand ignore stderr unless diagnosing failures - Persist durable defaults with
config setunder XDG - See INTEGRATIONS.md and docs/AGENTS.md
Performance
- Cold start is dominated by Chrome launch, not Rust binary size
- Prefer
doctor --offline --quickfor install checks without network - Reuse multi-step scripts to avoid repeated Chrome launches
- Prefer
scrape --engine httpwhen CDP is not required - Use
batch-scrapeconcurrency for parallel HTTP fetches
Memory Requirements
- Expect Chrome process memory far above the CLI binary itself
- Heap tools need
--category-memoryand larger snapshots increase RAM use - Screencast export may invoke ffmpeg as an external helper
- Workflow journals and MITM captures land under XDG state/data paths
Troubleshooting FAQ
- Chrome not found: install Chromium or Google Chrome, ensure it is on the shell path, or
config set chrome_path, then re-rundoctor - Config / XDG: run
config initthenconfig pathto inspect layout; useconfig set|getfor values - Product settings only via flags and
config set(XDG) - Exit 69 unavailable: browser binary missing, blocked, or not launchable
- Exit 124 timeout: raise
--timeoutor shorten the script - Exit 2 usage: re-check flags with
browser-automation-cli help <cmd> @eNrefs invalid across commands: keep steps inside onerunprocess; refs do not span processes- Network empty: pass
--capture-networkon the same process that navigates - Wait multi-text: repeat
--textfor OR semantics (any listed text unblocks) - MITM bind:
mitm startlistens on127.0.0.1only with an ephemeral port - Workflow resume:
workflow resumeskips steps alreadyokin the journal - Scrape browser formats:
--engine browserapplies--format(markdown/html/links/metadata/raw-html/screenshot/summary/product/branding) via outerHTML - Scroll aliases: in
runscripts usedy/dxas aliases fordelta_y/delta_x - Schema discovery:
schema --cmd goto|eval|type|scroll|assertexposes expanded tool-ref flags - Lang:
--lang pt-BRorconfig set lang pt-BRlocalizes human suggestions - Fail-fast partial steps: failed
runerror envelopes may include partialdata.steps - Lighthouse path:
config set lighthouse_path /path/to/lighthousewhen not on the shell path - Search redirects:
searchcleansuddg=wrappers to destination URLs - Parse documents:
parsesupports PDF/DOCX/xlsx/ods and--redact-pii - Extract LLM: requires XDG
openrouter_api_key(optionalllm_base_url,llm_model) - Print PDF:
print-pdf --url <url> --path <file>one-shot CDP - Monitor baseline:
monitor check --url <url> --baseline <file> [--write-baseline] - Assert aliases:
url_contains/text_contains;attruses DOM property fallback when HTML attribute is null - Inventory size:
commands --jsonlists 56 top-level names (not only the 52 DevTools parity tools)
Exit Codes
0success2usage or clap parse failure65data error66no input69unavailable70software, browser, or protocol failure74I/O failure78config error124timeout130cancelled by SIGINT141broken pipe255unexpected fatal path
Documentation Map
- docs/HOW_TO_USE.md first command in 60 seconds
- docs/AGENTS.md agent integration contract
- docs/COOKBOOK.md practical recipes
- docs/CROSS_PLATFORM.md platform matrix
- docs/MIGRATION.md version migration notes
- docs/TESTING.md test categories
- docs/schemas/README.md JSON schema index
- skills/browser-automation-cli-en/SKILL.md imperative agent skill
- CHANGELOG.md Keep a Changelog history
- SECURITY.md vulnerability reporting
- CONTRIBUTING.md contributor workflow
- CODE_OF_CONDUCT.md Contributor Covenant 2.1
- llms.txt short LLM discovery map
Contributing
- Read CONTRIBUTING.md before opening a PR
- Follow the Code of Conduct in CODE_OF_CONDUCT.md
Security
- Report vulnerabilities privately via SECURITY.md
- Maintainer contact: daniloaguiarbr@proton.me
Changelog
- Version history lives only in CHANGELOG.md
License
- Dual licensed under MIT OR Apache-2.0
- See LICENSE, LICENSE-MIT, and LICENSE-APACHE