Skip to content

Install

Prerequisites

  • A Browserbase account and API key: https://www.browserbase.com
  • Set the environment variable: BROWSERBASE_API_KEY=<your-key>
  • For session-scoped projects also set: BROWSERBASE_PROJECT_ID=<your-project-id>

Node.js

Install the Browserbase SDK and playwright-core (the CDP driver):

bash
npm i playwright-core @browserbasehq/sdk

Or with pnpm:

bash
pnpm add playwright-core @browserbasehq/sdk

Python

Install the Browserbase Python SDK and Playwright:

bash
pip install playwright browserbase

After install, also run the Playwright browser binary download (only needed once for local fallback; not required for cloud sessions):

bash
playwright install chromium

Stagehand (AI browser framework built on Browserbase)

Stagehand is an optional higher-level framework that wraps Browserbase with LLM-powered actions:

bash
npm i @browserbasehq/stagehand

Starter Templates

Browserbase ships 12+ ready-to-use templates at https://www.browserbase.com/templates, including:

  • Getting started with Browserbase (/templates/getting-started-with-browserbase) - covers Search API, Fetch, and browser sessions with Playwright in one script
  • Build a browser agent (/templates/browser-agent-demo) - autonomous agent using Stagehand
  • Scrape Amazon products (/templates/amazon-product-scraping)
  • AI-powered form filling (/templates/dynamic-form-filling)
  • Human-in-the-loop agent (/templates/agent-with-human-in-loop)