@53able/pi-agent-browser
Typed Pi tools for browser automation, rendered-page context extraction, screenshots, and saved session state via agent-browser.
Package details
Install @53able/pi-agent-browser from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@53able/pi-agent-browser- Package
@53able/pi-agent-browser- Version
0.6.1- Published
- Jul 28, 2026
- Downloads
- 201/mo · 201/wk
- Author
- 53able
- License
- MIT
- Types
- extension, skill
- Size
- 98.6 KB
- Dependencies
- 0 dependencies · 3 peers
Pi manifest JSON
{
"extensions": [
"./index.ts"
],
"skills": [
"./skills"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
pi-agent-browser
English | 日本語
Typed browser automation tools for Pi, powered by agent-browser.
Use this package when Pi needs to operate real web pages, extract rendered context, keep login sessions, or capture visual evidence without falling back to ad-hoc shell commands.
What you get
- Rendered-page context extraction — read text from public pages or the active authenticated browser tab.
- Reliable interaction handles — use accessibility snapshots with stable
@reftargets for clicks and form fills. - Evidence capture — save screenshots and extracted text to predictable artifact paths.
- Session persistence — reuse login state with named
agent-browsersessions and restore support. - Safer browsing controls — constrain work with
allowedDomains,maxOutput, and explicit state management. - Typed Pi tools — each browser action has its own schema instead of one free-form command string.
Requirements
- Pi / Feynman runtime with package support
agent-browserinstalled and available onPATH- Chrome for Testing installed through
agent-browser install
Check your local setup:
agent-browser doctor
If agent-browser is installed outside PATH, set:
export AGENT_BROWSER_BIN=/absolute/path/to/agent-browser
Installation
Install from npm:
pi install npm:@53able/pi-agent-browser
Install from GitHub:
pi install https://github.com/53able/pi-agent-browser
Install from a local checkout:
git clone https://github.com/53able/pi-agent-browser.git
pi install ./pi-agent-browser
Registered tools
agent_browser_open— open a URL or launchabout:blankagent_browser_read— extract text or JSON from a URL or active rendered tabagent_browser_snapshot— get accessibility tree refs for interactionagent_browser_click— click by@refor CSS selectoragent_browser_fill— fill an input by@refor CSS selectoragent_browser_screenshot— capture screenshots to diskagent_browser_eval— evaluate JavaScript in the active tabagent_browser_state— save, load, list, show, rename, clear, or clean saved stateagent_browser_close— close a browser sessionagent_browser_handoff— pause and hand control to a human for 2FA, CAPTCHA, or identity verificationagent_browser_login_handoff— spawn an unattended browser for interactive login flows (Google, OAuth)agent_browser_commit— confirmation gate for irreversible actions (payment, delete, publish, send)agent_browser_doctor— runagent-browser doctor
Common workflows
Read a page and save the extracted source
Ask Pi:
Read https://example.com through the browser and save the extracted text to outputs/browser/example.md.
Equivalent agent_browser_read arguments:
{
"url": "https://example.com",
"outputPath": "outputs/browser/example.md",
"allowedDomains": ["example.com"]
}
Interact with a rendered page
- Open the page.
{
"url": "https://example.com",
"session": "research-example",
"allowedDomains": ["example.com"]
}
- Call
agent_browser_snapshotto get fresh@refvalues. - Use
agent_browser_clickoragent_browser_fillwith those refs. - Call
agent_browser_readfor text oragent_browser_screenshotfor visual evidence. - Close the session with
agent_browser_closewhen finished.
Keep login state across runs
Use a stable session name and restore: true:
{
"url": "https://example.com",
"session": "work-example",
"restore": true,
"headed": true
}
After logging in once, future opens with the same session and restore can reuse saved browser state.
Inspect or clear saved state
List saved states:
{
"operation": "list"
}
Clear one saved session state:
{
"operation": "clear",
"sessionName": "work-example"
}
Clear all saved states only when intentionally resetting everything:
{
"operation": "clear",
"all": true
}
Safety guidance
- Pass
allowedDomainswhenever the browsing scope is known. - Use
outputPathwhen extracted content supports a report, audit, or later verification. - Take a fresh snapshot after navigation, form submission, modal dismissal, or a failed click.
- Prefer
agent_browser_readfor textual evidence andagent_browser_screenshotfor visual evidence. - Use
agent_browser_evalonly whenreadorsnapshotcannot expose the required state. - Review saved browser state before clearing broadly.
Human handoff
Not every step should run unattended. Three tools hand control back to a human at the right moments:
- Safe boundaries —
agent_browser_handoffpauses the agent for steps it cannot or should not perform itself: 2FA/OTP entry, CAPTCHA, identity verification. It captures a screenshot for context, then blocks on a real confirmation dialog until a human resumes or aborts.agent_browser_readandagent_browser_snapshotalso run a lightweight keyword scan and flag likely checkpoints in their output as a nudge to call this tool. - Interactive login flows —
agent_browser_login_handoffsolves the problem that Google, OAuth, and similar providers block sign-in when agent-browser is used, because automation detection happens during the login step itself. This tool spawns an unattended Chrome process (with no CDP attached) so the human can log in normally. After login succeeds, the still-running browser is live-attached to the named session and kept open as the permanent backing browser—it remains visible on screen with an open remote-debugging port until closed withagent_browser_close. Use this instead ofagent_browser_openwhenever a task is expected to hit an interactive Google or OAuth sign-in flow. Agents should callagent_browser_closeas soon as the session is no longer needed, rather than leaving the debugging port open indefinitely. - Stop before commit —
agent_browser_commitis a dedicated gate for irreversible actions: payment, deletion, publishing, sending. It captures evidence, requires explicit human confirmation before clicking, and refuses outright (without clicking) if no interactive UI is available to ask. Use it instead ofagent_browser_clickfor the final confirming step of any such action.
All three tools require an interactive session (TUI or RPC with UI support); in headless/unattended runs they refuse rather than proceed silently.
agent_browser_open remembers whether each named session was launched with headed: true. If agent_browser_handoff is called for a session that was not opened headed, it automatically warns the human and includes the exact agent_browser_open arguments (session name, headed: true, restore: true, and the last known URL) needed to reopen a visible window — no more guessing which command to rerun. Prefer headed: true up front for any task that might hit a login, 2FA, CAPTCHA, or identity-verification step, since some challenges are single-use and reopening mid-flow may require restarting the login. agent_browser_login_handoff records the resulting session as headed: true (since the login browser is visible and running); you don't need to reopen it to see it.
Troubleshooting
Run:
agent-browser doctor
Or ask Pi to run agent_browser_doctor. This verifies installation, Chrome, daemon, security, providers, network, and launch tests. It also reports any live login-handoff browsers left open and cleans up stale tracking entries.
If you have sessions created with agent_browser_login_handoff, agent_browser_doctor will report any that still have live login browsers running, showing the session name, process ID, debugging port, and last known URL. Call agent_browser_close for each session when done — these hold an open remote-debugging port until closed. Stale entries (tracking data for processes no longer running) are cleaned up automatically with no notification. agent_browser_login_handoff itself also names any other sessions still running a live login browser in its success message, so you notice without a separate agent_browser_doctor call.
Common fixes:
npm install -g agent-browser
agent-browser install
Project history
If you maintain or contribute to this package, read the project history in English or Japanese for the package-name decision, npm Trusted Publishing setup, and semantic-release workflow.
Release automation
Releases are automated with semantic-release. Maintainers merge Conventional Commits into main; GitHub Actions runs npx semantic-release@25, determines the next version, publishes to npm through Trusted Publishing, creates the Git tag, and writes the GitHub Release.
Commit message examples:
fix: handle empty snapshot output→ patch releasefeat: add browser state export tool→ minor releasefeat!: rename tool argumentsorBREAKING CHANGE:→ major release
The npm Trusted Publisher should continue to point at .github/workflows/publish.yml. No long-lived NPM_TOKEN is required.
License
MIT