
Security News
GPT-6 Astra Attempts Supply Chain Attacks Against Open Source Maintainers in Testing
GPT-6 Astra hits 100% on ExploitBench and finds zero-days autonomously, while independent tests reveal scope violations and monitoring gaps.
@mastra/stagehand
Advanced tools
Affected versions:
AI-powered browser automation for Mastra agents using Stagehand.
npm install @mastra/stagehand
import { Agent } from '@mastra/core/agent';
import { StagehandBrowser } from '@mastra/stagehand';
// Create a Stagehand browser
const browser = new StagehandBrowser({
model: 'openai/gpt-5.4',
headless: true,
});
// Create an agent with the browser
const agent = new Agent({
name: 'web-agent',
instructions: 'You are a helpful web assistant.',
model: 'openai/gpt-5.4',
browser,
});
// Use the agent to browse the web with natural language
const result = await agent.generate('Go to google.com and search for "Mastra AI"');
const browser = new StagehandBrowser({
// Environment: 'LOCAL' or 'BROWSERBASE'
env: 'LOCAL',
// Model for AI operations (default: 'openai/gpt-5.4')
model: 'openai/gpt-5.4',
// Or with custom config:
model: {
modelName: 'gpt-5.4',
apiKey: process.env.OPENAI_API_KEY,
},
// Run headless (default: true)
headless: true,
// Viewport dimensions
viewport: { width: 1280, height: 720 },
// CDP URL for connecting to existing browser
cdpUrl: 'ws://localhost:9222',
// Browserbase config (when env: 'BROWSERBASE')
apiKey: process.env.BROWSERBASE_API_KEY,
projectId: process.env.BROWSERBASE_PROJECT_ID,
// Enable self-healing selectors (default: true)
selfHeal: true,
// DOM settle timeout in ms (default: 5000)
domSettleTimeout: 5000,
// Logging verbosity (0: silent, 1: errors, 2: verbose)
verbose: 1,
// Custom system prompt for AI operations
systemPrompt: 'Focus on finding interactive elements',
});
StagehandBrowser exposes 6 AI-powered tools:
| Feature | AgentBrowser | StagehandBrowser |
|---|---|---|
| Approach | Deterministic refs (@e1) | Natural language |
| Token cost | Low | Higher (LLM calls) |
| Speed | Fast | Slower |
| Reliability | High (exact refs) | Variable (AI interpretation) |
| Best for | Structured workflows | Unknown/dynamic pages |
Apache-2.0
FAQs
AI-powered browser automation for Mastra agents using Stagehand
The npm package @mastra/stagehand receives a total of 29,060 weekly downloads. As such, @mastra/stagehand popularity was classified as popular.
We found that @mastra/stagehand demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 open source maintainers collaborating on the project.

Security News
GPT-6 Astra hits 100% on ExploitBench and finds zero-days autonomously, while independent tests reveal scope violations and monitoring gaps.

Product
Socket can now send alerts and supply chain attack notifications to Microsoft Teams, with filters that route the right updates to each channel.

Security News
pnpm 12 rewrites the package manager in Rust, cutting install times by up to 90% while preserving pnpm 11 workflows and lockfiles.