Skip to main content
Wrap any browser automation agent with Raysurfer’s search() and upload() to cache Playwright scripts. On repeat tasks, the LLM receives the cached script as context and decides whether to reuse it, modify it, or generate a new one.
Cached scripts are always reviewed by the LLM before execution — never run directly.

How It Works

First run generates a script from scratch. Subsequent runs retrieve the cached script and let the LLM decide.

Setup

Quick Example

What Gets Cached

The cached artifact is a complete, runnable Playwright Python script:
On the next similar request, this script is passed to the LLM as context. The LLM can reuse it directly or modify it for the new task.

Handling Optional Elements

Real pages have cookie banners, login modals, age gates, and other elements that may or may not appear. Cached scripts should check for these before interacting:
Common patterns to guard against: These guards get cached alongside the scraping logic, so subsequent runs of the same task handle the same popups automatically.

Standalone Wrapper

For a ready-to-use wrapper class, see the raysurfer-browser-agent example: