/agent-webbridge:agent-webbridgefrom agent-webbridge
Drives the user's real Chrome with multiple profiles, live logins, and parallel tabs via a local daemon and Chrome extension. Use for multi-account workflows or concurrent browser tasks needing real sessions.
Ships in agent-webbridge. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Clean-room, open-source (MIT) browser automation for AI agents. Drives the user's actual
Chrome — multiple profiles with their live logins, and multiple tabs per profile, all
in parallel. A lightweight Node daemon runs per profile on a deterministic hashed port; a
router on http://127.0.0.1:10086 proxies /command to the right daemon by a top-level
"profile" field. macOS and Windows (Google Chrome).
This repository is packaged as a Claude Code plugin/skill. The canonical skill also lives at skills/agent-webbridge/SKILL.md; this root copy exists so skill indexers that expect a top-level
SKILL.mdcan discover it.
agent-webbridge is clean-room and standalone: its own daemon (src/daemon/, only runtime
dep is ws) and its own MV3 Chrome extension (agent-webbridge-extension/, stable id
ifodkkbkmngjlkhiphcjmbceeolhpfeo). No closed-source dependency, no account, no
telemetry, and no curl|bash installer. It is localhost-only: the extension connects
only to a daemon you run on 127.0.0.1; no data leaves the machine and no remote server is ever
contacted.
Use this whenever a task needs a real browser with the user's real logins, especially across more than one account or with several pages in flight at once:
chrome.debugger per tab, so N tabs in one profile run in parallel
(the killer feature vs typical browser bridges, which funnel every call through one global
"current tab" and so drive just one tab per profile).Prefer this over headless/scrape tools when login state, real cookies, multiple simultaneous profiles, or per-profile tab parallelism matter.
awb status
Then act on the result:
daemonUp: true and extensionConnected: true for the profile(s) you want — healthy.
Proceed with the tool calls below.Parallel runs go wrong in a few predictable ways: the browser fills with many tab groups, tabs
steal focus, results from different tabs get mixed up, and one worker closes another's pages.
Every rule below follows from how the extension really works (agent-webbridge-extension/background.js
and src/groups.mjs), not from convention.
session = one tab group. Choose a task-named session once (price-check),
put it on every command from every worker, and never change it mid-task or per site.
Defaults are traps:
mcp for any call that omits session, so unrelated tasks
pile into one group. Always pass session, or set AWB_MCP_SESSION.session-<timestamp> / py-session-<timestamp>). Pass the same session to every instance.awb groups, or list_tabs and read each tab's groupTitle. Note that
list_tabs returns every tab in the profile, not just your session's.tabId from each navigate
result and send it on every later command (args._tabId over HTTP, tabId in MCP). Without
it, a command goes to whichever tab was navigated last (possibly another worker's) and all such
commands wait in one shared queue, so they run one after another, not in parallel.newTab:true with active:false
(the default steals focus on every new tab, which flickers the window). Check bgSupported:true
in the navigate result: an older extension build ignores active. For a long worklist, open
M tabs (default 5 per profile) and send each tab to its next item with navigate + _tabId and
no newTab, rather than opening a fresh tab per item.group_title on every navigate of the session.
Each navigate re-applies the group's title, so a call that omits it resets the label to
agent:<session>.close_tab
_tabId. close_session closes every tab in the session, other workers' included, so only
the coordinator calls it, once, when the whole task is done and the user no longer needs the
pages (also on error exits). Deliver your answer before closing; the user may want to look.Verified for syntax in bash and zsh with a stubbed cmd; needs jq. Not run against a live fleet.
cmd(){ curl -s -m 60 -X POST http://127.0.0.1:10086/command -H 'Content-Type: application/json' -d "$1"; echo; }
S=price-check; P=Work; T="Price check" # ONE session + ONE group title for the whole task
d=$(mktemp -d)
# 1. Open every tab at once, in the background. Same session => one group. Keep each tabId.
i=0; for u in "${URLS[@]}"; do
cmd "$(jq -nc --arg u "$u" --arg s "$S" --arg p "$P" --arg t "$T" \
'{action:"navigate",args:{url:$u,newTab:true,active:false,group_title:$t},session:$s,profile:$p}')" > "$d/$i.open" &
i=$((i+1))
done; wait
# 2. Drive every tab at once, each with ITS OWN tabId (never rely on the "current tab").
for f in "$d"/*.open; do
id=$(jq -r '.data.tabId' "$f")
cmd "$(jq -nc --argjson id "$id" --arg s "$S" --arg p "$P" \
'{action:"snapshot",args:{_tabId:$id},session:$s,profile:$p}')" > "$f.snap" &
done; wait
# 3. Close only your own finished tabs (close_session would close every worker's tabs).
for f in "$d"/*.open; do
id=$(jq -r '.data.tabId' "$f")
cmd "$(jq -nc --argjson id "$id" --arg s "$S" --arg p "$P" \
'{action:"close_tab",args:{_tabId:$id},session:$s,profile:$p}')" > /dev/null &
done; wait
Over MCP, the same rules apply: pass session and the tabId from each browser_navigate
result to every browser_* call, and active:false on browser_navigate for background tabs.
With the client libraries, create one client per tab (each pins its own tab id) and share the
session. Node: navigate(url, { newTab, groupTitle, active }); Python:
navigate(url, new_tab=..., group_title=..., active=...):
import { WebBridgeClient } from "agent-webbridge"; // from 1.3.3; before that use docs/skill/awb-client.mjs
const session = "price-check"; // shared by every worker
const open = async (url) => {
const c = new WebBridgeClient({ profile: "Work", session });
await c.navigate(url, { newTab: true, active: false, groupTitle: "Price check" });
return c; // c now pins this tab
};
const tabs = await Promise.all(urls.map(open));
const pages = await Promise.all(tabs.map((c) => c.snapshot()));
await Promise.all(tabs.map((c) => c.closeTab())); // not closeSession(): that closes every tab
| You see | Likely cause | Fix |
|---|---|---|
| Many tab groups for one task | A new session per worker, per site, per client instance, or the default mcp | One shared session name (rule 1) |
Group title flips back to agent:<session> | A navigate without group_title | Same group_title every time (rule 5) |
| Wrong page read, results mixed up | No _tabId in parallel (shared current tab) | Pass each tab's id (rule 3) |
| "Parallel" calls run one by one | Same cause: they share one queue | Pass each tab's id (rule 3) |
| Window flickers, focus jumps | active left at its default | active:false (rule 4) |
| Tabs pile up | A new tab per item, nothing closed | Reuse tabs, close your own (rules 4, 6) |
| Other workers' tabs vanish | A worker called close_session | Workers use close_tab (rule 6) |
evaluate)evaluate runs your code in the page with awaitPromise, so async/await works and a thrown
error comes back as an error message with no partial result.
(async () => { ... })(). Each call needs a fresh scope;
declaring the same const in two calls throws SyntaxError.return JSON.stringify(data), never indented. Cap lists and
strings (.slice(0, 50), .slice(0, 500)); big results are truncated. Never return DOM nodes.{ok:false, reason:"no .price element"}) and use ?., instead of
throwing on a missing element.navigate the load event has fired but a
single-page app may still be rendering. Poll inside the script:
for (let i = 0; i < 40 && !document.querySelector(SEL); i++) await new Promise(r => setTimeout(r, 250));snapshot + @e refs to find and click; fill for text (setting
el.value is ignored by React/Vue); trusted_click when a synthetic click is ignored;
evaluate for reading attributes (href, data-*), tables, scrolling and same-origin fetch.location.href = ...); use navigate so the tool waits for
load and keeps the tab in its group. No alert/confirm/prompt (they block), no endless loops;
keep a call under the 60 s request timeout.jq do the escaping instead of hand-quoting:
jq -nc --rawfile code probe.js --argjson id "$ID" --arg s "$S" '{action:"evaluate",args:{code:$code,_tabId:$id},session:$s}'Full, copy-pasteable setup is in AGENTS.md. Quick version:
npm i -g agent-webbridge # daemon + `awb` CLI
awb setup "Work" "Personal" # install the extension (opens Web Store, "Add to Chrome") + bring the fleet up
awb connect "Work" "Personal" # (re)point each extension at its daemon (no restart if Chrome is open and the extension is current)
awb up "Work" "Personal" # start each profile's daemon + router on :10086, open windows
awb status # verify: extensionConnected:true per profile
awb down # tear down the fleet
(Pre-publish, run node bin/awb.mjs <cmd> from the repo. Run awb doctor first for a read-only
environment self-check.)
The extension installs from the Chrome Web Store. awb setup <profile…> automates everything
except the one click Chrome reserves for a human. When you (the agent) run it, guide the user
through that click and poll for success rather than waiting blindly:
awb setup "<profile>". It opens the Agent WebBridge Web Store listing in that profile.awb check "<profile>" --json. For each profile it reports loaded, enabled,
daemonUp, connected, a ready boolean, and a single nextStep hint. Relay nextStep to
the user and loop until ready: true. (awb setup also polls and continues on its own once the
install lands, then connects + brings the fleet up — so a plain awb setup often finishes
without you needing awb check at all; use check when driving the steps yourself or
re-checking state between turns.)Developers iterating on the extension source use
awb install-devinstead, which Load-unpacks the in-repo build. The daemon recognizes both the store id and the dev id.
Zero-restart connect: with Chrome running, awb connect / awb up hand each profile's extension
its daemon URL through the extension's own popup (popup.html#connect=<ws url>). The extension
checks that it is ws://127.0.0.1:<port>/ws, stores it as local_url itself and connects, so
Chrome is not closed. The value persists, so later runs just reconnect.
Fallback: an extension build that predates this ignores the hint (reload an unpacked build in
chrome://extensions, or update the Web Store build). For those profiles only, awb connect writes
local_url into the extension's on-disk storage.local, which needs Chrome closed (LevelDB is
single-writer), so it quits Chrome first. Agents: pass --no-restart so the command never
closes the user's browser and reports failure instead. If Chrome is already quit, awb up alone does
the write for you.
POST to the router on http://127.0.0.1:10086/command. The body is the normal command body
plus a top-level "profile" field (name / email / directory) selecting the target profile.
Omit "profile" to hit the default profile. Every command also carries a top-level "session"
naming the current task — see Sessions.
cmd helper)Agents should define this one-line shell helper at the start of a command invocation to eliminate curl boilerplate and protect JSON payloads from shell escaping issues:
cmd(){ curl -s -m 60 -X POST http://127.0.0.1:10086/command -H 'Content-Type: application/json' -d "$1"; echo; }
Key rules for agents:
'...'): This prevents bash/zsh from interpolating $, backticks, or double quotes inside JS code, CSS selectors, and URLs."action":"evaluate", wrap code in a self-contained IIFE (()=>{ ... })() and keep it on a single line (no raw unescaped newlines inside the JSON string).args.path for screenshots: Direct disk capture saves the file and returns clean metadata (path, sizeBytes), completely avoiding base64 floods in agent context.Examples:
cmd(){ curl -s -m 60 -X POST http://127.0.0.1:10086/command -H 'Content-Type: application/json' -d "$1"; echo; }
# Navigate
cmd '{"action":"navigate","args":{"url":"https://mail.google.com","newTab":true},"session":"s1","profile":"Work"}'
# Evaluate JavaScript safely
cmd '{"action":"evaluate","args":{"code":"(()=>{ const b=Array.from(document.querySelectorAll(\"[role=button],button\")).filter(e=>e.innerText.trim()===\"Publish\"&&e.getBoundingClientRect().width>0); b.forEach(e=>e.click()); return \"clicked \"+b.length; })()"},"session":"s1","profile":"Work"}'
# Screenshot directly to disk path
cmd '{"action":"screenshot","args":{"path":"/tmp/preview.png"},"session":"s1","profile":"Work"}'
# Clean up session
cmd '{"action":"close_session","session":"s1","profile":"Work"}'
Parallelism is cross-profile (N profiles) × per-tab (N tabs/profile): fire several
/command requests at once — across different profiles, or at different tabs within the same
profile — and they run concurrently.
For a large worklist (hundreds–thousands of items — scrape N companies, check N accounts, fill N forms), drive it as a fleet fan-out:
awb status / awb check --json / awb profiles): use
2 profiles if at least two are set up + connected, otherwise fall back to 1 profile.
Within each profile keep 5 concurrent tabs. If the user asks for a specific
tabs-per-profile number, use that instead (per-profile parallelism is proven safe up to
10 tabs; 5 is the gentler default).awb up "P1" "P2" …), split the worklist into one chunk per profile, and within each
profile keep up to M /command requests (M tabs) in flight at once — e.g.
5 profiles × 10 tabs = 50 items processed concurrently. Per-tab parallelism is real
(chrome.debugger is attached per tab), so tabs in one profile don't block each other.awb down,
machine sleep) then resumes where it stopped instead of redoing everything — and you can
safely stop a run to re-tune concurrency, then relaunch.15 tools, full parity, all verified live in a real browser:
| Tool | Args | Returns | Note |
|---|---|---|---|
navigate | url, newTab(bool), active(bool, false = open in background), group_title | {success, url, tabId, bgSupported} | First call opens a tab — see Tabs. group_title sets the group's visible label |
find_tab | url, active(bool) | {success, url, tabId} | Select an already-open tab as the current one — see Tabs |
snapshot | — | {url, title, tree} with @e refs | Accessibility tree (text) — use this to read page content and locate elements |
click | selector (@e ref or CSS) | {success, tag, text} | Synthetic el.click() |
trusted_click | selector (@e ref or CSS) or x,y; opt. button, clickCount, activate, force | {success, x, y, tag, text, hit, visibility, activated} | Real mouse via CDP Input.dispatchMouseEvent (isTrusted); activates a hidden tab first; refuses a covered target unless force |
fill | selector, value | {success, tag, mode} | Works on <input>/<textarea> AND [contenteditable] (ProseMirror/Lexical/Slate). mode is "value" or "contenteditable" |
evaluate | code (supports async/await) | {type, value} | |
screenshot | format(png|jpeg), quality(0-100), optional selector (@e/CSS), optional path | {format, path, sizeBytes, mimeType} | Returns a file path, not base64 — see Screenshots |
network | cmd(start|stop|list|detail), filter, requestId | request/response data | Capture requests/responses |
upload | selector, files(string[]) | {success, fileCount} | |
file_chooser_intercept | enabled(bool) | {success, enabled} | Toggle interception of native OS file chooser dialogs to suppress Finder/Explorer popups |
save_as_pdf | paper_format, landscape, scale, print_background, optional path | {path, sizeBytes, mimeType, pageTitle} | Render current page → PDF, returns a file path — see Save as PDF |
list_tabs | — | {success, tabs:[{tabId, url, title, active, groupTitle}]} | Lists every tab in the profile; filter by groupTitle to find your session's |
close_tab | _tabId (recommended) | {success, closed: bool} | Closes the target tab; with no _tabId it closes the shared current tab |
close_session | — | {success, closed: int} | Close all tabs in the session — closed is the count. See Sessions |
Single-tab tools (snapshot, click, fill, screenshot, save_as_pdf) act on the current
tab — the one you most recently opened with navigate or selected with find_tab. Because the
daemon attaches chrome.debugger per tab, multiple tabs in the same profile can be driven
concurrently from parallel /command requests.
The current tab is shared by every session in the profile, so for anything parallel pass
_tabId on each call; see Agent operating rules.
newTab:true when pages should coexist (comparing, cross-referencing,
or running in parallel); omit it to send the current tab to a new URL.find_tab to make a tab you already opened the current
one again. Pass the tab's full URL — take it from list_tabs or the earlier navigate
result. A bare root domain may miss a www. tab, so prefer the exact URL. active:true picks
the tab the user is currently viewing; otherwise the leftmost match wins.find_tab returns "no open tab found", the page isn't open — navigate with newTab:true
instead.curl -s -X POST http://127.0.0.1:10086/command \
-d '{"action":"find_tab","args":{"url":"https://www.example.com","active":true},"session":"research","profile":"Work"}'
Every command carries a top-level session naming the current task — see Sessions.
Add a top-level profile to target a specific profile (omit for the default). The examples in
later sections omit them only for brevity; in real calls always include session (and profile
when driving a non-default profile).
curl -s -X POST http://127.0.0.1:10086/command \
-H 'Content-Type: application/json' \
-d '{"action":"navigate","args":{"url":"https://example.com","newTab":true,"group_title":"My task"},"session":"my-task","profile":"Work"}'
One task = one session = one tab group. A session collects every tab this task opens into a
single Chrome tab group, so the user sees one group representing "what the agent is doing right
now". Pass it as a top-level field of the request body (not inside args).
Rules:
camping-research,
phone-compare.group_title is the human-readable label shown on the group in the browser. Pass the same
value on every navigate in the session: each navigate re-applies the label, so a call
without it resets the title to agent:<session>.awb groups, or list_tabs and read each tab's groupTitle). If a group for this task
already exists (agent:<session>), reuse that exact session name instead of starting a new
one. The daemon already re-joins a group by session name across service-worker restarts —
fragmentation comes from the caller picking a new name, not from the fleet.probe-x, probe-y, …) scatters the work across many groups — and orphans them if a worker
crashes mid-run. (One task = one group still holds, no matter how many workers.)close_session
when done and on error/early-exit paths. List strays with awb groups and prune any with
awb close <session> (the name shown after agent:).# First tab of the task: set session + human-readable label
curl -s -X POST http://127.0.0.1:10086/command \
-d '{"action":"navigate","args":{"url":"https://www.google.com/search?q=tents","newTab":true,"group_title":"Camping gear research"},"session":"camping-research","profile":"Work"}'
# Another SITE, SAME task → same session → joins the same group automatically
curl -s -X POST http://127.0.0.1:10086/command \
-d '{"action":"navigate","args":{"url":"https://www.example.com/search?q=tents","newTab":true},"session":"camping-research","profile":"Work"}'
# Every later command carries the same session
curl -s -X POST http://127.0.0.1:10086/command \
-d '{"action":"snapshot","args":{},"session":"camping-research","profile":"Work"}'
When the task is finished and the user no longer needs these pages, close_session clears the
whole group. If they might want to look further, deliver your answer first and leave the tabs
open — closing too eagerly throws away work the user can still see.
The daemon writes the image to disk and returns {format, path, sizeBytes, mimeType} — never
base64, since the model can't read raw image bytes. Take the .path and open it with the Read
tool to actually see it.
# Default: PNG of the visible viewport, daemon picks a temp path
curl ... -d '{"action":"screenshot","args":{}}'
# Options (each independent): JPEG quality, element-only via @e/CSS selector, custom output path
curl ... -d '{"action":"screenshot","args":{"format":"jpeg","quality":60}}'
curl ... -d '{"action":"screenshot","args":{"selector":"@e123"}}'
A caller-supplied path is honored verbatim (parent dirs created, existing file overwritten) —
use a unique name to avoid clobbering. save_as_pdf follows the same rule.
snapshot returns interactive elements with stable @e refs based on semantic role/name.
Use them directly with click/fill — they survive CSS class hash changes that break
manually-written selectors.
Fall back to evaluate (JS) only when:
@e ref in the snapshothref)JSON.stringify(data) — never add null, 2 formatting. Indentation and
newlines can inflate the response several times over, causing truncation during transmission.evaluate calls share the page's JS realm — re-declaring the same const/let across two
calls throws SyntaxError. Wrap in an IIFE for a fresh scope:
(() => { const x = ...; return x; })().fillfill handles native inputs and contenteditable. Pass selector (CSS or @e ref) + value:
| Target | What fill does | Returned mode |
|---|---|---|
<input> / <textarea> | Sets .value via native setter, fires input/change. | "value" |
[contenteditable] (ProseMirror / TipTap / Lexical / Slate / Quill etc.) | Focuses, selects all existing content, calls document.execCommand('insertText', ...) which fires beforeinput/input with inputType:'insertText' and data:value. | "contenteditable" |
| Other element | Best-effort .value + events. | "value" |
fill is clear-and-insert: existing content is replaced. For "append to existing text", read
the current value via evaluate, concatenate, then fill with the result.
There's no separate "press Enter" tool. To submit a form, click the submit button directly (its
@e ref or selector). To dispatch a key event programmatically (e.g. Escape to close a modal):
{"action":"evaluate","args":{"code":"document.activeElement.dispatchEvent(new KeyboardEvent('keydown',{key:'Escape',bubbles:true}))"}}
save_as_pdf renders the current page to PDF and returns the file path. All args optional:
paper_format: letter (default) | a4 | legal | a3 | tabloidlandscape: false (default)scale: 1.0 (default), range [0.1, 2.0]print_background: true (default) — keep background colorspath: caller-supplied output path; if absent, daemon picks a default under OS temp dir using
the page title as the filenamepath semantics match screenshot: written verbatim, parent dirs auto-created, existing files
overwritten.
Agent WebBridge is battle-tested in real-world agent workflows across Claude Code, Gemini CLI, Qwen Code, Cursor, Windsurf, and DeepSeek.
Downloadable standalone client implementations are available in docs/skill/:
docs/skill/awb_client.py): Zero pip dependencies (uses standard urllib.request). Auto-pins _tabId to prevent focus drift.docs/skill/awb-client.mjs): Zero external dependencies (uses standard fetch). Auto-tracks active tab IDs.Instead of scraping HTML, navigate to the target domain and fire fetch() inside the active tab via evaluate. The browser automatically includes all ambient cookies, session tokens, and CORS headers:
cmd '{"action":"evaluate","args":{"code":"(async()=>{ const res = await fetch(\"/api/v1/protected/data\"); return await res.json(); })()"},"session":"harvest","profile":"Work"}'
Extract pre-rendered structured state directly from memory before client-side hydration or after route transitions:
window.__NEXT_DATA__.props.pagePropswindow.__INITIAL_STATE__Array.from(document.querySelectorAll(\'script[type=\"application/ld+json\"]\')).map(e=>JSON.parse(e.textContent))For React and Vue inputs where standard input.value = ... gets wiped on subsequent render cycles:
const setReactInput = (el, val) => {
const proto = el.tagName === 'TEXTAREA' ? HTMLTextAreaElement.prototype : HTMLInputElement.prototype;
const setter = Object.getOwnPropertyDescriptor(proto, 'value').set;
el.focus();
setter.call(el, val);
el.dispatchEvent(new Event('input', { bubbles: true }));
el.dispatchEvent(new Event('change', { bubbles: true }));
};
DraftJS editors (such as Twitter/X and modern rich editors) update selection asynchronously via selectionchange. To avoid appending or duplicating text: select all content (which implicitly focuses), wait 100ms for internal model synchronization, then invoke insertText without re-focusing.
When automating actions in sensitive accounts, monitor pages after write actions for security triggers ("verify it's you", "unusual activity", "account suspended"). If detected, write a local state/HALT lockfile and immediately abort all execution until human inspection.
event.isTrusted (some banking portals, captcha challenges)
reject fill and click because both go through DOM-level synthetic events
(isTrusted=false). This is a product boundary, not a bug.fill, click, evaluate, and snapshot operate on the top frame.
If a target element lives in a same-page iframe from a different origin, navigate to the
iframe's URL directly instead.AWB_CHROME_BIN / AWB_CHROME_DIR for non-standard installs. Linux is wired but untested.:10086 is reserved for the router — it is never assigned to a profile.127.0.0.1 daemon you run. No remote
server is ever contacted, no analytics, no account.>=18.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub jeet-dhandha/agent-webbridge --plugin agent-webbridgeOther plugins' skills for the same job