🚀 DAY 5 OF LAUNCH WEEK:Introducing Webhook Events for Alert Changes.Learn more
Socket
Book a DemoInstallSign in
Socket

stagehand-ai

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stagehand-ai

A web automation agent built with Stagehand

latest
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

🤘 Stagehand Agent

A powerful browser automation agent built with Stagehand that amplifies Playwright with act, extract, and observe capabilities.

🚀 Installation

npm install web-agent
# or
pnpm add web-agent
# or
yarn add web-agent

🛠️ Usage

import { Stagehand } from "@browserbasehq/stagehand";
import StagehandConfig from "./stagehand.config";

const stagehand = new Stagehand(StagehandConfig);
await stagehand.init();

const page = stagehand.page; // Playwright Page with act, extract, and observe methods
const context = stagehand.context; // Playwright BrowserContext

Key Features

  • Observe: Get actions to execute based on natural language instructions
  • Act: Execute actions on web pages
  • Extract: Extract data from web pages using natural language

Example Usage

// Click a button
const results = await page.observe("Click the sign in button");
await page.act(results[0]);

// Extract data
const { text } = await page.extract({
  instruction: "extract the sign in button text",
  schema: z.object({
    text: z.string(),
  }),
  useTextExtract: true,
});

🔧 Dependencies

This package requires:

  • Node.js (Latest LTS version recommended)
  • pnpm (v9.15.0 or later)
  • Playwright browsers (automatically installed via postinstall script)

📝 Environment Variables

Make sure to set up your environment variables in a .env file. Required variables will depend on your specific configuration.

📄 License

MIT

Keywords

web-automation

FAQs

Package last updated on 25 Mar 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts