ScriptsApr 2, 2026·2 min read
Stagehand — AI Browser Automation Framework
Three AI primitives — act(), extract(), observe() — to automate any website with natural language. By Browserbase. 21K+ stars.
TO
TokRepo精选 · Community
Quick Use
Use it first, then decide how deep to go
This block should tell both the user and the agent what to copy, install, and apply first.
```bash
npm install @browserbasehq/stagehand
```
```typescript
import { Stagehand } from "@browserbasehq/stagehand";
const stagehand = new Stagehand({
env: "LOCAL", // or "BROWSERBASE" for cloud
modelName: "gpt-4o",
modelClientOptions: { apiKey: process.env.OPENAI_API_KEY },
});
await stagehand.init();
await stagehand.page.goto("https://news.ycombinator.com");
// Extract data with natural language
const articles = await stagehand.page.extract({
instruction: "Extract the top 5 article titles and their URLs",
schema: z.object({
articles: z.array(z.object({ title: z.string(), url: z.string() })),
}),
});
// Act on the page
await stagehand.page.act({ action: "Click the 'More' link at the bottom" });
// Observe available actions
const actions = await stagehand.page.observe({
instruction: "What actions can I take on this page?",
});
await stagehand.close();
```
---
Intro
Stagehand is an AI browser automation framework by Browserbase with 21,800+ GitHub stars. It reduces browser automation to three simple primitives: `act()` to perform actions, `extract()` to pull structured data, and `observe()` to understand page state — all using natural language instructions. Unlike Selenium or Playwright scripts that break when websites change, Stagehand uses AI vision and DOM understanding to adapt automatically. Built on top of Playwright, it supports both local execution and cloud-scale via Browserbase.
Works with: OpenAI GPT-4o, Anthropic Claude, any OpenAI-compatible API, Playwright. Best for developers building web scrapers, testing agents, or browser-based AI workflows. Setup time: under 3 minutes.
---
🙏
Source & Thanks
> Created by [Browserbase](https://github.com/browserbase). Licensed under MIT.
>
> [stagehand](https://github.com/browserbase/stagehand) — ⭐ 21,800+
Thanks to the Browserbase team for creating the most elegant API for AI browser automation.
Discussion
Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.
Related Assets
LaVague — Natural Language Web Automation
Give a text objective, LaVague drives the browser to accomplish it. Large Action Model framework for web agents. 6.3K+ stars.
TokRepo精选
Trae Agent — AI Coding Agent by ByteDance
Open-source autonomous coding agent for software engineering tasks. Multi-provider LLM support. By ByteDance. 11K+ stars.
TokRepo精选
bolt.diy — AI Full-Stack App Builder, Any LLM
Community fork of Bolt.new. Prompt, edit, and deploy full-stack web apps with any LLM provider. 19K+ GitHub stars.
TokRepo精选