从 Browser Use 官方 GitHub README 翻译整理的快速上手指南。
Browser Use 是一个开源 AI 工具,它能让 AI 智能体像人一样操作浏览器——打开网页、点击按钮、输入文字、填写表单。你只需要描述任务,AI 就会自动完成。
Browser Use 可以帮你做很多事情,比如:
如果你在用 Claude Code、Codex、Cursor 等 AI 工具,直接粘贴下面这段提示词,它会自动帮你完成安装和配置:
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.
如果你想在自己的代码中大规模使用,推荐安装 Python 库:
1. 安装 Browser Use(需要 Python >= 3.11):
uv add browser-use
# 或者:pip install browser-use
2. 在 .env 文件中添加 LLM API 密钥。可以从 Browser Use Cloud 获取,也可以使用你自己的提供商密钥:
# .env
BROWSER_USE_API_KEY=your-key
# GOOGLE_API_KEY=your-key
# ANTHROPIC_API_KEY=your-key
安装完成后,运行以下代码即可体验第一个自动化任务:
import asyncio
from browser_use import Agent, ChatBrowserUse
async def main():
agent = Agent(
task="Find the number of stars of the browser-use repo",
)
这段代码会让 AI 自动打开浏览器,查询 browser-use 仓库的 star 数量。
翻译整理自 GitHub README,原文:https://github.com/browser-use/browser-use