Skip to content

About

Open-source AI agent for Chrome — a fully evolved Nanobrowser with external agent integration (OpenCode V1/V2 direct chat, SubAgent delegation, dynamic browser MCP), live streaming UI, and credential-safe model import.

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

403 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BrowserAgent logo

BrowserAgent

The open-source browser agent with built-in and compatible external engines.
A fully evolved fork of Nanobrowser — with external agent integration, live streaming UI, and safe credential handling.

English | 简体中文

What it does · vs Nanobrowser · Architecture · Install · External agents · Privacy & security


🧭 What BrowserAgent does

BrowserAgent is an AI agent that lives in a Chrome side panel and operates the browser for you: it reads pages, clicks, types, fills forms and moves between tabs. You watch every step; consequential actions ask first.

What makes it different from other browser agents is where the intelligence comes from:

  1. Built-in agent — connect your own model provider (OpenAI-compatible, Anthropic, Google, Bedrock) and BrowserAgent drives the browser on its own.
  2. External agents, directly — connect a local OpenCode V1 or V2 service and chat with it in the panel. The agent keeps its native tools (files, shell, project work) while you keep the browser UI.
  3. External agents, as a SubAgent — the built-in agent can delegate a self-contained task to an external agent through the subagent tool, watch its reasoning, tool calls and answers stream live, and use the result to continue the browser work.
  4. The browser, handed over — with a V2 service that speaks the client-MCP protocol, BrowserAgent registers its browser tools with the external agent for the run. The external agent clicks and reads pages directly, through the same permission-guarded layer the built-in agent uses.
flowchart LR
  U[User] --> P[Side panel]
  P --> RM[Run manager]
  RM --> B[Built-in agent]
  B --> M[Model provider]
  B --> L[Browser-control layer]
  L --> C[Chrome / Edge pages]
  RM --> V1[OpenCode V1 service]
  RM --> V2[OpenCode V2 service]
  V2 -- client MCP: browser tools --> L
  B -- subagent tool --> V1
  B -- subagent tool --> V2
Loading

Future candidates — Claude Code, Codex, OpenClaw, Hermes Agent — are on the roadmap, not implemented.

🚀 Why not just Nanobrowser?

BrowserAgent started as Nanobrowser and kept its best parts (the side panel, the permission model, the deterministic browser-control layer). Then it grew:

Area Nanobrowser BrowserAgent
Intelligence Built-in model providers only Built-in plus external OpenCode V1/V2 agents — direct chat and delegated subagents
Browser access for external agents None V2 agents get BrowserAgent's browser tools through a dynamically registered client-MCP connection, scoped per session
Model setup Manual per-provider entry Models auto-import from a connected external agent (provider, model, credentials), deduplicated by endpoint and key
Credentials Plain storage Imported provider keys and service passwords are bound to their endpoint; redirects are refused and errors are sanitized
Streaming UI Text after the turn Live reasoning folds, tool activity, SubAgent message bubbles (user task, assistant answers, tool states), elapsed time and tool-call counts — per message
Conversation continuity One loop Engine sessions reused per conversation; context usage and per-message token/TTFT/throughput stats
SubAgent visibility — A SubAgent card with engine label, live progress, failure cause with candidate models, and safe resume after verification

The full list of changes is in CHANGELOG-style summary below; the code is Apache-2.0, same as upstream.

🏗 Architecture

  • src/browser-control/ — the deterministic layer that observes and acts on pages via chrome.debugger + Puppeteer frame tracking. No LLM inside; refs fail closed.
  • src/agent/ — the built-in agent loop: one loop per conversation, context compaction, guards, the subagent tool.
  • src/extension/ — the worker wiring: run manager, permission bridge, SubAgent executor, session state, external engines (V1/V2).
  • src/opencode-v1/, src/opencode-v2/ — HTTP/SSE clients for the external services.
  • src/llm/ — model providers, credential resolution, streaming.
  • src/side-panel/, src/options/ — the panel and settings UI, three languages.

The browser-control layer uses one identity per action, fails closed on invalid refs, and retries before dispatch. Page-content boundaries and agent instructions help distinguish page data from instructions, but do not eliminate prompt-injection risk.

