Loading...
Loading...
Self-healing browser automation framework that connects LLM agents directly to Chrome via CDP. Use when the user needs autonomous browser tasks, clean browser verification, Codex or Antigravity browser control, Claude-safe screenshots, adaptive helper code in `agent_helpers.py`, domain skills, or Browser Use Cloud escalation. Triggers on: browser-harness, self-healing browser, llm browser automation, cdp agent, chrome devtools agent, codex browser automation, antigravity browser automation, claude screenshot error, claude image error, agent browser task, browser-use harness, domain skills browser.
npx skill4agent add akillness/oh-my-skills browser-harnessKeyword:·browser-harness·self-healing browser·llm browser automationcdp agentDirect WebSocket connection between an LLM agent and Chrome via Chrome DevTools Protocol. The agent can inspect the page, write helper code, reuse domain skills, and verify the task without an extra browser abstraction layer.
agent-browseragent-workspace/agent_helpers.pyagent-workspace/domain-skills/scraplingagentationplaywriterreact-grab--remote-debugging-port=9222agyagent-workspace/domain-skills/git clone https://github.com/browser-use/browser-harness.git
cd browser-harness
python3 -m venv .venv
source .venv/bin/activate
pip install -e .Set up https://github.com/browser-use/browser-harness for mehttp://localhost:9222/json# macOS
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \
--remote-debugging-port=9222 --user-data-dir=/tmp/chrome-debug
# Linux
google-chrome --remote-debugging-port=9222 --user-data-dir=/tmp/chrome-debug
# Windows PowerShell
& "C:\Program Files\Google\Chrome\Application\chrome.exe" `
--remote-debugging-port=9222 --user-data-dir="$env:TEMP\chrome-debug"curl -s http://localhost:9222/json| Platform | Use browser-harness when | Setup note |
|---|---|---|
| Claude Code | You need autonomous browser work or Claude-safe screenshots | Apply the screenshot patch before image-heavy work |
| Codex CLI | You need local CDP automation from a repo task | Keep |
Antigravity ( | You need the same browser harness from Antigravity workflows | Ensure |
| Gemini CLI / OpenCode | You need portable browser automation without platform-specific MCP wiring | Use the same local CDP and Python workspace |
cd ~/browser-harness
source .venv/bin/activate
python -c "import browser_harness; print('browser-harness OK')"
curl -s http://localhost:9222/jsonsrc/browser_harness/helpers.pydiff --git a/src/browser_harness/helpers.py b/src/browser_harness/helpers.py
--- a/src/browser_harness/helpers.py
+++ b/src/browser_harness/helpers.py
@@
-import base64, importlib.util, json, math, os, sys, time, urllib.request
+import base64, importlib.util, io, json, math, os, sys, time, urllib.request
@@
- img = Image.open(path)
+ with Image.open(path) as src:
+ img = src.copy()
@@
- open(path, "wb").write(base64.b64decode(r["data"]))
+ data = base64.b64decode(r["data"])
if max_dim:
from PIL import Image
- img = Image.open(path)
+ img = Image.open(io.BytesIO(data))
if max(img.size) > max_dim:
img.thumbnail((max_dim, max_dim))
- img.save(path)
+ buf = io.BytesIO()
+ img.save(buf, format="PNG")
+ data = buf.getvalue()
+ with open(path, "wb") as f:
+ f.write(data)Image.open(path)io.BytesIOwith open(path, "wb")path = capture_screenshot(max_dim=1800)max_dim=1800Open the local app, complete the signup form, and verify that the dashboard appears.
Navigate to GitHub, open the first open issue, and summarize the acceptance criteria.
Fill in the contact form at example.com and confirm the success message.agent-workspace/agent_helpers.pyagent-workspace/agent_helpers.pyagent-workspace/domain-skills/agent-workspace/domain-skills/
├── github.py
├── linkedin.py
└── your-site.pydef login(page, username: str, password: str):
"""Log into mysite.com."""
page.goto("https://mysite.com/login")
page.fill("#username", username)
page.fill("#password", password)
page.click("button[type=submit]")
page.wait_for_url("**/dashboard")from browser_harness import BrowserUseCloud
client = BrowserUseCloud(api_key="YOUR_API_KEY")
result = client.run("Extract the dashboard data and return a CSV summary")
print(result)local-cdpagent_helpers.pyscraplingplaywritercd ~/browser-harness
source .venv/bin/activate
python -c "import browser_harness; print('browser-harness OK')"
curl -s http://localhost:9222/json