Skip to main content
0
S

Stagehand Python

The AI Browser Automation Framework

Rating

0.0

Votes

0

score

Downloads

0

total

Price

Free

API key required

Works With

Claude CodeCursorWindsurfVS CodeDeveloper tool

About

The AI Browser Automation Framework Read the Docs

)

If you're looking for other languages, you can find them here

Vibe code Stagehand with

Director

!TIP] Migrating from the old v2 Python SDK? See our [migration guide here.

What is Stagehand?

Stagehand is a browser automation framework used to control web browsers with natural language and code. By combining the power of AI with the precision of code, Stagehand makes web automation flexible, maintainable, and actually reliable.

Why Stagehand?

Most existing browser automation tools either require you to write low-level code in a framework like Selenium, Playwright, or Puppeteer, or use high-level agents that can be unpredictable in production. By letting developers choose what to write in code vs. natural language (and bridging the gap between the two) Stagehand is the natural choice for browser automations in production.

  1. 1.Choose when to write code vs. natural language: use AI when you want to navigate unfamiliar pages, and use code when you know exactly what you want to do.
  1. 1.Go from AI-driven to repeatable workflows: Stagehand lets you preview AI actions before running them, and also helps you easily cache repeatable actions to save time and tokens.
  1. 1.Write once, run forever: Stagehand's auto-caching combined with self-healing remembers previous actions, runs without LLM inference, and knows when to involve AI whenever the website changes and your automation breaks.

Installation

sh
# install from PyPI
uv pip install stagehand

For local development or when working from this repository, sync the dependency lockfile with uv (see the Local development section below) before running project scripts.

Requirements

Python 3.9 or higher.

Running the Example

Set your environment variables (from examples/.env.example):

  • STAGEHAND_API_URL
  • MODEL_API_KEY
  • BROWSERBASE_API_KEY
  • BROWSERBASE_PROJECT_ID
bash
cp examples/.env.example examples/.env
# Edit examples/.env with your credentials.

The examples load examples/.env automatically.

Examples and dependencies:

  • examples/full_example.py: stagehand only
  • examples/act_example.py: stagehand only
  • examples/agent_execute.py: stagehand only
  • examples/local_example.py: stagehand only
  • examples/logging_example.py: stagehand only
  • examples/remote_browser_playwright_example.py: Playwright + Playwright browsers
  • examples/local_browser_playwright_example.py: Playwright + Playwright browsers
  • examples/playwright_page_example.py: Playwright + Playwright browsers
  • examples/byob_example.py: Playwright + Playwright browsers
  • examples/pydoll_tab_example.py: pydoll-python (Python 3.10+)

Multiregion support: see examples/local_server_multiregion_browser_example.py.

Don't lose this

Three weeks from now, you'll want Stagehand Python again. Will you remember where to find it?

Save it to your library and the next time you need Stagehand Python, it’s one tap away — from any AI app you use. Group it into a bench with the rest of the team for that kind of task and you can pull the whole stack at once.

⚡ Pro tip for geeks: add a-gnt 🤵🏻‍♂️ as a custom connector in Claude or a custom GPT in ChatGPT — one click and your library is right there in the chat. Or, if you’re in an editor, install the a-gnt MCP server and say “use my [bench name]” in Claude Code, Cursor, VS Code, or Windsurf.

🤵🏻‍♂️

a-gnt's Take

Our honest review

This plugs directly into your AI and gives it new abilities it didn't have before. The AI Browser Automation Framework. Once connected, just ask your AI to use it. It's completely free and works across most major AI apps. This one just landed in the catalog — worth trying while it's fresh.

Tips for getting started

1

Tap "Get" above, pick your AI app, and follow the steps. Most installs take under 30 seconds.

2

Heads up: this needs an API key to work. You'll get one from the service's website (usually free). The setup guide tells you exactly where.

What's New

Version 1.0.06 days ago

Imported from GitHub

Ratings & Reviews

0.0

out of 5

0 ratings

No reviews yet. Be the first to share your experience.