run, snapshot, and screenshot calls.
Stagehand ships this experimental integration from its repository and does not publish it as a standalone adapter.
Prerequisites
- Node.js 24 or newer
- pnpm 11.10.0
- An OpenAI API key for the example agent
- A current Google Chrome installation for local browser mode
Quickstart
1
Clone and build Stagehand
2
Configure the AI SDK agent
AI_SDK_STAGEHAND_MODEL to select another model supported by the example.3
Choose the browser
The example uses local Chrome by default. To use Browserbase instead:
4
Run a browser task
Configuration
Keep the browser session alive
The example connects once withcreateMCPClient, loads the three tools, and closes the client only after the model loop finishes. Keep that lifetime when adapting the example; reconnecting for each call starts another browser and loses previous state.
The MCP child receives only Stagehand and Browserbase configuration plus the process values required to launch Node. The host’s model credential remains in the AI SDK process.
Vercel AI SDK integration source
Read the MCP client setup, agent loop, and contract tests.

