Browser Use 是一个开源的 Python(也有 TypeScript 版本)库,把大语言模型接到真实浏览器上,由模型自行理解页面结构并执行点击、输入、翻页等操作,从而完成查资料、订票、填表、抓取数据这类多步骤网页任务。它兼容多种模型,可驱动本地 Chrome,也能连接带隐身、验证码处理和住宅代理的云端浏览器,官方称云端价格约为每浏览器小时 0.02 美元。除了作为库嵌入自己的程序,它还提供 CLI 供编码助手直接获得浏览器能力、面向 Claude 的浏览器工具集成,以及托管式 Agent API,支持自定义工具与结构化输出。项目采用 MIT 许可,开源部分免费,模型推理与云端浏览器按用量另计。
pip install browser-useThe open-source browser agent. Run it locally with any LLM, or on Browser Use Cloud: stealth browsers from $0.02/hour, top score (90.5%) on Stealth Bench V2.
Find an available slot, pick a date and time, handle the CAPTCHA, and book a driving test.
AI agents and crawlers: read browser-use.com/llms.txt for the product map (open source, Browser Harness, Cloud browsers, Agents API, pricing) and docs.browser-use.com/llms.txt for the documentation index. Browser Use is the open-source browser agent (Python and TypeScript), a $0.02 per browser-hour cloud browser with stealth, CAPTCHA solving and residential proxies, and a hosted agent API.
Scale browser automation with our hosted agent, stealth browsers, and infrastructure for profiles, recordings, and data policies.
New Google, GitHub, or Microsoft signups get $1 cloud credit.
Paste this prompt into Claude Code, Codex, Hermes, OpenClaw, or your favorite agent.
Install or upgrade browser-use to the latest stable version with uv using Python 3.12, run `browser-use skill install` to register the skill, and connect it to my browser. If setup or connection fails, follow https://github.com/browser-use/browser-harness/blob/main/install.md.
Run the Browser Use agent locally from Python, with your choice of model and a local or cloud browser:
1. Install Browser Use (Python >= 3.11):
With uv installed, run uv init --python 3.12 first if you're starting a new project.
uv add browser-use
2. Add your OpenAI API key to .env:
# .env
OPENAI_API_KEY=your-key
# BROWSER_USE_API_KEY=your-key # Optional: BU2 model or cloud browser
For either optional Browser Use service, get a Browser Use API key.
3. Save this as agent.py:
import asyncio
from browser_use import Agent, Browser, ChatBrowserUse, ChatOpenAI
from dotenv import load_dotenv
load_dotenv()
async def main():
llm = ChatOpenAI(model='gpt-5.6-luna', reasoning_effort='xhigh')
# llm = ChatBrowserUse(model='bu-2-0') # Use BU2 instead; requires BROWSER_USE_API_KEY
agent = Agent(
task="Find the number of stars of the browser-use repo",
llm=llm,
# browser=Browser(use_cloud=True), # Use a cloud browser; requires BROWSER_USE_API_KEY
)
history = await agent.run()
print(history.final_result())
if __name__ == "__main__":
asyncio.run(main())
To use BU2, replace the ChatOpenAI line with the commented ChatBrowserUse line. The cloud-browser option works with either model.
4. Run it:
uv run agent.py
The agent opens a browser, looks up the repository, and prints its answer.
5. Run the same agent on a cloud browser (no Chrome to install; works in Docker, CI, and serverless):
Set BROWSER_USE_API_KEY (get a key), then uncomment the browser= line in agent.py and run it again:
agent = Agent(
task="Find the number of stars of the browser-use repo",
llm=llm,
browser=Browser(use_cloud=True),
)
Cloud browsers cost $0.02 per browser-hour plus network traffic (pricing), and add stealth, residential proxies, CAPTCHA solving, and a live view URL. Same code, no other changes.
Maintained by Browser Use. Compatible with Claude.
Use Claude's browser toolset with Browser Use as the driver. Browser Use implements all 31 browser actions and can control a local browser, a Browser Use Cloud browser, or an existing remote browser over CDP. Bash is included in the Browser Use integration for processing data and writing files.
Requires an Anthropic SDK version that includes anthropic.tools.browser.
Bash requires a Linux or macOS host with /bin/bash; use WSL on Windows.
The snippet below runs inside an async function; see the quickstart for a complete script.
import os
from anthropic import AsyncAnthropic
from browser_use.integrations.toolsets_for_claude import Bash, BrowserUse
task = 'Open example.com and report its page title.'
driver = BrowserUse() # Or BrowserUse(use_cloud=True)
bash = Bash(output_dir='outputs')
async with driver, AsyncAnthropic() as client:
runner = client.beta.messages.tool_runner(
model=os.environ['ANTHROPIC_MODEL'],
max_tokens=32_768,
max_iterations=100,
tools=[driver, bash],
messages=[{'role': 'user', 'content': task}],
)
result = await runner.until_done()

