Reference for the six browser tools agents call.
{ ok: true, ...payload } on success, or { ok: false, error } for model-fixable failures (unknown session ID, thrown Playwright code). Errors include a next step when possible. Host misconfiguration (missing API keys) and domain policy violations throw instead of returning { ok: false }.url at session create (providers that support preload) or after connect. Returns a sessionId for later tools.path urlstringhttps:// URL, or omit url and navigate with browser_exec via await page.goto(...). Kernel and Libretto Cloud can open this before CDP attach; other providers navigate after connect.path authProfilestring | falsedefault, or pass false for a session with no saved state. See Auth profiles.{ ok: true, sessionId }.{ ok: false, error } so the agent can open again.browser_open, but browser_close detaches without killing the externally managed browser.path cdpUrlstringrequiredws://127.0.0.1:9222/devtools/browser/....{ ok: true, sessionId }.return to produce a result.page, context, browser. TypeScript is fine (stripped with Sucrase). console.log / console.error are captured as stdout / stderr.path sessionIdstringrequiredbrowser_open or browser_connect.path codestringrequiredreturn await page.title().path pageIdstringbrowser_status. Defaults to the most recently opened tab.path diffSnapshotbooleantrue, capture a compact accessibility-tree baseline before the exec,
wait for the page to settle after success, then return snapshotDiff against
a fresh after-tree. Use for exploratory mutations when you do not know what
will change. Defaults to off.path timeoutMsnumber10000 (10 seconds). A timeout returns { ok: false, error } and stops
waiting — it does not cancel in-flight Playwright work. Raise timeoutMs,
simplify the code, or call browser_close then browser_open if the
session may still be running the timed-out work.1234567{ ok: true, result: unknown, stdout: string, stderr: string, snapshotDiff: string, // set when diffSnapshot is true; empty when off or unchanged }
{ ok: false, error, stdout?, stderr? } — fix the code and retry.browser_snapshot to orient on a full accessibility tree before interacting, or to verify state after a change.diffSnapshot: true on browser_exec when you want a page-change diff after an exploratory mutation. Prefer that before taking another full snapshot when you do not know what changed.ref handles (for example l7) so the agent can refer to structure while writing Playwright locators in browser_exec.path sessionIdstringrequiredbrowser_open or browser_connect.path screenshotbooleantrue, also return a PNG as { base64, mimeType: "image/png" }. Framework adapters (AI SDK, Pi) can surface that image to the model.path pageIdstringbrowser_status. Defaults to the most recently opened tab.{ ok: true, tree, screenshot? }.| Args | Returns |
| (none) | { ok: true, sessions } — each session lists sessionId, provider, pages, and authProfile when set |
sessionId | { ok: true, pages } for that session |
sessionId + pageId | Page detail: url, title, viewport, active, readyState |
path sessionIdstringbrowser_open or browser_connect.path pageIdstringbrowser_status call. Requires sessionId.browser_connect sessions it detaches without killing the external browser.path sessionIdstringrequired{ ok: true }.dispose() on the toolkit closes every session that toolkit still owns.