Agent Browser Relay lets an AI agent read and inspect a Chrome tab that you explicitly attach. It keeps the agent inside your real browser session without giving it control of random windows or a separate automation profile.
Use it when an agent needs page text, links, DOM, screenshots, or selected browser context from authenticated pages.
- A Chrome or Chromium extension lets you attach the tab you want the agent to use.
- A local relay runs on
127.0.0.1:18793. - One relay port can keep multiple browser/profile extension clients connected at once.
- The agent calls the relay with a specific
--tab-idor browser-scoped--tab-ref. - The relay reads only that attached tab and returns JSON.
The important safety rule is simple: no attached tab, no read.
- Google Chrome or another Chromium browser that can load unpacked extensions
- Node.js 20 or newer
pnpm- macOS or Linux for the global background relay service
Install from GitHub with skills:
npx skills add Mindgames/Agent-browser-relay -g -yOr work from a local checkout:
git clone https://github.com/Mindgames/Agent-browser-relay.git
cd Agent-browser-relay
pnpm installPrint the exact extension and CLI paths:
pnpm extension:path- Open
chrome://extensions. - Enable Developer mode.
- Click Load unpacked.
- Select the
extensionfolder printed bypnpm extension:path. - Pin Agent Browser Relay in the Chrome toolbar.
Common extension paths:
~/.agents/skills/agent-browser-relay/extension
~/.agents/skills/private/agent-browser-relay/extension
<local checkout>/extension
On macOS, press Command+Shift+G in the file picker to paste hidden paths like ~/.agents/....
Recommended always-on service:
pnpm relay:global:install -- --ports 18793 --timeout 12000
pnpm relay:global:statusOne-off foreground/fallback mode:
pnpm relay:startCheck that Chrome has loaded and connected the extension:
pnpm extension:status -- --wait-for-connected --connected-timeout-ms 120000- Open the target page in Chrome, Brave, Edge, or another Chromium browser.
- Click the Agent Browser Relay toolbar icon.
- Click Attach this tab.
- Confirm the badge shows
ON. - Copy the tab id from the popup, or get the tab id / tab ref from:
pnpm relay:status -- --all --status-timeout-ms 3000Replace <TAB_ID> with the attached tab id. If more than one browser is connected and tab ids collide, use <TAB_REF> from relay:status instead. A tab ref is browserId:tabId.
Run the readiness check first:
pnpm relay:doctor -- --host "127.0.0.1" --port "18793" --tab-id "<TAB_ID>" --jsonOr target a specific browser tab ref:
pnpm relay:doctor -- --host "127.0.0.1" --port "18793" --tab-ref "<TAB_REF>" --jsonRead the default page payload:
node scripts/read-active-tab.js \
--host "127.0.0.1" \
--port "18793" \
--tab-id "<TAB_ID>" \
--pretty falseFor duplicate tab ids across browsers:
node scripts/read-active-tab.js \
--host "127.0.0.1" \
--port "18793" \
--tab-ref "<TAB_REF>" \
--pretty falseThe default payload includes:
urltitletextlinksmetaDescription
Read the full DOM:
node scripts/read-active-tab.js \
--host "127.0.0.1" \
--port "18793" \
--tab-id "<TAB_ID>" \
--expression "document.documentElement.outerHTML" \
--pretty falseTake a full-page screenshot:
node scripts/read-active-tab.js \
--host "127.0.0.1" \
--port "18793" \
--tab-id "<TAB_ID>" \
--screenshot \
--screenshot-full-page \
--screenshot-path "./tmp/page.png" \
--pretty falseFor long JavaScript expressions, prefer --expression-file or --expression-stdin instead of shell-quoted inline code.
Use Agent Browser Relay to read tab 4581930 and summarize the page.
The agent should:
- Check relay status.
- Confirm the requested tab is attached.
- Run
relay:doctorfor that--tab-idor--tab-ref. - Read only that tab.
Agents must use the local relay gateway only:
/statuspnpm relay:status -- --all --status-timeout-ms 3000pnpm relay:doctor -- --tab-id "<TAB_ID>" --jsonpnpm relay:doctor -- --tab-ref "<TAB_REF>" --jsonnode scripts/read-active-tab.js --tab-id "<TAB_ID>"node scripts/read-active-tab.js --tab-ref "<TAB_REF>"
Agents must not use Playwright, Puppeteer, Selenium, ad-hoc Chrome scripts, or a random Chrome profile for this workflow.
If a page shows CAPTCHA or human verification, the agent must stop and wait for the human.
These script names are stable for automation. The npm run ... form is still documented because some agent instructions match exact command names, but this repo prefers pnpm.
npm run extension:path
npm run extension:status
npm run relay:global:install
npm run relay:global:status
npm run relay:global:start
npm run relay:global:stop
npm run relay:start
npm run relay:status
npm run relay:doctor
npm run relay:stop
node scripts/read-active-tab.jsRelay is not connected:
pnpm relay:status -- --status-timeout-ms 3000
pnpm extension:status -- --wait-for-connected --connected-timeout-ms 120000Tab is not attached:
- Focus the tab in Chrome.
- Open the extension popup.
- Click Attach this tab again.
- Re-run
pnpm relay:doctor -- --tab-id "<TAB_ID>" --jsonorpnpm relay:doctor -- --tab-ref "<TAB_REF>" --json.
Another agent has the tab lease:
pnpm relay:status -- --all --status-timeout-ms 3000Choose another attached tab or wait for the current lease to release. Do not force takeover.
Need a new background tab:
- Enable Allow agent to create new background tabs in the extension popup.
- Check readiness:
pnpm relay:doctor -- --host "127.0.0.1" --port "18793" --require-target-create --jsonInstall dependencies:
pnpm installRun checks:
pnpm lint
pnpm build
pnpm testProject layout:
extension/ Chrome extension
relay-server.js Local relay server
scripts/read-active-tab.js Tab read/check CLI
scripts/relay-manager.js Relay lifecycle and doctor checks
scripts/relay-service.js Global service install/start/stop
SKILL.md Agent Browser Relay skill instructions
AGENTS.md Required agent operating contract
Agent Browser Relay is open source under the MIT License.
The full license is also available in LICENSE.
MIT License
Copyright (c) 2026 Mathias Asberg
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.