Skip to content

stagehand

26,174 15 478 MIT
4.5.0 (27 Nov 2026) Oct 29 2024 11.2 million (month)

Stagehand is an AI-powered browser automation framework for JavaScript and TypeScript, built by Browserbase. It provides a simple API for controlling browsers using natural language instructions, powered by large language models.

Stagehand offers three core primitives:

  • act() Performs actions on the page described in natural language. For example, page.act("click the login button") will find and click the appropriate element.
  • extract() Extracts structured data from the page based on a natural language description and an optional schema definition.
  • observe() Analyzes the current page state and returns actionable elements and their descriptions, useful for understanding what actions are available on a page.

Key features include:

  • TypeScript-first Built with full TypeScript support and type-safe extraction using Zod schemas.
  • Multiple LLM providers Works with OpenAI, Anthropic, and other LLM providers for powering the AI.
  • Vision and DOM analysis Combines visual screenshot analysis with DOM inspection for robust element identification.
  • Playwright integration Uses Playwright as the browser automation backend, giving access to the full Playwright API alongside AI-powered actions.
  • Browserbase cloud Optionally integrates with Browserbase cloud for managed browser infrastructure.

Stagehand is particularly suited for automating complex web workflows where traditional selectors would be fragile, such as interacting with frequently changing UIs or scraping sites with dynamic layouts.

Highlights


ai-powerednatural-languagetypescript

Example Use


import { Stagehand } from '@browserbasehq/stagehand';
import { z } from 'zod';

const stagehand = new Stagehand({
    env: 'LOCAL',  // or 'BROWSERBASE' for cloud browsers
    modelName: 'gpt-4o',
});

await stagehand.init();
const page = stagehand.page;

// Navigate to a page
await page.goto('https://news.ycombinator.com');

// Use natural language to interact
await page.act('click on the "new" link in the navigation');

// Extract structured data with a schema
const stories = await page.extract({
    instruction: 'Extract the top 5 story titles and their point counts',
    schema: z.object({
        stories: z.array(z.object({
            title: z.string(),
            points: z.number(),
        })),
    }),
});
console.log(stories);

// Observe available actions on the page
const actions = await page.observe('What actions can I take on this page?');
console.log(actions);

await stagehand.close();

Alternatives / Similar


101,263 1.65.1 (2026-11-28 05:27:44 ago) Jan 23 2015 compare

Other Languages

122,292 1.0.9 (2026-11-26 23:16:49 ago) Nov 01 2024 compare
23,559 1.0.58 (2026-11-15 00:18:00 ago) Feb 01 2024 compare
15,138 1.65.2 (2026-11-14 00:28:39 ago) Feb 24 2021 compare
rod
7,161 v0.116.2 (2024-07-12 11:52:28 ago) Sep 23 2022 compare
34,616 4.54.0 (2026-11-23 09:08:00 ago) Apr 25 2008 compare
212,309 4.59.0 (2026-11-27 20:51:38 ago) Apr 01 2024 compare
12,918 3.5.5 (2024-02-17 17:18:36 ago) Sep 04 2020 compare
88,096 0.9.6 (2026-11-20 09:46:46 ago) May 01 2024 compare
13,900 0.5.9 (2026-11-01 06:22:04 ago) Mar 01 2024 compare
4,969 0.50.99 (2026-10-26 13:47:46 ago) Jan 15 2024 compare
7,155 3.0.1 (2026-11-08 11:38:44 ago) Jun 01 2024 compare
13,387 v0.24.0 (2026-11-18 05:04:28 ago) Mar 11 2022 compare
1,837 0.7.1 (2026-11-13 15:27:15 ago) Dec 28 2012 compare
32,991 2.3.1 (2026-10-06 08:27:56 ago) Jan 15 2024 compare
3,072 v2.4.0 (2026-01-08 05:29:21 ago) Jul 17 2018 compare
861 1.9.4 (2024-10-22 01:41:19 ago) Jul 22 2022 compare
4,190 3.5 (2020-06-16 13:27:02 ago) Apr 25 2014 compare
Was this page helpful?