agent-browser

mcp
Guvenlik Denetimi
Uyari
Health Uyari
  • License — License: MIT
  • Description — Repository has a description
  • Active repo — Last push 0 days ago
  • Low visibility — Only 8 GitHub stars
Code Uyari
  • process.env — Environment variable access in mini-services/browser-ws/index.ts
  • process.env — Environment variable access in scripts/build.mjs
Permissions Gecti
  • Permissions — No dangerous permissions requested

Bu listing icin henuz AI raporu yok.

SUMMARY

Give any AI agent a real browser. REST API + Web Dashboard + Vision AI. Control browsers via Playwright from OpenClaw, Hermes, or any LLM. Built with Next.js and TypeScript.

README.md
PagePane logo

PagePane

A self-hosted browser control service for AI agents.

Drive isolated Playwright sessions through a small REST API and a live dashboard.

Documentation · Quick start · API · Contributing

MIT License Node.js 20.9 or newer Playwright TypeScript


What it does

PagePane runs Playwright in a local Node.js service and gives an AI agent a browser it can inspect and control. The dashboard is useful for watching sessions and trying actions by hand; the REST API is the integration surface for agents and scripts.

  • Create isolated Chromium, Firefox, or WebKit browser contexts.
  • Navigate, click, type, scroll, take screenshots, and inspect page context.
  • Return a screenshot, simplified DOM, accessibility tree, and detected interactive elements.
  • Keep cookies and local storage in the local SQLite database and restore a closed session explicitly.
  • Review action history in the dashboard and through the API.

PagePane does not call an AI model. It provides browser controls and structured page data for an agent to use.

Quick start

Requirements

  • Node.js 20.9 or newer.
  • npm or Bun 1.3+.
  • Chromium is installed by the package post-install step. Install other Playwright browsers separately if you need them.

Install and run

git clone https://github.com/smouj/agent-browser.git
cd agent-browser
npm ci
cp .env.example .env
npm run db:push
npm run dev

Open http://127.0.0.1:3000. The development server binds to loopback by default.

Bun works too:

bun install
cp .env.example .env
bun run db:push
bun run dev

To run a production build:

npm run build
npm run start

Create a session

curl -X POST http://127.0.0.1:3000/api/browser/sessions \
  -H "Content-Type: application/json" \
  -d '{"name":"research","browserType":"chromium","headless":true}'

The response contains a session ID. Use it for actions and close the session when finished.

Security

By default, PagePane binds to 127.0.0.1 and rejects cross-origin browser requests. This keeps the service reachable only from the machine running it unless you change the bind address.

To make the service reachable from another machine, set a strong PAGEPANE_API_TOKEN and choose a bind address explicitly. Every API request then requires Authorization: Bearer <token>. The dashboard asks for the token and keeps it in that browser tab's session storage.

Edit .env to set PAGEPANE_HOST=0.0.0.0 and a long random PAGEPANE_API_TOKEN, then build and start the service. The server refuses a non-loopback bind without a token.

Treat the token as a password. Anyone who can use the API can control pages, read browser state, navigate to network resources accessible from the host, and run JavaScript in a page. Browser cookies and local storage are persisted in the SQLite database without encryption; protect the data directory and database file accordingly. PagePane is designed as a single-user, self-hosted service, not a multi-tenant hosted API.

Configuration

Copy .env.example to .env to configure the service. The main settings are:

Variable Default Purpose
DATABASE_URL file:./agentbrowser.db SQLite database path, relative to prisma/schema.prisma
PORT 3000 HTTP port
PAGEPANE_PUBLIC_URL http://127.0.0.1:3000 Public base URL used for Open Graph and Twitter metadata; set this to the deployed URL before building
PAGEPANE_HOST 127.0.0.1 Bind address
PAGEPANE_API_TOKEN empty Require a bearer token on API requests
PAGEPANE_DATA_DIR .pagepane Directory for browser session files
DEFAULT_BROWSER_TYPE chromium Default browser engine
DEFAULT_HEADLESS true Default headless setting
DEFAULT_VIEWPORT_WIDTH 1280 Default viewport width
DEFAULT_VIEWPORT_HEIGHT 720 Default viewport height
SESSION_TIMEOUT_MS 3600000 Close sessions after this much inactivity
MAX_CONCURRENT_SESSIONS 10 Maximum active sessions in one process
PLAYWRIGHT_DISABLE_SANDBOX false Set to true only when the host cannot run Chromium with its sandbox

If you choose Firefox or WebKit, install its matching browser binary:

npx playwright install firefox webkit

API

Base URL: http://127.0.0.1:3000. Responses use JSON. When PAGEPANE_API_TOKEN is set, send it as a bearer token on every API request.

Method Endpoint Purpose
POST /api/browser/sessions Create a session
GET /api/browser/sessions List sessions
GET /api/browser/sessions/:id Get session details
POST /api/browser/sessions/:id/restore Restore a closed session
POST /api/browser/sessions/:id/close Save state and close a session
DELETE /api/browser/sessions/:id Delete a session and its saved state
POST /api/browser/sessions/:id/action Run a browser action
POST /api/browser/sessions/:id/vision Capture page context
GET/POST /api/browser/sessions/:id/cookies Read or set cookies
GET /api/browser/sessions/:id/logs Read paginated action history

Example with a token:

curl http://127.0.0.1:3000/api/browser/sessions \
  -H "Authorization: Bearer $PAGEPANE_API_TOKEN"

See the action executor for the supported action names and options.

Session model and limitations

Browser pages and contexts are held in memory by one PagePane process. SQLite stores session records and saved state, but it does not share live browser contexts between processes. Run one server instance; horizontal replicas and serverless runtimes are not supported.

Sessions closed with the close endpoint, idle timeout, or graceful server shutdown can be restored with POST /api/browser/sessions/:id/restore. Restoration reloads the last HTTP(S) URL and the saved cookies and local storage. A forced process or machine crash may lose changes made since the last save. The inactivity timeout and concurrent-session cap are configurable. Action logs omit entered values and action result payloads; the logs endpoint also redacts historical target and result details.

The optional Socket.IO service in mini-services/browser-ws is experimental and separate from the dashboard and REST API. It is not started with the main application.

Development

npm ci
cp .env.example .env
npm run db:push
npm run lint
npm run typecheck
npm test
npm run build

Bun users can replace npm run with bun run. See CONTRIBUTING.md for development notes and pull request guidance.

License

MIT. See LICENSE.

Yorumlar (0)

Sonuc bulunamadi