Stagehand

将代码操作与 AI 交互、结构化提取结合的浏览器自动化 SDK。

先看实际效果

产品界面预览

Stagehand Evals: inspect the plan before starting browsers

Author CLI capture shows evals run with --preview, selected harness/model, task counts and quarantined cases. It is a dry-run plan from the evaluation utility, not a browser action, a successful benchmark or an independent performance result. Full native capture is retained.

Author Stagehand Evals terminal screenshot of a --preview plan, with harness, model, category counts and skipped cases.
查看完整图片
许可

PNG converted to lossless WebP with entire native RGBA equal. No crop, resize or new test. Author shell prompt, model label and dataset notes remain part of the capture.

MIT License

Copyright (c) 2024 Browserbase Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
使用示例

Stagehand source example: act on an Example Domain link

Full original TypeScript file asks the agent to click the More information link and checks its returned success field. Run from the matching Stagehand SDK repository: it imports ../src/index.js and dotenv, needs local Chrome and OPENAI_API_KEY; extract also needs zod/v4. Source model label is preserved without an availability or successful-run claim.

示例输入

import "dotenv/config";
import { localBrowser, Stagehand } from "../src/index.js";

const { OPENAI_API_KEY } = process.env;
if (!OPENAI_API_KEY) throw new Error();

const browser = await localBrowser.launch({ headless: true });
const stagehand = await Stagehand.create({
  browser,
  model: {
    modelName: "openai/gpt-5.4-mini",
    apiKey: OPENAI_API_KEY,
  },
});

const [page] = await browser.context.pages();
await page.goto("https://example.com");

const result = await stagehand.act(
  "Click the link that provides more information about Example Domain",
);

console.log(JSON.stringify(result.data, null, 2));

if (!result.data.success) {
  throw new Error(`act() failed: ${result.data.message}`);
}

await stagehand.close();
await browser.close();
许可

Complete original source file unchanged; editorial title, context and prerequisites added. No installation, account operation, model call, form submission or claimed result was executed.

MIT License

Copyright (c) 2024 Browserbase Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
使用示例

Stagehand source example: inspect candidate page actions

Full original TypeScript file asks for the Example Domain link and checks that matching actions were returned. Run from the matching Stagehand SDK repository: it imports ../src/index.js and dotenv, needs local Chrome and OPENAI_API_KEY; extract also needs zod/v4. Source model label is preserved without an availability or successful-run claim.

示例输入

import "dotenv/config";
import { localBrowser, Stagehand } from "../src/index.js";

const { OPENAI_API_KEY } = process.env;
if (!OPENAI_API_KEY) throw new Error();

const browser = await localBrowser.launch({ headless: true });
const stagehand = await Stagehand.create({
  browser,
  model: {
    modelName: "openai/gpt-5.4-mini",
    apiKey: OPENAI_API_KEY,
  },
});

const [page] = await browser.context.pages();
await page.goto("https://example.com");

const result = await stagehand.observe(
  "Find the link that provides more information about Example Domain",
);

console.log(JSON.stringify(result.data, null, 2));

if (result.data.length === 0) {
  throw new Error("observe() returned no matching actions");
}

await stagehand.close();
await browser.close();
许可

Complete original source file unchanged; editorial title, context and prerequisites added. No installation, account operation, model call, form submission or claimed result was executed.

MIT License

Copyright (c) 2024 Browserbase Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
使用示例

Stagehand source example: extract a typed page heading

Full original TypeScript file extracts the heading and description from the author’s evaluation site using a Zod schema. Run from the matching Stagehand SDK repository: it imports ../src/index.js and dotenv, needs local Chrome and OPENAI_API_KEY; extract also needs zod/v4. Source model label is preserved without an availability or successful-run claim.

示例输入

import "dotenv/config";
import { z } from "zod/v4";
import { localBrowser, Stagehand } from "../src/index.js";

const { OPENAI_API_KEY } = process.env;
if (!OPENAI_API_KEY) throw new Error();

