Browser harness

From itgoyo/hermes-skills · View interactive version

Browser harness is an AI agent skill from the GitHub repository itgoyo/hermes-skills. Direct browser control via CDP. Use when the user wants to automate, scrape, test, or interact with web pages. Connects to the user's already-running Chrome.

How to use this skill

Skill file

browser-harness

Easiest and most powerful way to interact with the browser. Read this file in full before using or editing the harness — it has to be in context.

Fast start

Read helpers.py first. For first-time install or reconnect/bootstrap, read install.md first.

browser-harness <<'PY'
new_tab("https://docs.browser-use.com")
wait_for_load()
print(page_info())
PY

The code is the doc.

Available interaction skills:

Available domain skills:

Tool call shape

browser-harness <<'PY'
# any python. helpers pre-imported. daemon auto-starts.
PY

run.py calls ensure_daemon() before exec — you never start/stop manually unless you want to.

Remote browsers

Use remote for parallel sub-agents (each gets its own isolated browser via a distinct BU_NAME) or on a headless server. BROWSER_USE_API_KEY must be set. start_remote_daemon, list_cloud_profiles, list_local_profiles, sync_local_profile are pre-imported.

browser-harness <<'PY'
start_remote_daemon("work")                               # default — clean browser, no profile
# start_remote_daemon("work", profileName="my-work")      # reuse a cloud profile (already logged in)
# start_remote_daemon("work", profileId="<uuid>")         # same, but by UUID
# start_remote_daemon("work", proxyCountryCode="de", timeout=120)   # DE proxy, 2-hour timeout
# start_remote_daemon("work", proxyCountryCode=None)      # disable the Browser Use proxy
PY

BU_NAME=work browser-harness <<'PY'
new_tab("https://example.com")
print(page_info())
PY

start_remote_daemon prints liveUrl and auto-opens it in the local browser (if a GUI is detected) so the user can watch along. Headless servers print only — share the URL with the user. The daemon PATCHes the cloud browser to stop on shutdown, which persists profile state. Running remote daemons bill until timeout.

Profiles (cookies-only login state) live in interaction-skills/profile-sync.md — covers list_cloud_profiles(), the chat-driven "which profile?" pattern, and sync_local_profile() for uploading a local Chrome profile.

Search first

After cloning the repo, search domain-skills/ first for the domain you are working on before inventing a new approach.

Only if you start struggling with a specific mechanic while navigating, look in interaction-skills/ for helpers. The available interaction skills are:

Useful commands:

rg --files domain-skills
rg -n "tiktok|upload" domain-skills

Always contribute back

If you learned anything non-obvious about how a site works, open a PR to domain-skills/<site>/ before you finish. Default to contributing. The harness gets better only because agents file what they learn. If figuring something out cost you a few steps, the next run should not pay the same tax.

Examples of what's worth a PR:

What a domain skill should capture

The durable shape of the site — the map, not the diary. Focus on what the next agent on this site needs to know before it starts:

Do not write

What actually works

Design constraints

Architecture

Chrome / Browser Use cloud -> CDP WS -> daemon.py -> /tmp/bu-<NAME>.sock -> run.py

Critical usage notes

```bash

# ✅ Correct

browser-harness <<'PY'

new_tab("https://example.com")

print(page_info())

PY

# ✅ Also correct

browser-harness < script.py

# ❌ WRONG — silently does nothing

browser-harness script.py

```

```bash

WS_URL=$(curl -s http://localhost:9222/json/version | grep -o '"webSocketDebuggerUrl": "[^"]*"' | cut -d'"' -f4)

export BU_CDP_WS="$WS_URL"

browser-harness <<'PY'

...

PY

```

```bash

/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \

--remote-debugging-port=9222 \

--user-data-dir=/tmp/chrome-debug \

--remote-allow-origins=* &

```

Gotchas (field-tested)

uv run python - <<'PY'

from admin import restart_daemon

restart_daemon()

PY

before assuming setup is wrong.

```python

import json, urllib.request, os

ver = json.loads(urllib.request.urlopen('http://127.0.0.1:9222/json/version').read())

os.environ['BU_CDP_WS'] = ver['webSocketDebuggerUrl']

```

```python

js("window.location.href = 'https://www.binance.com/zh-CN/square'")

time.sleep(7)

url = js("window.location.href") # verify landed

```

```bash

~/.local/bin/browser-harness < script.py > /tmp/out.txt 2>&1 &

BH_PID=$!

sleep 35

kill $BH_PID 2>/dev/null

cat /tmp/out.txt

```

Interaction notes

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.