Quickstart
You can get started with Stagehand in just 1 minute! Choose your preferred language below.
For TypeScript/Node.js: We highly recommend using the Node.js runtime environment to run Stagehand scripts, as opposed to newer alternatives like Deno or Bun.
Bun does not support Stagehand since it doesn’t support Playwright.
For Python: We require Python 3.9+ and recommend using uv to manage your virtual environment.
Before you begin, you’ll need to install Node.js and NPM. We highly recommend using nvm to manage your Node.js versions, and running on Node version 20+.
Create a new project
You can use npx to create a new project. You should have npx included with npm
, the default package manager for Node.js.
To use our Contexts with Stagehand, run:
You can easily deploy Stagehand scripts to Vercel in one line! Simply run:
We also have an example using CUA agents, where we put OpenAI Operator against Anthropic’s Claude Computer Use in a heated game of chess. It’s just ten lines of Stagehand code, try it with:
You can also use the version of Stagehand that’s on main but not released yet. This will have the bleeding edge features, but they may not be fully prod-ready yet. To test this version, try:
It will ask you the following questions:
Install dependencies and run the script
Use the package manager of your choice to install the dependencies. We also have a postinstall
script that will automatically install the Playwright browser with playwright install
.
Before you begin, you’ll need to install Node.js and NPM. We highly recommend using nvm to manage your Node.js versions, and running on Node version 20+.
Create a new project
You can use npx to create a new project. You should have npx included with npm
, the default package manager for Node.js.
To use our Contexts with Stagehand, run:
You can easily deploy Stagehand scripts to Vercel in one line! Simply run:
We also have an example using CUA agents, where we put OpenAI Operator against Anthropic’s Claude Computer Use in a heated game of chess. It’s just ten lines of Stagehand code, try it with:
You can also use the version of Stagehand that’s on main but not released yet. This will have the bleeding edge features, but they may not be fully prod-ready yet. To test this version, try:
It will ask you the following questions:
Install dependencies and run the script
Use the package manager of your choice to install the dependencies. We also have a postinstall
script that will automatically install the Playwright browser with playwright install
.
Before you begin, you’ll need Python 3.9+ installed. We recommend using uv to manage your virtual environment.
Install Stagehand Python
Set up environment variables
Create a .env
file or export environment variables:
Create your first script
Create a file main.py
:
Run the script
Next Steps