const browser = await localBrowser.launch({ headless: true });
const stagehand = await Stagehand.create({
  browser,
  model: {
    modelName: "openai/gpt-5.4-mini",
    apiKey: OPENAI_API_KEY,
  },
});

const [page] = await browser.context.pages();
await page.goto("https://stagehand-eval-sites.vercel.app/sites/example/");

const result = await stagehand.extract(
  "Extract the page heading and description",
  z.object({
    heading: z.string(),
    description: z.string(),
  }),
);

console.log(JSON.stringify(result.data, null, 2));

await stagehand.close();
await browser.close();
许可

Complete original source file unchanged; editorial title, context and prerequisites added. No installation, account operation, model call, form submission or claimed result was executed.

MIT License

Copyright (c) 2024 Browserbase Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

产品介绍

Stagehand 面向需要在代码中维护浏览器流程的开发者。已知网址、固定导航等步骤可以继续使用确定的页面操作;遇到需要理解按钮含义、选择元素或整理字段的环节,再调用 AI。例如,先用代码进入产品页面,再按事先定义的字段结构提取产品信息,而不是让智能体从头自行探索整个任务。

它的三个核心操作各有职责:act 根据描述执行交互,extract 提取数据,observe 识别候选操作。它们可以与类似 Playwright 的页面导航、定位器、截图等操作搭配。业务流程、成功条件和结果检查仍由应用自己定义,因此选型时应关注它与已有脚本的结合方式,而不仅是能否理解一句自然语言指令。

主要功能

Stagehand 能做什么

  1. 01在固定页面操作中穿插需要语义理解的 AI 交互。
  2. 02使用字段结构约束提取结果,便于后续程序处理。
  3. 03通过 observe 查看可选操作,再决定下一步交互。
使用方式

一个可操作的流程

  1. 01先定义一个明确任务,以及代表成功的字段或最终页面状态。
  2. 02固定导航写进代码,只有需要解释页面时才使用 act、extract 或 observe。
  3. 03核对提取字段和最终页面状态,补充错误处理后再接入定时流程。

依据来源资料整理;产品功能声明尚未经过独立测试。

差异特点

它有什么不同

适合已有浏览器脚本、又有部分页面步骤难以完全固定的情况。可预测的步骤保留明确代码,不确定的步骤交给 AI 并检查结果;这能让开发者更清楚地判断流程在哪一步出错。

适合人群

谁值得考虑

  • 需要应对页面布局变化的浏览器自动化开发者。
  • 希望在现有应用中从网页提取结构化字段的团队。
选择之前

需要核对的事项

  • 准备所选 SDK 的运行环境,以及对应的模型和浏览器配置。
  • 分别核算模型调用与托管浏览器费用,SDK 可用不代表整个流程免费。
  • 检查布局变化和登录状态,不要默认 AI 每次都选中正确元素。

常见问题

Stagehand 是浏览器插件吗?

官方文档将其定位为开发 SDK,需要集成到自己的代码中,并非给终端用户安装使用的浏览器扩展。

act、extract 和 observe 有什么区别?

act 执行描述的交互,extract 获取结构化信息,observe 识别可能执行的操作;固定导航等可预测步骤仍可以保留普通浏览器代码。

一手来源核验

产品信息已于 2026年10月26日 对照官网或一手产品文档核验。

按任务相关推荐

产品价格使用方式相关用途
Stagehand费用取决于模型与浏览器配置开发 SDK自动化工作流
nanobot未核实Web, API, Windows, macOS, Linux生成可用于生产的代码 · 自动化工作流
Kusho免费与付费版API自动化工作流
Maxun未核实Web, API, Browser extension自动化工作流
n8n按当前版本与套餐核对工作流执行次数、Agent 对话回合、并发、执行记录保留和包含的 AI 额度。还应确认模型调用走套餐额度还是自己的供应商凭证;购买平台订阅不等于模型调用无限量。可以使用托管的 n8n Cloud,或自行运行 Community、商业授权版本。独立 Agent Builder 的可用性、运行环境配置和支持的执行模式与版本及部署方式有关,采用模板前应先确认。自动化工作流