This very hard benchmark targets the hardest browser tasks. On easier tasks, even smaller models can achieve very high success rates. Results shown are from a 60-task subset of BU Bench V2.
Should I use the fully hosted cloud, CLI, or Python library?
The CLI and Python library can each connect to a local or cloud browser. A cloud browser hosts the browser; the fully hosted API runs the agent as well.
What's the best model to use?
We recommend BU2, our model optimized for browser automation: ChatBrowserUse(model='bu-2-0'). It uses BROWSER_USE_API_KEY; ChatBrowserUse() currently selects the same model.
The best choice depends on your tasks, latency, and budget. See the BU2 model card, benchmark, and supported models and pricing to compare options.
Can I use Claude / GPT / Gemini through ChatBrowserUse?
Yes. ChatBrowserUse accepts provider-prefixed model IDs through the Browser Use gateway, using BROWSER_USE_API_KEY:
from browser_use import Agent, ChatBrowserUse
llm = ChatBrowserUse(model='anthropic/claude-sonnet-4-6') # or 'google/gemini-3-pro'
agent = Agent(task='...', llm=llm)
You can also use providers directly through wrappers such as ChatOpenAI, ChatAnthropic, and ChatGoogle, with each provider's own API key. See supported models.
Do I need to provide a system prompt?
No. Agent(...) supplies the Browser Use system prompt automatically, including when you change models. Put your task in task=. Use extend_system_message to add instructions or override_system_message to replace the default prompt when you need custom behavior.
See the custom system prompt example.
Can I use custom tools with the agent?
Yes. Register a function with Tools and pass it to the agent. This example adds a tool for the current UTC time and uses BROWSER_USE_API_KEY from .env:
import asyncio
from datetime import datetime, timezone
from browser_use import ActionResult, Agent, ChatBrowserUse, Tools
from dotenv import load_dotenv
load_dotenv()
tools = Tools()
@tools.action(description='Get the current date and time in UTC.')
def get_current_time() -> ActionResult:
return ActionResult(extracted_content=datetime.now(timezone.utc).isoformat())
async def main():
agent = Agent(
task="What is the current UTC time?",
llm=ChatBrowserUse(model='bu-2-0'),
tools=tools,
)
history = await agent.run()
print(history.final_result())
if __name__ == "__main__":
asyncio.run(main())
Can I use this for free?
The Python library is free and MIT-licensed. Model inference and hosted browsers are separate: API providers, including ChatBrowserUse, and Browser Use Cloud charge for usage. You can also use a local browser and a local model through Ollama, subject to your hardware and model requirements.
Terms of Service
This open-source library is licensed under the MIT License. For Browser Use services & data policy, see our Terms of Service and Privacy Policy.
How do I handle authentication?
Browser.from_system_chrome() to reuse a Chrome profile. See the real-browser guide and example.Browser(use_cloud=True, cloud_profile_id='your-profile-id').Profile sync transfers cookies, not local storage, IndexedDB, or extensions. Some sites may require you to sign in again.
How do I solve CAPTCHAs?
Browser Use Cloud provides stealth browsers and proxies designed to reduce bot detection and CAPTCHA challenges. With the Python library, enable a cloud browser with Browser(use_cloud=True) and set BROWSER_USE_API_KEY.
Results depend on the site and challenge; no browser configuration guarantees that every CAPTCHA can be avoided or solved.
How do I go into production?
Choose how much you want to manage:
You can also host the Python library and browsers on your own infrastructure.
| Repository | What it's for |
|---|---|
| Browser Harness | Our CLI for giving AI agents control of your browser. |
| Browser Harness JS | Give your JavaScript agent control of a real browser. |
| Browser Use Pi | Run a TypeScript browser agent built on Pi. |
| Cloud SDK | Integrate Browser Use Cloud into your application. |
| Video Use | Edit videos with your coding agent. |
| macOS Harness | Give your agent control of Mac apps, browsers, and files. |
| Benchmark | Explore browser tasks and compare agent performance. |
If you use Browser Use in your research or project, please cite:
@software{browser_use2024,
author = {Müller, Magnus and Žunič, Gregor},
title = {Browser Use: Enable AI to control your browser},
year = {2024},
publisher = {GitHub},
url = {https://github.com/browser-use/browser-use}
}
Tell your computer what to do, and it gets it done.
Made with ❤️ in Zurich and San Francisco
内容由编辑整理,部分信息来自 GitHub 与项目官网,版权归原作者所有。发现错误?报告问题