- Natural Language Web Automation: Direct AI agents to perform web actions using simple instructions like “click the sign in button” or “extract all product prices”
- Intelligent Element Detection: AI-powered element observation that can identify and locate page elements based on context and purpose
- Structured Data Extraction: Extract specific information from web pages with custom schemas and validation
- Session Management: Automatic browser session handling with smart reconnection and timeout management
Core components
Browser agent
An AI-powered agent using OpenAI’s GPT-4 that provides a natural language interface to web automation. The agent can understand complex instructions and break them down into appropriate tool calls.Stagehand tools
Three specialized tools that provide comprehensive web automation capabilities:stagehandActTool: Performs actions on web pages (clicking, typing, navigation)stagehandObserveTool: Identifies and locates elements on web pages for planning actionsstagehandExtractTool: Extracts structured data from web pages with custom schemas
Session manager
Handles browser session initialization, automatic timeouts, error recovery, and reconnection logic to ensure reliable web automation.Use cases
The Mastra + Stagehand integration is perfect for:- Data Extraction: Extract data from multiple pages with AI-guided navigation
- Automated Testing: Create intelligent test scenarios that adapt to UI changes
- Lead Generation: Gather contact information and company data from websites
- Market Research: Monitor competitor pricing, product listings, and content
- Form Automation: Fill out and submit forms across different websites
- Content Management: Update content across multiple platforms automatically
Architecture flow
Get started
Quickstart guide
Set up Mastra with Stagehand integration and build your first web automation agent.
Browser observability
Inspect browser activity and diagnose failed runs.