Show HN: Libretto PR agents – Automatically fix failing playwright scripts

Hacker News Top Tools

Summary

Libretto PR agents automatically investigate and fix failing Playwright scripts by opening GitHub pull requests with proposed code fixes.

Libretto PR agents is a free TypeScript library for maintaining Playwright browser automations. Add one line of code to your existing Playwright scripts and it lets an agent automatically open GitHub PRs fixing the script when it fails.<p>A few months ago we released Libretto, a CLI + coding-agent skill for building deterministic browser automations. The idea was that for many browser workflows, especially repetitive business workflows, you don’t need an AI agent making decisions at runtime. You want deterministic Playwright scripts that are inspectable, faster to run, and much cheaper than repeatedly calling an AI browser agent.<p>That helped us generate Playwright and network-request-based scripts, but websites can often change which breaks deterministic scripts. So maintaining a variety of scripts at scale is a headache. If you already have a bunch of functioning Playwright scripts, the last thing you want is to rewrite everything around a new runtime AI framework like browser-use or stagehand just to make maintenance easier.<p>The Libretto PR Agent pulls your code from GitHub and connects via CDP to the browser session that just failed. It has an exec tool for injecting Playwright and javascript into the page, and once its inspected the failure, it opens a PR to your repo with a proposed code fix.<p>You use it like this:<p><pre><code> try { await automationLogic(page); } catch (error) { await playwrightDebugger.debugFailure(error, page); throw error; } </code></pre> The agent is completely free and open source, lets you bring your own LLM provider API keys, and works with any browser provider (including self hosted).<p>The source code is here: <a href="https:&#x2F;&#x2F;github.com&#x2F;saffron-health&#x2F;libretto&#x2F;tree&#x2F;main&#x2F;packages&#x2F;playwright-debugger" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;saffron-health&#x2F;libretto&#x2F;tree&#x2F;main&#x2F;package...</a><p>We think this makes browser integrations much easier to maintain, especially for teams that already have Playwright browser automation scripts in production and don’t want a full migration to get AI-assisted debugging and repair.<p>If you’re maintaining browser automations in production, would love to know what your debugging flow is currently and any feedback on this approach.
Original Article
View Cached Full Text

Cached at: 07/16/26, 10:54 PM

# Playwright PR Agents | Libretto Source: [https://libretto.sh/debug-agents](https://libretto.sh/debug-agents) // PLAYWRIGHT PR AGENTS \-\- ## Automatically fix failing Playwright scripts Keep the browser automations you already run\. When one fails, Libretto investigates the live page and opens a GitHub pull request with a proposed code fix\. OpenLibretto autofix for Playwright failure libretto\-agent wants to merge 1 commit into main workflows/book\-appointment\.ts \- await page\.locator\('input\[name="username"\]'\)\.fill\(login\); \+ await page\.locator\('input\[name="login"\]'\)\.fill\(login\); The sign\-in field isname="login", confirmed by inspecting the live page\. // ONE FAILURE CALL \-\- ## Keep your scripts\. Add the repair loop\. Your existing Playwright script runs normally\. The PR agent starts only after a failure, when it can investigate what changed and propose a fix\. // FAQ \-\- ## Frequently asked questions What happens to the workflow after a failure?The PR agent focuses on diagnosing the failure and proposing a code fix for future runs\. Your existing catch, retry, fallback, and error handling remain responsible for the current run, while the agent opens a pull request when it finds a fix\. Do I need to use the Libretto runtime?No\. Add libretto\-playwright\-debugger to an existing Playwright project, initialize the debugger once, and call debugFailure\(\) from the failure path\. Your current runtime, browser provider, deployment, and workflow structure stay in place\. Does it work with Selenium or Puppeteer?Not yet\. The current package accepts a Playwright Page, so the failed automation must run through Playwright\. Selenium and Puppeteer would require separate adapters\. Does it work with any browser or cloud browser provider?Yes\. The PR agent works with local, self\-hosted, and hosted browsers as long as your automation has a live Playwright Page and keeps it open while debugFailure\(\) runs\. You do not need to use Libretto Cloud for the browser session\. Is the PR agent free?Libretto does not charge for the PR agent\. You bring your own model provider API key and browser infrastructure, so your model or browser provider may still charge for their usage\. Is it open source?Yes\. The Playwright debugger package is open source under the MIT license in the[Libretto repository](https://github.com/saffron-health/libretto/tree/main/packages/playwright-debugger)\.

Similar Articles

Show HN: Haystack – Review the PRs that need human attention

Hacker News Top

Haystack is a new tool that replaces the GitHub PR review system with a queue that triages pull requests into safe-to-merge, needs-fixes, or needs-human-review buckets, helping teams cope with the surge in PRs from coding agents.

Show HN: Git for AI Agents

Hacker News Top

re_gent is an open-source version control system for AI agent activity, tracking every tool call and associated prompt so developers can audit and roll back agent changes.