Give your agent a browser.

libretto.sh · 2026-08-04 · by Long Nguyen ·generic
Six tools let any AI agent open a real browser, read the page, and act with Playwright.

Give your agent a browser.

// BROWSER TOOLS SDK --

Give your agent a browser.

Six tools let any AI agent open a real browser, read the page, and act with Playwright.

$npm i libretto-browser-tools

AGENT.TS

// Supports Kernel, Browserbase, and more
const provider = new LocalBrowserProvider();

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

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

// BENCHMARKS --

55% lower cost than alternatives

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.

Built-in adapters for AI SDK, Pi, and MCP, plus a custom path for anything else. More frameworks are on the way.

AI SDKPiMCPCustom

Coming soon

Coming soon

Coming soon

// HOW IT WORKS --

Two tools do most of the work.

The agent reads a short page snapshot, then runs the Playwright code it needs.

01

browser\_snapshot

Returns a compact accessibility tree with stable refs. The agent can read the page structure without raw HTML.

browser\_snapshot ses-4f2a

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

02

browser\_exec

Runs Playwright code on the live page. Pass diffSnapshot to get a compact snapshot diff of what changed.

browser\_exec { code: "await page.locator('.titleline > a').first().click()", diffSnapshot: true }

{ ok: true, snapshotDiff: "+ article \[ref=l20\]" }

inspect → decide → act

browser\_open

Start a local browser session

browser\_status

List pages and session state

browser\_close

Clean up when the job is done

// MORE FROM LIBRETTO --

Build and repair browser workflows.

Libretto CLITurn browser workflows into APIs.Record a live workflow and save it as a reusable typescript file.Debug AgentsFix failed browser runs.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.

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.

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.

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.

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.

Install the package. Keep your current model and agent framework.

$npm i libretto-browser-tools

VIEW SOURCE ON GITHUB →

libretto.sh · 8 images · 19 links

Comments (0)

No comments yet