DEDUPED Hot AI repos. Real use cases. What people build. Get the Monday 5

How to run browser automations in the cloud with action caching with Stagehand

Point the same Stagehand script at Browserbase and turn on caching so repeated actions spend no tokens.

Short answer: Get a Browserbase API key and set BROWSERBASE_API_KEY; then launch with browserbase.launch instead of the local browser, keeping the rest of your script; create Stagehand with cache: true so identical calls come back from Browserbase with no tokens spent. All steps.

Credentials. This needs a Browserbase API key on a paid hosted service; keep it in an environment variable and check pricing before moving high-volume jobs.

Who it is forA team running the same browser automations many times a day who wants them faster and cheaper.

The problemRunning browsers on your own servers is fiddly, and paying model tokens for the same action every run adds up.

The outcomeThe same script running on hosted browsers, with repeated calls served from cache.

What you need first

  • Node with pnpm, Python, or Go
  • Chrome installed for local runs
  • A model API key such as OPENAI_API_KEY, or a Browserbase API key to use the Model Gateway

Steps

  1. Get a Browserbase API key and set BROWSERBASE_API_KEY
  2. Launch with browserbase.launch instead of the local browser, keeping the rest of your script
  3. Create Stagehand with cache: true so identical calls come back from Browserbase with no tokens spent
  4. Leave out the model configuration to let the Model Gateway pick the cheapest model for each action
  5. Use session recordings to debug runs that go wrong

Prompt for your agent

Move my existing browserbase/stagehand script <file> from a local browser to Browserbase: launch with browserbase.launch using BROWSERBASE_API_KEY, enable cache, drop the model config so the Model Gateway picks models, and run it twice to show the second run uses the cache.

Caveat. Caching only helps when the same call repeats; one-off tasks still pay for model tokens.

Use this in your AI agent

Ask your agent

Using the Deduped MCP, get the setup steps for browserbase/stagehand and "Run browser automations in the cloud with action caching"

Add Deduped to Claude Code once

claude mcp add --transport http deduped https://dedupedai.com/mcp

Cursor, ChatGPT, others

Share: X LinkedIn Hacker News Email Copy link

Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer