pi-agent-browser-native0.9.60
Fast, thin Pi extension exposing native agent-browser with persistent shared auth and Exa/Brave web search
Reported broken on omp
1 of 1 report says this package does not work on omp. Read the notes before you install it.
0 works1 broken
Reports 1
- brokenTested by omp packages
Tested on omp 19.4.1: `omp plugin install` fails. Error: pi-agent-browser-native/dist/extensions/agent-browser/index.js imports "@earendil-works/pi-tui", which omp no longer provides: its component API was replaced by the reactive @oh-my-pi/pi-tui. Return pi-tui nodes (JSX from "@oh-my-pi/pi-tui") or a { render(width): string[] } rows object from renderers, ctx.ui.custom and ctx.ui.setWidget; replace ctx.ui.setEditorComponent with the ctx.ui.composer hooks; import Theme types from "@oh-my-pi/pi-
Readme
pi-agent-browser-native
Native Pi integration for agent-browser, plus an optional Exa/Brave companion web-search tool.
- Thin native passthrough: Passes your
argsdirectly toagent-browser --jsonwith zero hidden probes, zero wrapper-owned command blocks, and zero runtime npm dependencies. - Persistent shared browser auth: All Pi sessions and subagents share one persistent headless Brave, Google Chrome, or unconfined Chromium browser (auto-detected on macOS and Linux, skipping snap-confined shims and falling back to
agent-browser's installed Chromium) in an isolated profile (~/.pi/agent-browser/profile). Each Pi root session gets its own private pinned tab over CDP (--cdp --pin-tab --idle-timeout 1800000) and its spawned subagents share that pinned tab, so logins persist across sessions and restarts without corrupting your personal desktop browser profile. - Native screenshots & structured outputs: Screenshots attach directly as images,
outputPathwrites full results to disk, large outputs truncate via Pi's built-intruncateHead(DEFAULT_MAX_BYTES/DEFAULT_MAX_LINES) and spill cleanly to disk, sensitive tokens/cookies are redacted from model-visible output, andstructuredContentworks cleanly in Pi codemode. - Optional Exa
deepweb search: When an Exa or Brave API key is configured,agent_browser_web_searchprovides Exadeep(with free cited synthesis),deep-lite,auto, andlitesearch, with Brave fallback.
Requirements
- Platforms: Apple Silicon macOS (
darwin) and Linux (linux) - Node.js:
^24.22.3 || >=26.13.1 - Pi:
>=1.8.0 agent-browser:>=0.45.0installed separately onPATH(npm install -g agent-browser && agent-browser install)
Install
pi install npm:pi-agent-browser-native
Verify prerequisites or inspect active config and shared browser state at any time (or run pi-agent-browser-doctor / pi-agent-browser status directly when also installed via npm install -g pi-agent-browser-native):
npx --package pi-agent-browser-native pi-agent-browser-doctor
npx --package pi-agent-browser-native pi-agent-browser status
Shared Persistent Auth
By default (browser.mode: "shared"), agent_browser maintains one long-lived persistent browser (pi-shared-browser) backed by unconfined Brave, Google Chrome, or Chromium (auto-detected on macOS and Linux, skipping snap-confined Linux shims such as Ubuntu's chromium-browser snap that cannot read hidden ~/.pi profiles, and falling back to agent-browser's installed Chromium) with an isolated profile at ~/.pi/agent-browser/profile. To use a specific browser binary, set browser.executablePath.
- Sign in once (when an unconfined local Brave, Google Chrome, or Chromium is available with default
browser.idleTimeoutMs: 0and no authenticated proxy,/browser-authopens a clean interactive browser with no--remote-debugging-port, no automation flags, and the real OS keychain so Google Sign-In, Passkeys/Touch ID, Cloudflare, and Okta work normally):- Inside Pi:
/browser-auth https://accounts.google.com - From terminal:
npx --package pi-agent-browser-native pi-agent-browser auth https://accounts.google.com(orpi-agent-browser auth …if installed globally vianpm install -g pi-agent-browser-native) - When you finish signing in, quit that browser window (
Cmd+Q) or run/browser-auth --headlessso agents can attach to the saved profile in headless mode.
- Inside Pi:
- Every Pi session & subagent reuses that auth automatically:
- With an unconfined local browser,
browser.idleTimeoutMs: 0, and no authenticated proxy,/browser-authlaunches cleanly with the real OS keychain and the persistent headless host launches directly on the same profile with the real OS keychain and--disable-blink-features=AutomationControlled, so cookies,localStorage, andIndexedDBsaved during sign-in decrypt and survive restarts. If no unconfined local browser is found, or ifbrowser.idleTimeoutMs > 0or an authenticated proxy is configured, both/browser-authand the shared host delegate toagent-browser(CDP + mock keychain, which Google Sign-In may reject) so sign-in and headless attach still share one consistent keychain mode. - Each Pi root session attaches in its own isolated pinned tab (
--session pi-root-<20-hex> --cdp <port> --pin-tab --idle-timeout 1800000), and subagents spawned by that root session share its pinned tab. The attached daemon disconnects after 30 idle minutes. Returning to the same live host reuses the tab. Reloading or restarting Pi keeps it; the last owner to quit closes the recorded tab without closing the shared browser. - Closing an agent session closes only its own tab — the shared browser stays running.
- Non-headed
agent_browsercalls (including--auto-connectand--cdpagainst a live headed browser) defaultAGENT_BROWSER_BACKGROUND=1soagent-browserbuilds with background-mode support avoid stealing desktop focus (ignored byagent-browser0.45.0). SetAGENT_BROWSER_BACKGROUND=0in the environment to opt out across all versions.
- With an unconfined local browser,
- Need a clean unauthenticated run or direct upstream launch?
- Pass
sessionMode: "fresh"on eachagent_browsercall that uses the isolated browser. The same Pi root session reuses that browser until you close it or Pi shuts down. After closing, the next fresh call starts a new browser. - Passing launch-conflicting flags (
--state,--allowed-domains, non-Chrome--engine, custom--profile,--cdp,--auto-connect,--headed,--relaunch, or an explicit--session) bypasses the shared host and routes directly to upstream with the flags you supplied (not necessarily unauthenticated when pointing at an existing profile, state, or CDP endpoint).
- Pass
- Multiple auth profiles (for example work vs personal):
- Pass
profile: "work"onagent_browser, run/browser-auth --profile work https://..., or setbrowser.sharedProfile(npx --package pi-agent-browser-native pi-agent-browser set browser.sharedProfile work). - To keep shared logins, omit
--sessionand--profilefrom the tool'sargs. Usetab newto open another tab in the shared browser.
- Pass
- Desktop profile safety:
- The extension refuses to open live desktop Brave or Chrome user-data directories in-place to prevent profile corruption.
Using agent_browser
Pass raw agent-browser CLI tokens in args (omit the agent-browser binary name). Multi-line JavaScript and batch JSON arrays go in stdin.
{ "args": ["open", "https://example.com"] }
{ "args": ["snapshot", "-i"] }
{
"args": ["batch", "--bail"],
"stdin": "[[\"open\",\"https://example.com\"],[\"snapshot\",\"-i\"],[\"click\",\"@e2\"]]"
}
{
"args": ["eval", "--stdin"],
"stdin": "document.title"
}
{
"args": ["screenshot", "--full"],
"outputPath": "/tmp/page-snapshot.json"
}
For the full agent-browser CLI surface, run agent_browser with args: ["--help"] or args: ["<command>", "--help"].
Optional Web Search (agent_browser_web_search)
When EXA_API_KEY (recommended) or BRAVE_API_KEY is available — via environment variables or package config — Pi automatically registers agent_browser_web_search.
Mode (searchType) |
Best for | Typical latency | Approx. Exa cost |
|---|---|---|---|
deep (default) |
Multi-step research + cited ## Synthesis |
~4–15 s | $0.012 |
deep-lite |
Fast single-pass synthesis for focused docs/APIs | ~2–4 s | $0.012 |
auto |
Quick ranked URLs & highlights without synthesis | ~1 s | $0.007 |
lite |
Instant cache-only factual lookups | ~0.25 s | $0.004 |
Brave is used automatically when only BRAVE_API_KEY is configured or when provider: "brave" is passed. Brave's 1.1 s rate limiter applies only to Brave and never throttles parallel Exa calls. Search-provider HTTP failures report deterministic status-based hints without echoing raw provider response bodies.
Configuration CLI (pi-agent-browser)
After pi install npm:pi-agent-browser-native, invoke the CLI with npx --package pi-agent-browser-native pi-agent-browser … (or install globally with npm install -g pi-agent-browser-native to put pi-agent-browser and pi-agent-browser-doctor on PATH):
npx --package pi-agent-browser-native pi-agent-browser status
npx --package pi-agent-browser-native pi-agent-browser auth [url] [--profile <name>] [--headless]
npx --package pi-agent-browser-native pi-agent-browser set browser.mode shared
npx --package pi-agent-browser-native pi-agent-browser set browser.sharedProfile work
npx --package pi-agent-browser-native pi-agent-browser set webSearch.exaApiKey '$EXA_API_KEY'
npx --package pi-agent-browser-native pi-agent-browser set webSearch.defaultSearchType deep
npx --package pi-agent-browser-native pi-agent-browser unset browser.executablePath
Add --project to write to .pi/config/pi-agent-browser-native/config.json instead of the global ~/.pi/config/pi-agent-browser-native/config.json.
Reference Docs
docs/TOOL_CONTRACT.md— Tool parameters, outputs, session routing, redaction, and spill behavior.docs/CONFIGURATION.md— Config layers, secret resolution, browser modes, and CLI options.AGENTS.md— Maintainer architecture, verification commands, and dogfood workflow.