Browser Tools SDK is code-mode for the browser

tanishqkanc1 pts0 comments

Browser Tools SDK | Librettonav]:bg-bg/90">

// BROWSER TOOLS SDK --Give your agent a browser.<br>Six tools let any AI agent open a real browser, read the page, and act with Playwright.

$npm i libretto-browser-tools

AGENT.TS<br>// Supports Kernel, Browserbase, and more<br>const provider = new LocalBrowserProvider();

// Adapters for AI SDK, Pi, and MCP<br>const { tools } = createAiSdkBrowserTools(provider);

const result = await generateText({<br>model,<br>tools,<br>prompt: "Find the top story on Hacker News",<br>});

// BENCHMARKS --55% lower cost than alternatives<br>Lets your agent work through complex pages with less overhead — and a lot less cost.

OutcomeCostToken usage

Browser Tools$0.106

dev-browser$0.257

agent-browser$0.235

playwright-cli$0.293

Measured across 26 tasks on public websites with GPT 5.6 Sol. Best results taken from 3 runs. Full method and results

// INTEGRATIONS --Use the agent stack you know.<br>Built-in adapters for AI SDK, Pi, and MCP, plus a custom path for anything else. More frameworks are on the way.

AI SDKPiMCPCustomComing soon<br>Coming soon<br>Coming soon

// HOW IT WORKS --Two tools do most of the work.<br>The agent reads a short page snapshot, then runs the Playwright code it needs.

01<br>browser_snapshot<br>Returns a compact accessibility tree with stable refs. The agent can read the page structure without raw HTML.<br>browser_snapshot ses-4f2a

heading "Hacker News"<br>link "Show HN: Browser Tools" [ref=l12]<br>link "42 comments" [ref=l13]

02<br>browser_exec<br>Runs Playwright code on the live page. Pass diffSnapshot to get a compact snapshot diff of what changed.<br>browser_exec { code: "await page.locator('.titleline > a').first().click()", diffSnapshot: true }<br>ok: true,<br>snapshotDiff: "+ article [ref=l20]"

inspect → decide → act

browser_open<br>Start a local browser session

browser_status<br>List pages and session state

browser_close<br>Clean up when the job is done

// MORE FROM LIBRETTO --Build and repair browser workflows.

Libretto CLI<br>Turn browser workflows into APIs.<br>Record a live workflow and save it as a reusable typescript file.<br>Debug Agents<br>Fix failed browser runs.<br>Give a failed run to an agent. Get a tested pull request back.

// FAQ --Common questions

Which integrations work today?+The package includes adapters for AI SDK, Pi, and MCP. The base tools are framework-neutral, so you can also wire them into your own agent loop.<br>Which browser providers can I use?+Run Chromium on your machine with LocalBrowserProvider, or use the built-in providers for Libretto Cloud, Browserbase, Kernel, and Steel.<br>Why does the SDK expose only six tools?+Most browser work needs two tools: browser_snapshot to read the page and browser_exec to run Playwright. The other four tools open, connect, inspect, and close browser sessions.<br>Does Browser Tools SDK replace Playwright?+No. It gives an agent a small tool set and runs its browser_exec code through Playwright. You still have the Playwright API.<br>Is Browser Tools SDK open source?+Yes. The package is available under the MIT license in the Libretto repository.

// GET STARTED --Add browser tools to your agent.<br>Install the package. Keep your current model and agent framework.

$npm i libretto-browser-tools

VIEW SOURCE ON GITHUB →

browser tools agent playwright page libretto

Related Articles