星标数:120922★ Fork数:13520 《browser-use:开源的 AI 浏览器智能体 Python 库》
browser-use 是一个开源的浏览器智能体项目:你只需给出一个任务,模型就会在真实浏览器中通过编写 Python 代码来完成它。整个智能体的运行机制非常简洁——一个持久化的 REPL、browser-harness 辅助函数以及原生的 Chrome DevTools Protocol(CDP)。它可以运行在任意 LLM 上,既可以本地运行,也可以运行在 Browser Use Cloud 上,项目采用 MIT 许可证。
智能体的工作流程是:模型在 REPL 中写一个单元格,REPL 在 Chrome(CDP)上执行并把输出返回给模型,直到任务完成并返回结果。正如 README 所概括的:模型、REPL 和 CDP,这就是整个智能体。
它能像人类一样浏览网页:例如找到可用的驾考名额、选择日期和时间、处理验证码并完成预约。项目提供三种使用方式:完全托管的 Cloud 服务、CLI,以及本地运行的开源 Python 库。
主要特点
- 开源 Python 库(1.0 版本),基于 Pydantic AI,智能体在持久化 REPL 中针对原生 CDP 编写 Python 代码
- 支持全托管云端方案:托管智能体、隐形浏览器,以及针对配置文件、录制和数据策略的基础设施
- 提供 CLI,可将提示词粘贴到 Claude Code、Codex、Hermes、OpenClaw 等智能体工具中使用
- 可驱动多种浏览器:Browser Use Cloud 浏览器(默认)、全新本地 Chrome/Chromium/Edge、已打开的 Chrome(含登录状态),以及基于 Chrome 配置文件的临时副本
- 支持多种模型:内置 ChatOpenAI、ChatAnthropic、ChatGoogle,以及任意 Pydantic AI 模型字符串
- 支持结构化输出(output_model_model_schema / structured_output)、文件上传(upload_file)等功能
快速开始:Python 库
需要 Python 3.11 或更高版本。使用 uv:
uv init --python 3.12 my-agent && cd my-agent
uv add 'browser-use==1.0.3'
export BROWSER_USE_API_KEY=bu_... # 在 https://cloud.browser-use.com/new-api-key 获取
或使用 pip(在虚拟环境中):
python3 -m venv .venv && source .venv/bin/activate
pip install 'browser-use==1.0.3'
export BROWSER_USE_API_KEY=bu_...
基本用法示例:
from browser_use import Agent
result = Agent('Find the number of stars of the browser-use repo').run_sync()
print(result.final_result())
使用本地浏览器和自己的模型:
from browser_use import Agent, Browser, ChatOpenAI
agent = Agent(
'Find the number of stars of the browser-use repo',
llm=ChatOpenAI('gpt-6-luna'),
browser=Browser('chromium'),
)
print(agent.run_sync().final_result())
快速开始:CLI
Install browser-use with `uv tool install browser-use==1.0.3`, run `browser-use skill install` to register the skill, and connect it to my browser. If setup or connection fails, run `browser-use --doctor` and follow its output and the error message.
注意:README 建议在项目中务必精确锁定版本(使用 browser-use==1.0.3,不要用 >=),因为版本迭代较快,发布可能会破坏 API。
📊 本项目 GitHub 星标数:120922。最后更新:2026-11-13,发布:2026-11-12。项目地址:https://github.com/browser-use/browser-use
