stagehand

Stagehand: Browserbase's AI browser automation framework designed to combine natural-language operations with deterministic code, suited for production workflows that require Playwright-level control, structured extraction, and caching/stable repetition of web tasks.

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "stagehand" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-a5010cb7accc9b135b94158ae90071b7c4e0beb71a6cd4dd489fdd31b87904f9. Verify the upstream source and version against https://skillhub.cn/skills/user_3c6cb52e/stagehand-browser-automation before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

skillhub.cn

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Stagehand: Browserbase's AI browser automation framework designed to combine natural-language operations with deterministic code, suited for production workflows that require Playwright-level control, structured extraction, and caching/stable repetition of web tasks.

0 Downloads

Introduction source: third_party · user_3c6cb52e · 1.0.0 Reference

SkillPi interpretation

Tasks
Not specified in the source documentation.
Audience
Not specified in the source documentation.
Inputs and outputs
Not specified in the source documentation.
Software, accounts and paid services
Not specified in the source documentation.
Limits and differences
Not specified in the source documentation.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: stagehand
description: >-
  Builds web automations with Stagehand by BrowserBase, the AI-powered browser
  automation framework that controls web pages through natural language
  instructions. Acts on, extracts data from, and observes pages using plain
  English commands instead of brittle CSS selectors — powered by GPT-4o or
  Claude for visual understanding of page layouts. Use when writing browser
  automation, scraping dynamic sites, or replacing fragile Playwright selectors.
license: Apache-2.0
compatibility: ''
metadata:
  author: terminal-skills
  version: 1.0.0
  category: AI & Machine Learning
  tags:
    - browser-automation
    - ai-agent
    - computer-use
    - web-automation
    - natural-language
    - playwright

Stagehand — AI Browser Automation in Natural Language

You are an expert in Stagehand by BrowserBase, the AI-powered browser automation framework that lets you control web pages using natural language instructions. You help developers build web automations that act, extract data, and observe pages using plain English commands instead of brittle CSS selectors — powered by GPT-4o or Claude for visual understanding of page layouts.

Core Capabilities

Setup and Basic Actions

import { Stagehand } from "@browserbasehq/stagehand";

const stagehand = new Stagehand({
  env: "LOCAL",                           // "LOCAL" for Playwright, "BROWSERBASE" for cloud
  modelName: "gpt-4o",
  modelClientOptions: { apiKey: process.env.OPENAI_API_KEY },
  enableCaching: true,                    // Cache AI decisions for repeated patterns
});

await stagehand.init();
const page = stagehand.page;              // Standard Playwright page object

// Navigate
await page.goto("https://app.example.com");

// Act — natural language browser control
await stagehand.act({ action: "Click the sign-in button" });
await stagehand.act({ action: "Type 'user@example.com' into the email field" });
await stagehand.act({ action: "Select 'Enterprise' from the plan dropdown" });
await stagehand.act({ action: "Scroll down to the pricing section" });

// Act with variables — keep credentials out of prompts
await stagehand.act({
  action: "Log in with username %user% and password %pass%",
  variables: {
    user: process.env.USERNAME!,
    pass: process.env.PASSWORD!,
  },
});

Extract Structured Data

// Extract structured data from any page
const products = await stagehand.extract({
  instruction: "Extract all product listings with name, price, rating, and availability",
  schema: {
    type: "object",
    properties: {
      products: {
        type: "array",
        items: {
          type: "object",
          properties: {
            name: { type: "string" },
            price: { type: "number" },
            rating: { type: "number" },
            inStock: { type: "boolean" },
          },
          required: ["name", "price"],
        },
      },
    },
  },
});

// Extract from complex pages (tables, nested layouts)
const invoiceData = await stagehand.extract({
  instruction: "Extract the invoice number, date, line items with quantities and amounts, and the total",
  schema: invoiceSchema,
});

Observe — Find Elements Without Acting

// Observe returns possible actions without performing them
const actions = await stagehand.observe({
  instruction: "Find all clickable navigation items",
});
// Returns: [{description: "Home link", selector: "xpath=...", ...}, ...]

// Use observe for conditional logic
const buttons = await stagehand.observe({
  instruction: "Find the 'Accept cookies' button if it exists",
});
if (buttons.length > 0) {
  await stagehand.act({ action: "Dismiss the cookie popup" });
}

Cloud Execution with BrowserBase

// Run in cloud for parallel, scalable automation
const stagehand = new Stagehand({
  env: "BROWSERBASE",                     // Cloud-hosted browser
  modelName: "gpt-4o",
  browserbaseSessionCreateParams: {
    projectId: process.env.BROWSERBASE_PROJECT_ID!,
    proxies: true,                        // Residential proxy
  },
});

Installation

npm install @browserbasehq/stagehand
# Requires: OPENAI_API_KEY or ANTHROPIC_API_KEY
# Optional: BROWSERBASE_API_KEY + BROWSERBASE_PROJECT_ID for cloud

Best Practices

  1. Natural language for dynamic pages — Use act() for pages that change layout frequently; CSS selectors break, natural language adapts
  2. Variables for secrets — Never put credentials in action strings; use the variables parameter
  3. Enable caching — Set enableCaching: true to avoid repeated AI calls for identical actions; huge cost savings
  4. Combine with Playwright — Use stagehand.page for stable interactions (login forms) and stagehand.act() for dynamic ones
  5. Schema for extraction — Always provide a Zod/JSON schema to extract(); structured output is more reliable than free-text
  6. Observe before acting — Use observe() to check if elements exist before acting; prevents errors on conditional UI
  7. BrowserBase for scale — Use cloud browsers for parallel automation; local is fine for development and testing
  8. Model selection — GPT-4o for speed, Claude for complex visual reasoning; both work well for most tasks

Current listing version

1.0.0

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value90/100

Highlights

  • AI 浏览器自动化框架,直接解决网页自动化、动态网站抓取等核心任务痛点
  • 显著提升日常高频场景的效率,适用于生产工作流程
Trigger Precision90/100

Highlights

  • 触发词精准完整,覆盖多种变体,边界清晰
  • 明确指出使用场景:编写浏览器自动化、抓取动态站点、替代脆弱的 Playwright 选择器
Structure and Standards90/100

Highlights

  • Phase/步骤清晰,有出口条件,含端到端示例
  • frontmatter完整,单文件≤500行,文档结构良好
Execution Reliability90/100

Highlights

  • 工具来源明确,参数正确,覆盖主要异常
  • 提供了详细的安装说明、API 使用示例和最佳实践,可靠性高
Evidence Verifiability (mean of the first four)90/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

  • Install or fetch external dependencies

    Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.

    Mentioned in main document · lines 133
  • Accounts, secrets or authorization

    Use a dedicated least-privilege account. Keep secrets out of public content and command logs; verify the receiving service and tenant.

    Mentioned in main document · lines 39, 55, 141
Domains or addresses referenced in the document

These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.

  • app.example.com

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Not specified in the source documentation.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.