Documentation Index
Fetch the complete documentation index at: https://docs.driver.dev/llms.txt
Use this file to discover all available pages before exploring further.
Browser-Use is an open-source framework for building autonomous AI agents that browse the web. Combine it with Driver for stealth browsing capabilities.
Installation
# Create environment with uv (Python >= 3.11)
uv init
uv add browser-use requests
uv sync
Setup
Get your API keys:
- Browser-Use Cloud API key
- Driver API key
# .env
BROWSER_USE_API_KEY=your-browser-use-key
DRIVER_API_KEY=your-browser-cash-key
Quick Start
import os
import asyncio
import requests
from browser_use import Agent, Browser, ChatBrowserUse
async def run_agent():
# Create Driver session
resp = requests.post(
"https://api.driver.dev/v1/browser/session",
headers={
"Authorization": f"Bearer {os.getenv('DRIVER_API_KEY')}",
"Content-Type": "application/json",
},
json={},
)
resp.raise_for_status()
data = resp.json()
# Create Browser-Use browser with Driver CDP URL
browser = Browser(cdp_url=data["cdpUrl"])
llm = ChatBrowserUse()
# Create and run agent
agent = Agent(
task="Find the current price of Bitcoin",
llm=llm,
browser=browser,
)
result = await agent.run()
# Cleanup
requests.delete(
"https://api.driver.dev/v1/browser/session",
headers={"Authorization": f"Bearer {os.getenv('DRIVER_API_KEY')}"},
params={"sessionId": data["sessionId"]},
)
return result
if __name__ == "__main__":
result = asyncio.run(run_agent())
print(result)
With Session Options
resp = requests.post(
"https://api.driver.dev/v1/browser/session",
headers={
"Authorization": f"Bearer {os.getenv('DRIVER_API_KEY')}",
"Content-Type": "application/json",
},
json={
"country": "US",
"type": "consumer_distributed", # Maximum stealth
"windowSize": "1920x1080",
},
)
Complex Tasks
agent = Agent(
task="""
1. Go to Amazon.com
2. Search for "wireless headphones"
3. Find the top-rated product under $100
4. Extract the product name, price, and rating
""",
llm=llm,
browser=browser,
)
With Persistent Profiles
Keep login sessions across agent runs:
import os
import requests
headers = {
"Authorization": f"Bearer {os.getenv('DRIVER_API_KEY')}",
"Content-Type": "application/json",
}
# First run — login
resp = requests.post(
"https://api.driver.dev/v1/browser/session",
headers=headers,
json={
"profile": {"name": "my-agent-profile", "persist": True}
},
)
# Agent logs into a service...
# Later runs — already logged in
resp = requests.post(
"https://api.driver.dev/v1/browser/session",
headers=headers,
json={
"profile": {"name": "my-agent-profile", "persist": True}
},
)
Why Driver + Browser-Use?
- Stealth browsing — Consumer distributed nodes avoid detection
- Global reach — Run agents from different countries
- Persistent state — Maintain logins across agent sessions
- Scalability — No local browser management