Automate a web task in natural language with Stagehand
Stagehand's starter project scripts a browser with plain-English instructions. act, extract and observe handle single steps, and agent runs a multi-step task on its own.
The problem
Hand-written Playwright or Selenium selectors break when a site changes its layout. Describing each step in natural language makes scrapers and form-fillers less fragile.
Steps
- Scaffold a project with npx create-browser-app.
- cd into the new folder and copy .env.example to .env.
- Add a model provider key, such as OPENAI_API_KEY, and BROWSERBASE_API_KEY if you want cloud browsers.
- Edit the script to use act for clicks, extract for structured data and observe to list what's on the page.
- Run it with npm start.
From the official docs
await stagehand.act("Click the 'Evals' button.");
const extractResult = await stagehand.extract("Extract the value proposition from the page.");
const observeResult = await stagehand.observe("What can I click on this page?");
Results as reported by Browserbase (Stagehand)
- A TypeScript script that clicks, extracts and inspects pages from short instructions.
- agent.execute runs multi-step goals with a computer-use model.
- The same script runs on a local browser or on Browserbase cloud browsers.
These figures are as reported by Browserbase (Stagehand) in Stagehand docs ↗. AgentGid did not measure or independently verify them.
This suits a developer comfortable with TypeScript and Node who wants sturdier scrapers or form-fillers, and who can supply a model API key. Model usage is billed separately from the free MIT library, so costs scale with how many pages and agent runs you do, and Browserbase cloud browsers are only needed if you skip local ones. Browser Use (Free) ranks one place higher and is also open source.
The agent used here
Similar use cases
Grab's designers and ops teams ship their own fixes with Cursor
Grab, the Southeast Asian rides, delivery and payments company, opened Cursor to people outside engineering as well as to engineers. Designers now merge their own production UI fi…
About 98% of employees in Grab's tech organization use Cursor monthly and about 75% weekly, as reported by Cursor.
Cyera rolled out Claude Cowork to 1,500 employees and reached 88% weekly use
Cyera, an AI security company, gave its non-engineering staff Claude Cowork after most of them stalled at the command line with Claude Code. It mapped data access first, connected…
Weekly active usage of Claude reached 88% across roughly 1,500 employees, including new hires, as reported by Anthropic.
How Spotify used its Honk background coding agent to open 240 data-pipeline migration PRs
Spotify used Honk, its internal background coding agent built on Claude Code capabilities, to move downstream consumers off two deprecated datasets. The agent opened 240 migration…
As reported by Spotify, the team 'successfully rolled out 240 automated migration PRs using Fleetshift'.