Browser Use
Add web browsing capabilities to Browser Use
Integrate Browserbase with Browser Use
1
Get your API Key
Go over the Dashboard’s Settings tab:
Then copy and set the BROWSERBASE_API_KEY
and BROWSERBASE_PROJECT_ID
environment variables 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 an Extended Browser Session and Context
We’ll create an extended version of the Browser Use context that better handles page management and session state.
main.py
5
Set up Browser and Agent Configuration
Here’s how to configure the browser and create an automation agent:
main.py
6
Create the Main Function
Here’s the main function that puts everything together:
main.py
7
Run your script
Run your script:
You should see your Browserbase session start in Browserbase.
Important Environment Variables
Make sure you have these environment variables in your .env
file:
BROWSERBASE_API_KEY
BROWSERBASE_PROJECT_ID
ANTHROPIC_API_KEY
Common Issues & Fixes
Seeing blank or multiple tabs? You can:
- Inspect them in the Sessions Inspector
- Access them via Live View Multitab
- Reach out to us at support@browserbase.com
Was this page helpful?