LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

libretto

AI toolkit for building and maintaining browser automations

TLDR

Scaffold a new Libretto project in the current directory
$ npm create libretto@latest
copy
Install Libretto into an existing Node project
$ npm install libretto && npx libretto setup
copy
Open a URL in a controlled browser session
$ npx libretto open [https://example.com]
copy
Take a snapshot (HTML + screenshot) and analyze it with an LLM
$ npx libretto snapshot --objective "[find the login form]"
copy
Execute Playwright TypeScript against the current page
$ npx libretto exec "[await page.click('button.submit')]"
copy
Run a saved workflow file
$ npx libretto run [src/workflows/scrape-page.ts]
copy
Target a named session (multiple windows can coexist)
$ npx libretto snapshot --session [checkout] --objective "[verify total]"
copy

SYNOPSIS

libretto command [options]

DESCRIPTION

Libretto is a CLI and coding-agent skill built on Playwright that helps engineers author and maintain browser automations for systems with no proper API. Instead of hand-writing selectors, the developer points Libretto at a live page and asks the LLM for "token-efficient" summaries, network traces, and DOM excerpts that can be pasted into an agent prompt.A typical workflow is: open a page with libretto open, capture context with libretto snapshot, iterate with libretto exec, and finally commit the steps to a TypeScript file that can be replayed with libretto run. All state is kept in a per-project .libretto/ directory (sessions, profiles, captured traffic).

PARAMETERS

--session NAME

Target a named browser session so that parallel workflows do not interfere.
--objective TEXT
Natural-language goal passed to the model during a snapshot.
--headless
Run Chromium without a visible window.
--model NAME
Override the LLM used to analyze snapshots.

CONFIGURATION

Libretto reads an API key from a project .env file for whichever LLM provider is configured (OpenAI, Anthropic, etc.). The .libretto/ directory stores:

$ .libretto/
  sessions/         # Playwright user-data directories
  snapshots/        # captured HTML + PNG + summaries
  profiles/         # reusable configuration presets
copy

COMMANDS

setup

Download the bundled Chromium build and configure the snapshot model.
open URL
Launch a browser and navigate to URL.
snapshot --objective TEXT
Capture HTML and a PNG screenshot, then summarize the page against the stated objective.
exec CODE
Run a snippet of Playwright TypeScript against the current page.
run FILE
Execute a workflow file (TypeScript) that orchestrates multiple steps.
help
Print the full command list.

CAVEATS

Libretto needs Chromium and will download it during libretto setup; corporate proxies may block this. Because the tool routes page content through an LLM, be mindful of leaking secrets when snapshotting authenticated pages. Library version and Playwright API can change frequently — pin the version in package.json.

HISTORY

Libretto is published by Saffron Health as an open-source toolkit to make browser-based integrations agent-friendly, combining Playwright with a model-aware CLI and Model Context Protocol (MCP) skill for coding assistants.

SEE ALSO

playwright(1), npx(1), curl(1), puppeteer(1)

Copied to clipboard
Kai