Using observe to preview an action
observe lets you preview an action before taking it. If you are satisfied with the action preview, you can run it in page.act with no further LLM calls.
Simple caching
Let’s use a simple file-based cache for this example. We’ll write a getter and a setter functions that can read and write to a JSON file:Act with cache
Let’s write a function that will check the cache, get the action, and run it. If the action fails, we’ll attempt to “self-heal”, i.e. retry it withpage.act directly.
actWithCache to run an action with caching:

