We built caching into Stagehand. Here's how it works
Blog post from Browserbase
Stagehand has introduced Action Caching to optimize repetitive web automation by storing resolved selectors for actions, significantly reducing reliance on large language models (LLMs) for identical tasks, which can result in performance improvements of up to 80%. This caching system works by validating that the current page matches a previously cached state with high confidence before executing an action, thereby bypassing costly and time-consuming LLM calls. The cache stores selectors and action configurations but excludes sensitive information, leveraging a DOM snapshot to create unique cache keys based on stable inputs and page fingerprints. While this approach enhances efficiency in workflows with repetitive tasks such as form-filling, it is less effective on pages with dynamic content or random URLs. Cache entries, valid for 48 hours, are scoped to specific projects and stored server-side, with the goal of safely expanding reuse across more requests over time.