Skip to main content

Basic Usage

This example demonstrates how to:
  1. Create an AnchorBrowser session using the AnchorBrowser SDK
  2. Get the CDP URL from the session
  3. Connect Stagehand to the browser via CDP
  4. Perform AI-powered browser automation

Prerequisites

Set the following environment variables:
  • ANCHORBROWSER_API_KEY - Your Anchorbrowser API key
  • MODEL_API_KEY, OPENAI_API_KEY, or GOOGLE_API_KEY - Your LLM provider API key
Set ANCHOR_BROWSER_API_KEY for AnchorBrowser authentication, and one of MODEL_API_KEY, OPENAI_API_KEY, or GOOGLE_API_KEY for your LLM provider.