Skip to main content
recoveryAction lets a workflow recover from a supported Playwright Page or Locator failure. When a supported action fails, Libretto runs the recovery action and retries the original action once.

computerUseRecoveryAction

computerUseRecoveryAction() runs a small vision agent with your instruction. It screenshots the viewport, asks the model for a browser action, executes it with Playwright coordinates, and stops when the model returns done or maxSteps is reached. One step is one screenshot, one model decision, and one browser action. The default maxSteps is 3, which covers the common popup flow of close, confirm, then done.
Supported provider shortcuts:
Advanced callers can pass a preconfigured AI SDK LanguageModel with languageModel.

popupRecoveryAction

popupRecoveryAction() is a preset for the common popup case. It uses Libretto’s default instruction for closing popups, cookie banners, modals, overlays, and similar blockers.

Custom recovery logic

Use a custom RecoveryAction when the site needs deterministic recovery logic, or when it needs to combine popupRecoveryAction() with other steps such as reloading the page.
If the recovery action returns without throwing, Libretto retries the original failed method once.