如何安装
Run a hosted agent or launch a cloud browser.
Give an agent a task and get the result.
Launch a cloud browser and connect to it from your code.
Both Cloud paths use API V4. Choose whether Browser Use drives the browser or your Playwright/Puppeteer code connects directly over CDP. For a local agent, use the open-source library.
Get an API key and export it:
export BROWSER_USE_API_KEY=your_key
Install the SDK
Use Python 3.10 or newer for the Python SDK. Skip installation if you use curl.
pip install --upgrade browser-use-sdk playwright
npm install browser-use-sdk@latest puppeteer-core
Run Browser Use Agents
from browser_use_sdk.v4 import BrowserUse
with BrowserUse() as client:
run = client.runs.create("Find the top Hacker News story")
result = client.runs.wait_for_completion(run.id)
print(result.result)
import { BrowserUse } from "browser-use-sdk/v4";
const client = new BrowserUse();
const run = await client.runs.create({
task: "Find the top Hacker News story",
});
const result = await client.runs.waitForCompletion(run.id);
console.log(result.result);
curl https://api.browser-use.com/api/v4/runs \
-H "X-Browser-Use-API-Key: $BROWSER_USE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"task":"Find the top Hacker News story"}'
Use Browser Infrastructure
These examples connect to the managed browser's existing context and stop it
in finally, including when connecting or navigating fails.
from browser_use_sdk.v4 import BrowserUse
from playwright.sync_api import sync_playwright
with BrowserUse() as client:
session = client.browsers.create(proxy_country_code="us")
try:
if not session.cdp_url:
raise RuntimeError("The browser did not return a CDP URL")
with sync_playwright() as p:
browser = p.chromium.connect_over_cdp(session.cdp_url)
context = browser.contexts[0]
page = context.pages[0] if context.pages else context.new_page()
page.goto("https://example.com")
print(page.title())
finally:
client.browsers.stop(session.id)
import { BrowserUse } from "browser-use-sdk/v4";
import puppeteer from "puppeteer-core";
const client = new BrowserUse();
const session = await client.browsers.create({ proxyCountryCode: "us" });
try {
if (!session.cdpUrl) throw new Error("The browser did not return a CDP URL");
const browser = await puppeteer.connect({ browserWSEndpoint: session.cdpUrl });
try {
const context = browser.defaultBrowserContext();
const page = (await context.pages())[0] ?? await context.newPage();
await page.goto("https://example.com");
console.log(await page.title());
} finally {
await browser.disconnect();
}
} finally {
await client.browsers.stop(session.id);
}
Disconnecting CDP does not stop the managed browser. Use
client.browsers.stop(session.id) as above, or call
PATCH /api/v4/browsers/{id} with {"action":"stop"}.
For curl and additional connection options, follow the Browser Infrastructure quickstart.
Give your coding agent the compact API V4 context.
Azure OpenAI with data privacy and security configuration.
Secure Setup with Azure OpenAI
Enterprise-grade security with Azure OpenAI, data privacy protection, and restricted browser access.
import asyncio
import os
from dotenv import load_dotenv
load_dotenv()
os.environ['ANONYMIZED_TELEMETRY'] = 'false'
from browser_use import Agent, BrowserProfile, ChatAzureOpenAI
# Azure OpenAI configuration
api_key = os.getenv('AZURE_OPENAI_KEY')
azure_endpoint = os.getenv('AZURE_OPENAI_ENDPOINT')
llm = ChatAzureOpenAI(model='gpt-4.1-mini', api_key=api_key, azure_endpoint=azure_endpoint)
# Secure browser configuration
browser_profile = BrowserProfile(
allowed_domains=['*google.com', 'browser-use.com'],
enable_default_extensions=False
)
# Sensitive data filtering
sensitive_data = {'company_name': 'browser-use'}
# Create secure agent
agent = Agent(
task='Find the founders of the sensitive company_name',
llm=llm,
browser_profile=browser_profile,
sensitive_data=sensitive_data
)
async def main():
await agent.run(max_steps=10)
asyncio.run(main())
Security Features
Azure OpenAI:
- NOT used to train OpenAI models
- NOT shared with other customers
- Hosted entirely within Azure
- 30-day retention (or zero with Limited Access Program)
Browser Security:
allowed_domains: Restrict navigation to trusted sitesenable_default_extensions=False: Disable potentially dangerous extensionssensitive_data: Filter sensitive information from LLM input
For enterprise deployments contact support@browser-use.com.
How to contribute — code standards, PR process, testing requirements, and submitting your first pull request.
Mission
- Make developers happy
- Do more clicks than human
- Tell your computer what to do, and it gets it done.
- Make agents faster and more reliable.
What to work on?
- This space is moving fast. We have 10 ideas daily. Let us exchange some.
- Browse our GitHub Issues
- Check out our most active issues on Discord
- Get inspiration in
#showcase-your-workchannel
What makes a great PR?
- Why do we need this PR?
- Include a demo screenshot/gif
- Make sure the PR passes all CI tests
- Keep your PR focused on a single feature
How?
- Fork the repository
- Create a new branch for your feature
- Submit a PR
We are overwhelmed with Issues. Feel free to bump your issues/PRs with comments periodically if you need faster feedback.
Set up for local development. Clone the repo, install dependencies, and run tests to start contributing.
Welcome to Browser Use Development!
git clone https://github.com/browser-use/browser-use
cd browser-use
uv sync --all-extras --dev
# or pip install -U git+https://github.com/browser-use/browser-use.git@main
Configuration
Set up your environment variables:
# Copy the example environment file
cp .env.example .env
# set logging level
# BROWSER_USE_LOGGING_LEVEL=debug
Helper Scripts
For common development tasks
# Complete setup script - installs uv, creates a venv, and installs dependencies
./bin/setup.sh
# Run all pre-commit hooks (formatting, linting, type checking)
./bin/lint.sh
# Run the core test suite that's executed in CI
./bin/test.sh
Run examples
uv run examples/simple.py
