Add web browsing capabilities to Browser Use
Integrate Browserbase with Browser Use
Get your API Key
Visit the Dashboard’s Overview tab:
Then copy and set the BROWSERBASE_API_KEY
and BROWSERBASE_PROJECT_ID
environment variables in your .env
file.
Install and create a virtual environment with UV
UV is a modern package manager for Python.
Install Browserbase and Browser Use
Create the Browser Session
We’ll create a browser session using Browserbase’s CDP connection with proper configuration for remote browser stability.
Configure Browser Profile
Set up the browser profile with appropriate timeouts and settings for remote browser usage:
Create and Run the Agent
Set up the LLM and create the browser automation agent:
Run your script
Run your script:
You should see your Browserbase session start in Browserbase. The debug URL will be printed to console for real-time session monitoring.
Important Environment Variables
Make sure you have these environment variables in your .env
file:
BROWSERBASE_API_KEY
BROWSERBASE_PROJECT_ID
ANTHROPIC_API_KEY
Key Configuration Notes
- Use
BrowserSession
directly instead of custom context classes - Set
max_actions_per_step=1
for better stability with remote browsers - Use the debug URL to monitor your session in real-time
- Increase timeouts to handle remote browser latency
Common Issues & Fixes
- If actions timeout, increase
default_timeout
anddefault_navigation_timeout
- If browser context closes unexpectedly, ensure
keep_alive=True
in bothBrowserProfile
andBrowserSession
- For troubleshooting, check the debug URL to see what’s happening in the browser
- Reach out to us at support@browserbase.com