Skip to main content
1

Get your API key

Visit the Dashboard’s Overview tab:
Then copy and set the BROWSERBASE_API_KEY environment variable in your .env file.
2

Install and create a virtual environment with UV

UV is a modern package manager for Python.
3

Install Browserbase and Browser Use

4

Create the automation script

Browser Use provides a simple Browser class that accepts a CDP URL from Browserbase. Create a main.py file:
main.py
5

Run your script

Run your script:
You should see your Browserbase session start in Browserbase. The debug URL prints to the console for real-time session monitoring.
Important environment variablesMake sure you have these environment variables in your .env file:
  • BROWSERBASE_API_KEY
  • ANTHROPIC_API_KEY (or another LLM provider key)
Notes
  • The BrowserProfile(cdp_url=...) connects to your Browserbase session via CDP
  • Browser Use handles browser lifecycle, Playwright management, and cleanup automatically
  • You can configure the LLM by passing a llm parameter to Agent (e.g. ChatAnthropic, ChatOpenAI)
  • Reach out at support@browserbase.com for additional support

Browserbase and Browser Use sample code

Configure Browserbase to add additional web-browsing capabilities to your Browser Use.