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
- Get a Browserbase API key and set BROWSERBASE_API_KEY
- 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
- Leave out the model configuration to let the Model Gateway pick the cheapest model for each action
- 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
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer