Skip to content

Server-side caching not working for extract(), act(), observe() #1767

@helmelwa

Description

@helmelwa

--- Environment Information

Stagehand:

  • Language/SDK: TypeScript
  • Stagehand version: 3.1.0

AI Provider:

  • Provider: OpenAI
  • Model: gpt-4.1-mini

Browser:

  • Browser Environment: Browserbase
  • serverCache: true

Issue Description

Server-side caching does not work for extract(), act(), and
observe() methods despite documentation stating it should
work automatically when running on Browserbase.

Steps to Reproduce

  1. Create new project with npx create-browser-app
  2. Run with default config (env: "BROWSERBASE",
    serverCache: true)
  3. Execute extract(), act(), or observe() call
  4. Check cacheStatus - always returns "MISS"
  5. Run same operation again - still "MISS"

Minimal Reproduction Code

import "dotenv/config";
import { Stagehand } from "@browserbasehq/stagehand";

const stagehand = new Stagehand({
env: "BROWSERBASE",
serverCache: true,
});

await stagehand.init();
const page = stagehand.context.pages()[0];

await page.goto("https://stagehand.dev");

// First call - always MISS
const extractResult = await stagehand.extract(
"Extract the value proposition from the page."
);
console.log(extractResult.cacheStatus); // "MISS"

// Second call with same URL and instruction - still MISS
const extractResult2 = await stagehand.extract(
"Extract the value proposition from the page."
);
console.log(extractResult2.cacheStatus); // "MISS"

Error Messages / Log trace

extract server cache miss
act server cache miss
observe server cache miss

All show cachedInputTokens: 0 and cacheStatus: "MISS" even
on repeated identical calls.

Additional Notes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions