LI

Libretto Browser Tools SDK

⭐ 1,000•TypeScript•Browser Automation

Open-source TypeScript package giving AI agents a production-ready, context-efficient browser harness.

TypeScriptBrowser AutomationAI SDKPi Agent HarnessMCPPlaywrightAgent Tools

Overview

Libretto Browser Tools SDK is an MIT-licensed TypeScript package that gives any AI agent a browser harness. Benchmarked on 26 live-site tasks, it tied for best pass rate at 24/26 while being ~55% cheaper per task than competitors and using 37% fewer tokens. Only 6 tools exposed with 2 essential ones. Works with AI SDK and Pi out of the box.

Features

  • ✓Context-efficient browser snapshot tool
  • ✓Raw Playwright exec tool for model-native control
  • ✓Only 6 tools (2 essential) for minimal context consumption
  • ✓AI SDK and Pi Agent Harness native integration
  • ✓Multiple browser providers: Libretto Cloud, Kernel, Browserbase, Local
  • ✓Anti-bot protections via cloud providers
  • ✓MIT licensed, open source

Installation

npm install libretto-browser-tools

Pros

  • +Tied for best pass rate on live-site benchmarks (24/26)
  • +~55% cheaper per task than competitors
  • +37% fewer tokens than alternatives
  • +Minimal tool surface area
  • +Multiple browser infrastructure providers
  • +MIT licensed
  • +Built by team with production browser agent experience

Cons

  • −TypeScript only — no Python SDK yet
  • −Local mode lacks anti-bot protections
  • −Newer project with smaller community
  • −Cloud providers require separate API keys

Alternatives

Documentation

Libretto Browser Tools SDK

Overview

Libretto Browser Tools SDK is an open-source TypeScript package that gives any AI agent a production-ready, context-efficient browser harness. Released in July 2026, it was built by the Libretto team using insights from building their own agentic browser platform.

The SDK was designed to solve a critical problem: existing browser tools for AI agents are either too expensive (high token consumption) or too unreliable (low pass rates). Libretto Browser Tools SDK addresses both with a minimalist approach — only 6 tools exposed, with just 2 being essential.

Benchmarked on 26 live-site tasks with GPT 5.6 Sol against Agent Browser, Playwright CLI, and Dev Browser, Libretto Browser Tools SDK tied for the best pass rate at 24/26 while being ~55% cheaper per successful task ($0.106 vs $0.235) and using far fewer tokens (1.45M vs 2.29M+).

MIT licensed and available at libretto.sh/browser-tools.

Features

  • Browser Snapshot: Context-efficient page representation designed from the ground up to give agents the overview they need to decide what to try next
  • Browser Exec: Executes raw Playwright code — models are trained on this and use it without direction
  • Only 6 Tools: Minimal surface area reduces context consumption and simplifies agent reasoning
  • AI SDK Integration: Works with Vercel AI SDK and Pi Agent Harness out of the box
  • Custom Integration Path: Supports any framework via custom integration
  • Multiple Browser Infra Providers: Supports Libretto Cloud, Kernel, Browserbase, and local Chromium via LocalBrowserProvider
  • Anti-Bot Protections: Cloud providers offer enhanced anti-bot capabilities; local Chromium is available for offline use

Installation

npm install libretto-browser-tools

Quick Start

import { createAiSdkBrowserTools } from "libretto-browser-tools/ai-sdk";
import { LocalBrowserProvider } from "libretto-browser-tools";

const { tools } = createAiSdkBrowserTools(new LocalBrowserProvider());

const result = await generateText({
  model: anthropic("claude-sonnet-4-5"),
  tools,
  prompt: "Go to Hacker News and tell me the top story",
});

Core Concepts

Browser Snapshot

The snapshot tool provides a condensed, context-efficient representation of the current page state. Unlike raw DOM dumps or verbose accessibility trees, the snapshot is engineered to minimize token consumption while preserving the information agents need to navigate and make decisions.

Browser Exec

The exec tool accepts and executes raw Playwright code. This design is deliberate — frontier models are extensively trained on Playwright code and can use it effectively with minimal instruction. This avoids the overhead of high-level abstraction layers.

Provider Architecture

The SDK uses a provider pattern:

  • LocalBrowserProvider: Runs Chromium locally (no anti-bot protections)
  • Libretto Cloud: Cloud-based with anti-bot protections
  • Kernel: Third-party browser infrastructure
  • Browserbase: Third-party browser infrastructure

Examples

Basic Page Navigation

// Navigate to a site and extract information
const result = await generateText({
  model: claude("sonnet-4-5"),
  tools: browserTools,
  prompt: "Visit example.com and tell me the main headline",
});

Complex Web Task

// Fill a form and submit
const result = await generateText({
  model: claude("sonnet-4-5"),
  tools: browserTools,
  prompt: "Go to the login page, enter my credentials, and verify I'm logged in",
});

With Cloud Provider

import { LibrettoCloudProvider } from "libretto-browser-tools";

const provider = new LibrettoCloudProvider({ apiKey: "your-api-key" });
const { tools } = createAiSdkBrowserTools(provider);

Pros

  • ✅ Tied for best pass rate (24/26) on live-site benchmarking
  • ✅ ~55% cheaper per task than competitors
  • ✅ Uses 37% fewer tokens (1.45M vs 2.29M+)
  • ✅ Minimal tool surface area (only 6 tools, 2 essential)
  • ✅ AI SDK and Pi integration out of the box
  • ✅ Multiple browser infrastructure providers supported
  • ✅ MIT licensed, open source
  • ✅ Built by team with real browser agent production experience

Cons

  • ✅ TypeScript only — no Python SDK yet
  • ✅ Local mode lacks anti-bot protections
  • ✅ New project — smaller community than established tools
  • ✅ Cloud providers require separate API keys

When to Use

  • Cost-sensitive browser automation: When token cost per task matters
  • High-volume agent workloads: When running many browser tasks in parallel
  • AI SDK or Pi users: Native integration with these frameworks
  • Teams needing anti-bot protections: Use cloud providers (Libretto Cloud, Kernel, Browserbase)

Resources