Build AI-powered web automation agents with Mastra and Stagehand
Get your Browserbase API Key
BROWSERBASE_API_KEY
and BROWSERBASE_PROJECT_ID
environment variables.Get your OpenAI API Key
Create a new project
Install dependencies
Create the Stagehand tools
src/mastra/tools/index.ts
with the web automation tools:Create the web agent
src/mastra/agents/index.ts
:Initialize Mastra
src/mastra/index.ts
:Configure Environment
.env
file in the project root:Start the Agent
package.json
:src/mastra/agents/index.ts