🛠 Install

Chrome or Edge, from source (a Web Store listing is planned):

git clone https://github.com/holny/browser-agent.git
cd browser-agent
pnpm install && pnpm build

Then in Chrome: chrome://extensions → enable Developer mode → Load unpacked → pick dist/. Keep the folder in one place: the extension ID is derived from its path.

🔌 Quick start

  1. Open the side panel (toolbar icon or Alt+Shift+N).
  2. Either add a model provider in Settings → Providers, or connect an external agent (below).
  3. Type a task. Watch the agent work; approve the steps that matter.

🤝 Connect an external agent

Settings → Agents → Add. Both OpenCode generations work:

  • V2 (recommended): a running service that speaks the session, event-stream and client-MCP APIs. BrowserAgent attaches its browser tools to the agent's sessions for the run. Requires a service build with the experimental client-MCP endpoint — check the service's docs before assuming a stock release works.
  • V1: a running service with sessions, events and per-model endpoints. Direct chat uses the service's own project tools; it does not receive browser tools. V1 keep-alive heartbeats keep the service from idling out.

Both support: HTTP Basic service auth, model import into the built-in provider list, per-agent SubAgent defaults (agent and model), and the shared project directory.

🧙 SubAgent delegation

Ask the built-in agent to hand a task to an external agent — summarize a long page, write findings to a file, verify a URL — and the SubAgent card shows the task, the engine, live reasoning and tool activity. On failure the card returns the cause, the failing provider/model, and candidate models; the main agent picks a different model explicitly after verifying no side effects. Unfinished child sessions can be resumed after verification; never blindly retried.

🔒 Privacy & security

  • Page content is marked with boundaries and the agent is instructed to treat it as data; these mitigations cannot guarantee protection from prompt injection.
  • Keys and service passwords live in chrome.storage.local. Imported provider keys and service passwords are bound to their destination; manually configured provider keys are not. A person with access to your browser profile can read them.
  • Consequential browser actions (submit, send, delete, upload) ask in Ask mode; payments, password and one-time-code steps are always yours. Detection is best-effort; enforcement is strict.
  • Telemetry is disabled in this build, including self-builds with a configured PostHog host and key.

Details: PRIVACY.md and SECURITY.md.

🧪 Development

pnpm test          # unit tests
pnpm lint          # ESLint incl. import rules
pnpm type-check    # TypeScript
pnpm build         # build the extension
pnpm fixtures      # local fixture server (port 8787)
pnpm autorun <check>[,<check>…]   # browser checks in Chrome for Testing

Node 24 LTS, pnpm 10.34.7, WXT 0.21.4. Contributing: CONTRIBUTING.md.

📦 What's inside (the short list)

  • Direct V1/V2 conversations with session reuse, reasoning streams, tool cards and per-message stats
  • SubAgent tool with live child conversation, engine label, elapsed/tool-call metrics, failure diagnostics and safe resume
  • V2 client-MCP registration: browser tools scoped to the run's session
  • Model auto-import from external agents with endpoint-bound credentials and redirect/echo protection
  • External permission and question cards (V1) bridged into the panel
  • Shared project directory across agents, with reconnection reconciliation
  • Turn-wide answer copy, context usage bar, model pickers per agent kind

⚖️ License & attribution

Apache-2.0 — see LICENSE. BrowserAgent is an independent fork of Nanobrowser (Apache-2.0); its browser-control layer design and permission model build on that work. Puppeteer, the Vercel AI SDK and WXT do the heavy lifting underneath. "OpenCode" refers to the open-source project at github.com/sst/opencode; BrowserAgent is not affiliated with it.

🗺 Roadmap

  • Claude Code, Codex, OpenClaw, Hermes Agent adapters
  • Web Store listing
  • More locales

About

Open-source AI agent for Chrome — a fully evolved Nanobrowser with external agent integration (OpenCode V1/V2 direct chat, SubAgent delegation, dynamic browser MCP), live streaming UI, and credential-safe model import.

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages