跳到主内容
智客 ZICQ

技能库 智客分类:Agent 工作流 browser-use-to-stagehand

浏览器使用到 Stagehand

浏览器-使用 (Python) 浏览器- 自定义脚本到 Stagehand v3(TypeScript) 在浏览器库上. 当用户想要转换,移植,重写,或将浏览器使用的 Agent 脚本迁移到 Stagehand, 映射浏览器使用特性/ API 到 Stagehand 原始(act/extract/observation/agent), 或将代理浏览器自动化移动到浏览器库, 并带有更多的决定力时使用. 在"浏览器-使用","浏览器_使用",或"代理(任务=.

396 安装量

官方网址:skills.sh

技能介绍

先看中文介绍;官方 description 原文单独保留,不改写 SKILL.md。

做什么

在浏览器库上移动浏览器-使用(Python)浏览器-自动操作脚本到 Stagehand v3(TypeScript)

何时用

用户想要转换、移植、重写或将浏览器使用的 Agent 脚本迁移到 Stagehand 、 映射浏览器使用特性/ API 到 Stagehand 原始文件( act/extract/ observation/ agent) , 或将代理浏览器自动化移动到浏览器库上, 并带有更多的决定性。 "浏览器使用"上的触发器

代理如何加载

按 Agent Skills 渐进披露:启动时只加载 name 与 description(约 100 token);任务匹配后才读入整份 SKILL.md 正文;scripts/、references/、assets/ 仅在需要时再读。 本文件正文结构:browser-use → Stagehand on Browserbase (`/browser-use-to-stagehand`)、Reference files (read as needed)、Workflow、1. Get the source、2. Detect the browser-use variant、3. Inventory the script。 其中含规范建议的小节:分步指令。

文件分析

文件分析:除 SKILL.md 外,正文引用了 references/api-mapping.md、references/determinism.md、references/trace-assisted.md、references/guide.md、references/prompt.md,属于带资源的技能包,这些文件按需再读。

官方 description(原文)

Migrate browser-use (Python) browser-automation scripts to Stagehand v3 (TypeScript) on Browserbase. Use when the user wants to convert, port, rewrite, or migrate a browser-use Agent script to Stagehand, map browser-use features/APIs to Stagehand primitives (act/extract/observe/agent), or move agentic browser automation onto Browserbase with more determinism. Triggers on "browser-use", "browser_use", or "Agent(task=...)".

browser-use → Stagehand on Browserbase (`/browser-use-to-stagehand`)Reference files (read as needed)Workflow1. Get the source2. Detect the browser-use variant3. Inventory the script4. Decide the determinism level per step5. Produce the Stagehand v3 rewrite6. Write the migration summary7. Offer the trace-assisted path (only if warranted)Output templatesValidation checklist (before declaring done)

兼容:The skill itself uses only Read/Write/Edit/Grep/Bash — no install step. The Stagehand code it generates needs Node 18+, `@browserbasehq/stagehand` (v3) and `zod`, plus `BROWSERBASE_API_KEY` / `BROWSERBASE_PROJECT_ID` and a model-provider key (e.g. `ANTHROPIC_API_KEY`) to run. The optional trace-assisted path uses the Browserbase SDK or the sibling `browser-trace` skill. · 许可:MIT · allowed-tools:Read, Write, Edit, Grep, Bash

来源分类:skills.sh agent-skill

SKILL.md 与 Agent 调用

官方规范 ↗
name
browser-use-to-stagehand
description
Migrate browser-use (Python) browser-automation scripts to Stagehand v3 (TypeScript) on Browserbase. Use when the user wants to convert, port, rewrite, or migrate a browser-use Agent script to Stagehand, map browser-use features/APIs to Stagehand primitives (act/extract/observe/agent), or move agentic browser automation onto Browserbase with more determinism. Triggers on "browser-use", "browser_use", or "Agent(task=...)".
compatibility
The skill itself uses only Read/Write/Edit/Grep/Bash — no install step. The Stagehand code it generates needs Node 18+, `@browserbasehq/stagehand` (v3) and `zod`, plus `BROWSERBASE_API_KEY` / `BROWSERBASE_PROJECT_ID` and a model-provider key (e.g. `ANTHROPIC_API_KEY`) to run. The optional trace-assisted path uses the Browserbase SDK or the sibling `browser-trace` skill.
allowed-tools
Read, Write, Edit, Grep, Bash实验字段,支持情况取决于客户端;字段声明本身不会授予工具权限。
许可
MIT
  1. 发现技能客户端向 Agent 提供名称与描述目录。
  2. 匹配与调用用户指定或任务匹配后,载入 SKILL.md 指令。
  3. 按需加载按步骤读取参考文档、使用脚本与素材。
指令中引用的文件 · 5
  • references/api-mapping.md
  • references/determinism.md
  • references/trace-assisted.md
  • references/guide.md
  • references/prompt.md

以下路径提取自原文;文件是否齐全请以来源仓库中的完整目录为准。

具体调用语法与可用工具以目标 Agent 客户端为准。 查看调用机制说明 ↗

安装这个技能

Skills CLI ↗

先选择目标 Agent 和安装范围,保留技能包的附属文件,安装后检查客户端能否发现该技能。

该技能引用了附属文件,请从来源获取完整目录;仅复制 SKILL.md 可能缺少依赖。

交给 Agent 安装

复制安装指令给支持 Agent Skills 的代理,确认其中的目标目录与客户端匹配。

把 Agent Skill「browser-use-to-stagehand」安装到我的项目:SKILL.md 原文与官方 description 见 https://zicq.com/zh/skills/skl-f22eddaecfd3ee34-%E6%B5%8F%E8%A7%88%E5%99%A8%E4%BD%BF%E7%94%A8%E5%88%B0-Stagehand.html
请存为 .cursor/skills/browser-use-to-stagehand/SKILL.md 或 .claude/skills/browser-use-to-stagehand/SKILL.md,frontmatter 的 name 与 description 保持原样,不要改写。
该技能还带 scripts/、references/、assets/ 等文件,请从 https://github.com/browserbase/skills 取完整目录,不要只建一个 SKILL.md。

GitHub 完整包 ↗

终端安装 · Skills CLI

需要 Node.js 与 npx。先查看仓库技能列表,确认实际名称。

npx skills add 'https://github.com/browserbase/skills' --list

npx skills add 'https://github.com/browserbase/skills' --skill 'browser-use-to-stagehand'

CLI 会交互选择目标 Agent,默认安装到项目;用户级安装使用 -g。先通过查看命令核对仓库内容,再用 npx skills list 检查已安装技能。

