
Product
Microsoft Teams Notifications Are Now Available in Socket
Socket can now send alerts and supply chain attack notifications to Microsoft Teams, with filters that route the right updates to each channel.
@mastra/stagehand
Advanced tools
Affected versions:
AI-powered browser automation for Mastra agents using Stagehand
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
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.

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.

Security News
Socket CTO Ahmad Nassri joins AppSec leaders at Black Hat to discuss active malware, package manager risks, and software supply chain defense.