Browser Harness ♞
Connect an LLM directly to your real browser with a thin, editable CDP harness. For browser tasks where you need complete freedom.
One websocket to Chrome, nothing between. The agent writes what's missing during execution. The harness improves itself every run.
Try browser-harness in Browser Use Cloud or paste the setup prompt into your coding agent.
● agent: wants to upload a file
│
● agent-workspace/agent_helpers.py → helper missing
│
● agent writes it agent_helpers.py
│ + custom helper
✓ file uploaded
You will never use the browser again.
Setup prompt
Paste into Claude Code or Codex:
Install or upgrade browser-harness to the latest stable version with uv using Python 3.12, register the skill from `browser-harness skill`, and connect it to my browser. Follow https://github.com/browser-use/browser-harness/blob/main/install.md if setup or connection fails.
The agent will open chrome://inspect/#remote-debugging. Tick the checkbox so the agent can connect to your browser:
Click Allow when the per-attach popup appears (Chrome 144+):
See agent-workspace/domain-skills/ for example tasks.
Free Browser Use Cloud browsers
Stealth, sub-agents, or headless deployment.
Browser Use Cloud free tier: 3 concurrent browsers, proxies, captcha solving, and more. No card required.
Lexmount cloud browser (bh-lex)
bh-lex runs browser-harness on a hosted Lexmount browser (fresh IP, no local Chrome) and is the default for skill exploration.
bh-lex <<'PY'
new_tab("https://example.com"); print(page_info())
PY
Configure credentials in any of these (checked low→high precedence, so real env vars always win):
~/.claude/skills/lexmount-browser/.env (if you use the lexmount-browser skill)
${XDG_CONFIG_HOME:-~/.config}/browser-harness/lexmount.env (global config)
- a project
.env — repo root or your working dir (already gitignored)
- exported
LEXMOUNT_* environment variables
# .env (or ~/.config/browser-harness/lexmount.env)
LEXMOUNT_API_KEY=...
LEXMOUNT_PROJECT_ID=...
LEXMOUNT_BASE_URL=https://api.lexmount.cn
# optional second region, selected with BH_LEX_REGION=en
LEXMOUNT_API_KEY_EN=...
LEXMOUNT_PROJECT_ID_EN=...
LEXMOUNT_BASE_URL_EN=https://api.lexmount.com
- Default mode is connectionless: attaches to the project's pooled cloud browser — nothing to create, close, or leak; tab/cookie state persists across calls. If that pooled browser is ever unreachable,
bh-lex automatically falls back to a fresh ephemeral session (clean up with bh-lex --close).
BH_LEX_REGION=cn|en selects the project (default cn).
BH_LEX_ISOLATED=1 BU_NAME=<key> provisions a dedicated ephemeral session per key for parallel work; tear it down with bh-lex --close.
Architecture (~1k lines across 4 core files)
install.md — first-time install and browser bootstrap
SKILL.md — day-to-day usage
src/browser_harness/ — protected core package
${XDG_CONFIG_HOME:-~/.config}/browser-harness/agent-workspace/agent_helpers.py — helper code the agent edits
${XDG_CONFIG_HOME:-~/.config}/browser-harness/agent-workspace/domain-skills/ — reusable site-specific skills the agent edits
Plain browser-harness helper calls attach to the running Chrome/Chromium CDP endpoint. For isolated automation, launch Chrome yourself with --remote-debugging-port and pass BU_CDP_URL, or use a Browser Use cloud browser.
Development
From a checkout, use ./browser-harness to run the current working tree without activating a virtualenv or depending on the globally installed command:
./browser-harness <<'PY'
print(page_info())
PY
Normal agent-facing docs should keep using browser-harness; the ./browser-harness launcher is only for local repo testing.
Contributing