阅读排版
--- name: browser-use-to-stagehand description: Migrate browser-use (Python) browser-automation scripts to Stagehand v3 (TypeScript) on Browserbase. Use when the user wants to convert, port, rewrite, or migrate a browser-use Agent script to Stagehand, map browser-use features/APIs to Stagehand primitives (act/extract/observe/agent), or move agentic browser automation onto Browserbase with more determinism. Triggers on "browser-use", "browser_use", or "Agent(task=...)". compatibility: "The skill itself uses only Read/Write/Edit/Grep/Bash — no install step. The Stagehand code it generates needs Node 18+, `@browserbasehq/stagehand` (v3) and `zod`, plus `BROWSERBASE_API_KEY` / `BROWSERBASE_PROJECT_ID` and a model-provider key (e.g. `ANTHROPIC_API_KEY`) to run. The optional trace-assisted path uses the Browserbase SDK or the sibling `browser-trace` skill." license: MIT allowed-tools: Read, Write, Edit, Grep, Bash --- # browser-use → Stagehand on Browserbase (`/browser-use-to-stagehand`) Convert a browser-use (Python) script into an idiomatic **Stagehand v3 (TypeScript)** script on **Browserbase**, choosing the right level of determinism at each step rather than producing a one-to-one agentic copy. **Core principle:** browser-use is agentic-by-default (the LLM decides every action). Stagehand lets you choose how much AI to use. A good migration replaces opaque agent loops with an inspectable, mostly-deterministic pipeline — using AI only where the page is genuinely unpredictable. This is a refactor with judgment, not a transpile. > **Source of truth & versions.** This skill's durable value is the *judgment* — the determinism > spectrum and the decompose-vs-agent decision — not the API specifics, which drift every release. > The code mappings here are a **snapshot validated against `@browserbasehq/stagehand` 3.6.x and > browser-use 0.13.x (2026-06)**. On any conflict, the **live docs win** — always verify against the > installed package and these sources before emitting code: > - Stagehand v3: · installed types: `node_modules/@browserbasehq/stagehand` > - Browserbase: > - browser-use: > > If the installed Stagehand major is **not 3**, treat this skill as conceptual only and follow the > live docs for every signature. ## Reference files (read as needed) - [`references/api-mapping.md`](references/api-mapping.md) — the mechanical browser-use → Stagehand mapping: variant detection, the full feature table, before/after code, Browserbase platform options, and v3 version gotchas. **Read this for any non-trivial construct.** - [`references/determinism.md`](references/determinism.md) — how to choose `agent()` vs `act`/`extract`/`observe` vs cached `observe`→`act`. The decision tree. **Read this when deciding how to translate an `Agent(task=…)`.** - [`references/trace-assisted.md`](references/trace-assisted.md) — the optional "run it on Browserbase, read the logs, then rewrite" workflow for opaque/flaky scripts. - [`references/guide.md`](references/guide.md) — the human migration guide: philosophy shift, feature mapping, the determinism spectrum, and a recommended migration path. - [`references/prompt.md`](references/prompt.md) — a self-contained, tool-agnostic version of this skill; paste it into any AI assistant along with a browser-use script. - [`EXAMPLES.md`](EXAMPLES.md) — before/after script pairs. ## Workflow ### 1. Get the source Obtain the browser-use script(s). If the user only described a script, ask for the file(s). Note the target: **TypeScript Stagehand on Browserbase** unless they say otherwise. > **First, gate on scope — is this even migratable?** Not every browser-use file is an > `Agent(task=…)` script. If the source is **browser-use running as an MCP server** > (`uvx browser-use --mcp`, a `mcpServers` config) there is **no Stagehand equivalent** — flag it as > out of scope, don't invent one (see api-mapping §3.7b). If the browser-use call is **embedded in a > larger app** (a class/tool wrapper, web route, queue task), convert only the browser-use surface and > preserve the surrounding app glue — see api-mapping §3.8. ### 2. Detect the browser-use variant Identify legacy (pre-0.12) vs stable vs Rust beta (only when imports come from `browser_use.beta`) — see api-mapping §1. Note: the classic top-level `from browser_use import Agent, ChatBrowserUse` surface is alive and well in 0.13.x — `ChatBrowserUse` alone is **not** a beta tell; only a `browser_use.beta` import is. All variants translate identically, so when unsure, proceed with the stable mapping. Normalize legacy names before translating. State which variant you found. ### 3. Inventory the script Extract a structured inventory before writing any TypeScript: - **Task(s)** — the `task=` string(s); split each into its implied ordered steps. - **Model** — the `Chat*` provider + model id. - **Browser config** — local vs `cdp_url`/Browserbase; headless; proxies; `user_data_dir`/`storage_state`. - **Structured output** — any `output_model_schema` Pydantic models. - **Secrets** — `sensitive_data`, env-var usage, login flows. - **Guardrails** — `allowed_domains`, `max_steps`. - **Custom actions** — `@tools.action` / `Controller` functions, and whether each is a deterministic side-effect or an agent capability. - **Setup** — `initial_actions`, secondary models (`page_extraction_llm`, `planner_llm`). ### 4. Decide the determinism level per step For each step from the inventory, apply the decision tree in determinism.md: - Navigate to a known URL → `page.goto(url)` on the Stagehand page (no AI). - On-page action → `act("…")`; if it repeats, `observe()` once then replay `act(action)` (no LLM call). - Reading data → `extract("…", zodSchema)`. - Genuinely open-ended → keep `stagehand.agent().execute(...)` (tightened with `maxSteps`/`systemPrompt`). Default to **decomposition** when the flow is known; keep `agent()` only where it isn't. For a first lift-and-shift, a faithful `agent()` translation is acceptable — say so and note the optimization path. ### 5. Produce the Stagehand v3 rewrite **First, verify the API.** Before writing, confirm the exact signatures you're about to use against the installed package (`node_modules/@browserbasehq/stagehand` types) or . The mappings below are a 3.6.x snapshot; if anything differs in the installed version, the installed version wins. Then emit runnable TypeScript. Always: - `import { Stagehand } from "@browserbasehq/stagehand";` and `import { z } from "zod";` when extracting. - Get the page via `const page = stagehand.context.pages()[0];`. - Call AI methods on the **instance**: `stagehand.act(...)`, `stagehand.extract(...)`, `stagehand.observe(...)` — **never** `page.act(...)`. - Set the model as a `"provider/model"` string. - Default to `env: "BROWSERBASE"`; show `env: "LOCAL"` as the dev option. - Pass secrets via `variables` and `process.env`, never hardcoded. - `await stagehand.init()` at the start, `await stagehand.close()` in a `finally`. Include the project setup so it runs (see the templates below). ### 6. Write the migration summary Alongside the code, produce a short summary: - **Variant detected** and the determinism choices made (which steps became deterministic vs AI vs agent), with the reasoning. - **Needs human review** — anything that didn't map 1:1: lost `allowed_domains` guardrails, custom-action logic, secondary-model intent, ambiguous task strings. - **Recommended next step** — Browserbase Context for auth reuse, caching for production, or the trace-assisted path if the flow was opaque. ### 7. Offer the trace-assisted path (only if warranted) If the source was one large opaque `agent(task=…)`, was flaky, or your rewrite can't be confidently mapped, offer the trace-assisted workflow (trace-assisted.md): run the original on Browserbase, pull `sessions.logs.list`, and rewrite from observed behavior. Don't run anything without the user's go-ahead. ## Output templates **`package.json`** ```json { "name": "stagehand-migration", "type": "module", "scripts": { "start": "tsx index.ts" }, "dependencies": { "@browserbasehq/stagehand": "^3.0.0", "dotenv": "^16.0.0", "zod": "^3.25.0" }, "devDependencies": { "tsx": "^4.0.0", "typescript": "^5.0.0" } } ``` > Add `"ai": "^5.0.0"` (Vercel AI SDK) **only** if a custom browser-use action maps to an agent > `tool`. **Pin v5, not v4** — Stagehand 3.6.x bundles `ai` v5 and types `agent({ tools })` as the v5 > `ToolSet`, where a tool's schema field is **`inputSchema`**. The v4 `tool()` helper emits > `parameters` instead and will **fail to type-check** against Stagehand's v5 `ToolSet`. If you can't > control the hoisted `ai` version, skip the `tool()` helper and pass a plain object > `{ description, inputSchema: zodSchema, execute }` — it satisfies the v5 `ToolSet` regardless of which > `ai` major resolves. **`.env`** ```bash BROWSERBASE_API_KEY=... BROWSERBASE_PROJECT_ID=... ANTHROPIC_API_KEY=... # or the provider matching your model string ``` **`index.ts` skeleton** (decomposed, the preferred shape) ```typescript import "dotenv/config"; import { Stagehand } from "@browserbasehq/stagehand"; import { z } from "zod"; async function main() { const stagehand = new Stagehand({ env: "BROWSERBASE", model: "anthropic/claude-sonnet-4-6", }); await stagehand.init(); try { const page = stagehand.context.pages()[0]; await page.goto("https://example.com"); // deterministic skeleton await stagehand.act("…"); // AI where the page varies const data = await stagehand.extract("…", z.object({ /* … */ })); // structured reads console.log(data); } finally { await stagehand.close(); } } main().catch((err) => { console.error(err); process.exit(1); }); ``` ## Validation checklist (before declaring done) - [ ] AI methods are on the **instance** (`stagehand.act/extract/observe`), not the page. - [ ] Page obtained via `stagehand.context.pages()[0]`. - [ ] Model is a `"provider/model"` string; the matching provider key is in `.env`. - [ ] `extract` uses a zod schema; `zod` is in dependencies. - [ ] Secrets use `variables` + `process.env`; nothing hardcoded. - [ ] `init()` / `close()` present; `close()` in `finally`. - [ ] Each browser-use step is accounted for, placed deliberately on the determinism spectrum. - [ ] Migration summary lists determinism choices and "needs human review" items. ## Common mistakes to avoid - **Copying v2 syntax** (`page.act()`, `stagehand.page`, `modelName`/`modelClientOptions`, `enableCaching`) from old blog posts. Use v3 — see api-mapping "Version notes". - **Translating every step into `act()`** — navigate with `page.goto` and cache repeatable steps via `observe`→`act`; don't spend an LLM call on every action. - **Defaulting everything to `agent()`** — that just reproduces browser-use's non-determinism in a new framework. Decompose where the flow is known. - **Silently dropping `allowed_domains`** — Stagehand has no domain firewall; flag it for review. - **Inventing Browserbase/Stagehand options** — if unsure of a field, check / rather than guessing.

