Agent-readable docs index: /docs/llms.txt. Full docs in one file: /docs/llms-full.txt. Download /docs/docs.zip to grep all markdown files locally.

Pi

Use browser tools with the Pi coding agent.
Import from libretto-browser-tools/pi. Install the optional peer dependency @earendil-works/pi-coding-agent.
pnpm add libretto-browser-tools @earendil-works/pi-coding-agent npx playwright install chromium

createPiBrowserTools

Wraps the six browser tools as Pi ToolDefinitions. Pass them to createAgentSession as customTools.
import { AuthStorage, createAgentSession, ModelRegistry, } from "@earendil-works/pi-coding-agent"; import { createPiBrowserTools } from "libretto-browser-tools/pi"; import { LocalBrowserProvider } from "libretto-browser-tools"; const { tools, dispose } = createPiBrowserTools( new LocalBrowserProvider({ headless: true }), // optional: { allowedDomains: ["example.com"] } ); const authStorage = AuthStorage.create(); const modelRegistry = ModelRegistry.create(authStorage); const model = modelRegistry.find("anthropic", "claude-sonnet-4-5"); if (!model) throw new Error("Model not found"); try { const { session } = await createAgentSession({ model, authStorage, modelRegistry, customTools: tools, }); await session.prompt("Go to example.com and tell me the page title"); } finally { await dispose(); }
tools is an array of Pi tool definitions (not a keyed object). Tool execution is sequential. Pass domain policy options as the second argument — see Advanced.
Swap LocalBrowserProvider for any provider.

Screenshots

When the agent calls browser_snapshot with screenshot: true, the adapter returns JSON text for the tool result plus a Pi image content part (type: "image") with the PNG bytes. Without a screenshot, only JSON text is returned.

See also

  • Tools — inputs and outputs for each tool
  • Custom adapters — wrap createBrowserTools for another framework