Notes for coding agents and LLM tool builders
This file is written for AI agents (Cursor, Claude Code, Codex, custom MCP tools) that integrate or extend agent-browser-runtime.
What this package is, in one sentence
A runtime that lets software act inside a user's authenticated browser session, unattended, on infrastructure the operator controls, with explicit verification and re-auth signalling.
When to reach for it
- You need to perform actions on a website as a specific user, the site terms explicitly permit browser automation, and no supported API covers the action.
- The action must run later (cron, queue) without the user present.
- You need a safe outcome model: confirmed / uncertain / needs re-auth, so you never double-act.
When not to
- Scraping public pages (use a plain headless browser).
- Anything that violates the target site's terms or acts without the user's explicit instruction.
- Using a browser because an official API is metered, gated, or awaiting review; cost and access friction do not authorize UI automation.
- Billing, security challenges, identity checks, legal attestations, or exporting a session to another person/agent.
Integration recipe
- Implement a
WebPostStrategyfor the target site: declare a narrowpolicy.session, permitted execution modes,validate(content),isAuthenticated(ctx), andpost(ctx, content). Verify insidepost(read back the UI or find the permalink); returnuncertain: trueif you submitted but could not confirm. - Run the service:
startRunner({ strategies })oragent-browser-runtime serve --strategies ./strategies.jswithAGENT_RUNNER_TOKEN. - Capture once:
captureStartwithworkspaceId+accountId→ embed the short-livedliveViewUrl→ user signs in →captureFinishwith the same binding → encrypt and storestate. - Act unattended:
post/probewith the decrypted session; persistrefreshedSession; honourneedsReauthanduncertain.
Public API surface (stable)
@praveen-palanisamy/agent-browser-runtime— contracts (SessionStore,SessionProvider,WebPostStrategy,AgentSessionState,AgentPostResult),AgentPoster,SessionCaptureManager, providers,AgentRunnerClient, protocol types.…/client—AgentRunnerClient+ protocol only (no Playwright).…/service—startRunner,AgentRunner,loadConfig,createRunnerServer.- CLI
agent-browser-runtime—serve,health,probe,post;--localruns probe/post in-process (no service). Exit codes:0ok ·2not authenticated / failed ·3uncertain. - GitHub Action
praveen-palanisamy/agent-browser-runtime@v0—command: probe|post, outputsok,authenticated,needs-reauth,uncertain,result-file,session-file(seedocs/GITHUB_ACTION.md). GET /v1/healthzreturns{ name, version, repository, jobProvider, captureProvider, activeCaptures }; every JSON response carries aServer: agent-browser-runtime/<version> (+repo)header. Prefer/v1/healthzover/healthzwhen the service sits behind Cloud Run or similar L7 proxies.
Wire protocol routes and request/response shapes live in src/protocol.ts; treat them as the contract when generating client code in other languages.
Extending
- New provider: implement
SessionProvider.acquire({ platform, state, interactive })returning anAgentSessionHandle(context,exportState,dispose, optionalliveViewUrl). UseattachOverCdpfor any CDP-speaking backend. Add a unit test with a fakefetch(see__tests__/kernel-provider.test.ts). - New strategy: keep it in your application; the runtime never hard-codes platforms.
Testing conventions
npm testmust stay browser-free and fast; anything that launches Chromium goes under__tests__/browser/*.browser.test.ts.- Fake providers/handles are sufficient for orchestration tests (
__tests__/runner.test.ts).