August 21, 2026

Configurable caching in Stagehand

Stagehand v4 caches act(), observe(), and extract() results on Browserbase's servers. Now you control it.

Pass cache to set a hit-count threshold - how many identical results Browserbase must see before it starts serving that result from the cache. A hit skips inference entirely: no model call, no tokens.

const stagehand = await Stagehand.create({
  browser,
  cache: { threshold: 2 }, // Serve hits after two identical results
});

// Prime this one step aggressively: the second call is a hit
await stagehand.act("click the Sign in button", {
  cache: { threshold: 1 },
});

Read the docs →

Plus:

  • Every call can override the instance setting; pass cache: false to skip the cache for a single step.
  • Results carry metadata.cache with a HIT / MISS / DISABLED status, a miss reason, and the tokens a hit saved.
  • Model configuration stays out of the cache key, so switching models does not invalidate your cache.