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 without product environment variables
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 scattered across env vars make 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.1 ships config, mitm, workflow, batch-scrape, crawl, map, search, and parse
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|metadataand--engine http|browser - Firecrawl-parity local surface:
batch-scrape,crawl,map,search,parse - Capture:
consoleandnetwith optional global capture flags - DevTools depth:
eval,emulate,resize,perf,lighthouse,heap - 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,schema,completions
Quick Start
Installation
- Local development install:
- From crates.io after the first publish:
- Runtime needs Chrome or Chromium on PATH
- Optional:
ffmpegfor screencast file export - Optional:
lighthousebinary for lighthouse audits
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
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 - 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
Configuration
- Prefer CLI flags for one-off agent calls
- Use
config path|init|show|set|getfor XDG config.toml - Product settings are NOT read from
BROWSER_AUTOMATION_CLI_*environment variables - OS-level only:
RUST_LOG(tracing),NO_COLOR/ color via config,PATHfor Chrome/ffmpeg/lighthouse 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 - Nightly docsrs cfg:
RUSTDOCFLAGS="--cfg docsrs" timeout 180 cargo +nightly 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, not product env vars - 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 PATH, then re-run
doctor - Config / XDG: run
config initthenconfig pathto inspect layout; useconfig set|getfor values - 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 - Product env not supported: do not set
BROWSER_AUTOMATION_CLI_*for settings; use flags orconfig - 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
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