Scripts2026年4月2日·1 分钟阅读

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
快速使用

先拿来用,再决定要不要深挖

这里应该同时让用户和 Agent 知道第一步该复制什么、安装什么、落到哪里。

```bash npm install @browserbasehq/stagehand ``` ```typescript import { Stagehand } from "@browserbasehq/stagehand"; const stagehand = new Stagehand({ env: "LOCAL", modelName: "gpt-4o" }); await stagehand.init(); await stagehand.page.goto("https://example.com"); // 用自然语言提取数据 const data = await stagehand.page.extract({ instruction: "提取页面标题和所有链接", schema: z.object({ title: z.string(), links: z.array(z.string()) }), }); // 用自然语言执行操作 await stagehand.page.act({ action: "点击搜索按钮" }); ``` ---
## 简介 Stagehand 是 Browserbase 开源的 AI 浏览器自动化框架,拥有 21,800+ GitHub stars。它将浏览器自动化简化为三个原语:`act()`(执行操作)、`extract()`(提取数据)和 `observe()`(理解页面),全部使用自然语言指令。基于 Playwright 构建,支持本地执行和 Browserbase 云端扩展。 适用于:OpenAI GPT-4o、Anthropic Claude、Playwright。适合构建网页爬虫、测试代理或浏览器 AI 工作流的 TypeScript 开发者。 --- ## 核心原语 ### act() — 执行操作 用自然语言告诉浏览器做什么:点击、输入、选择、滚动。 ### extract() — 提取数据 用 Zod schema 定义结构化数据,AI 自动提取并返回类型安全的结果。 ### observe() — 理解页面 发现当前页面上可执行的交互操作。 ### Playwright 兼容 扩展 Playwright,AI 和传统选择器可以混合使用。 ---
🙏

来源与感谢

> Created by [Browserbase](https://github.com/browserbase). Licensed under MIT. > > [stagehand](https://github.com/browserbase/stagehand) — ⭐ 21,800+

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产