相关技能

Agent 工作流

技能创建者Skill Creator

创造有效技能指南。 当用户想创造出新的技能(或更新现有的技能),以专业知识,工作流程,或工具集成来扩展克洛德的能力时,应该使用这种技能.

Agent 工作流

克劳德胡布Clawdhub

使用ClawdHub CLI搜索,安装,更新并发布从taladhub.com的代理技能. 需要获取苍蝇上的新技能时使用,将安装的技能同步到最新版本或特定版本,或者发布 npm-instainddhub CLI 的新/更新的技能文件夹.

Agent 工作流

团队指挥Agent Team Orchestration

管弦乐团多代理团队,任务设定周期,交接协议,审查工作流程. 使用时间: (1)建立2+特派员队伍,具有不同专业,(2)确定任务路线和生命周期(收录框_ spec_建设_审查_完成),(3)在特派员之间制定交接协议,(4)建立审查和质量关口,(5)管理特派员之间的交流和文物共享.

Agent 工作流

超级力量Superpowers

Spec-first,TDD,子代理驱动的软件开发工作流程. 当:(1)构建任何新功能或应用——触发脑暴_计划_子代理执行回路,(2)调试出一个bug或测试失败——触发系统性的根起过程,(3)用户说"让我们构建","帮助我计划","我想添加X",或"这个被打破",(4)完成一个功…