🌐 Make websites accessible for AI agents
GitHub: browser-use/browser-use (90k+ ⭐)
License: MIT | Language: Python 3.11+ | 安装方式: uv
browser-use 让 AI 代理能够控制浏览器完成网页自动化任务,核心理念:
Tell your computer what to do, and it gets it done.
能力说明填表自动填写表单、求职申请购物读取购物列表,自动在 Instacart 下单搜索比价帮用户找 PC 配件、比较价格网页操作点击、输入、截图、导航多平台集成Gmail、Slack、Notion 等 1000+ 集成
bash
# 1. 创建环境并安装
uv init && uv add browser-use && uv sync
# 2. 安装 Chromium(若无浏览器)
uvx browser-use install
# 3. 运行第一个代理
uvx browser-use init --template default
bash
# 克隆到 skills 目录
cd /root/.openclaw/workspace/skills
git clone https://github.com/browser-use/browser-use.git browser-use
# 或直接安装
npx clawhub@latest install browser-use
bash
# 创建 .env 文件
cat > .env << EOF
# Browser Use 云端 API(推荐,支持 Stealth + Proxy)
BROWSER_USE_API_KEY=your-key
# 或使用其他 LLM
GOOGLE_API_KEY=your-key
ANTHROPIC_API_KEY=your-key
OPENAI_API_KEY=your-key
EOF
服务地址费用Browser Use Cloudcloud.browser-use.com免费额度 + 按量付费Google AIaistudio.google.com免费额度Anthropicconsole.anthropic.com按量付费OpenAIplatform.openai.com按量付费**Ollama(本地)**ollama.com免费(自托管)
python
from browser_use import Agent, Browser, ChatBrowserUse
import asyncio
async def main():
browser = Browser() # 本地浏览器
# browser = Browser(use_cloud=True) # 云端 Stealth 浏览器
agent = Agent(
task="Find the number of stars of the browser-use repo",
llm=ChatBrowserUse(), # 或 ChatAnthropic(model='claude-sonnet-4-6')
browser=browser,
)
await agent.run()
if __name__ == "__main__":
asyncio.run(main())
python
# Google Gemini
from browser_use import ChatGoogle
agent = Agent(task="...", llm=ChatGoogle(model='gemini-3-flash-preview'), browser=browser)
# Anthropic Claude
from browser_use import ChatAnthropic
agent = Agent(task="...", llm=ChatAnthropic(model='claude-sonnet-4-6'), browser=browser)
# 本地 Ollama
from browser_use import ChatOllama
agent = Agent(task="...", llm=ChatOllama(model='llama3'), browser=browser)
bash
# 打开网页
browser-use open https://example.com
# 查看可点击元素
browser-use state
# 点击元素(按索引)
browser-use click 5
# 输入文本
browser-use type "Hello World"
# 截图
browser-use screenshot page.png
# 关闭浏览器
browser-use close
bash
# 生成默认模板
uvx browser-use init --template default
# 生成高级配置模板
uvx browser-use init --template advanced
# 生成自定义工具示例
uvx browser-use init --template tools
python
from browser_use import Agent, Browser, Tools
# 定义自定义工具
tools = Tools()
@tools.action(description='获取指定 GitHub 仓库的星数')
def get_github_stars(repo: str) -> str:
"""查询 GitHub 仓库的星数"""
import requests
r = requests.get(f"https://api.github.com/repos/{repo}")
return r.json().get("stargazers_count", "Unknown")
# 创建代理
agent = Agent(
task="查询 browser-use 仓库的星数",
llm=ChatBrowserUse(),
browser=Browser(),
tools=tools,
)
await agent.run()
python
from browser_use import Agent, Browser
browser = Browser(
chrome_instance_path="/path/to/chrome", # 复用本地 Chrome
)
agent = Agent(
task="登录我的 Gmail 并发送邮件",
llm=ChatBrowserUse(),
browser=browser,
)
bash
# 同步认证信息到云端
curl -fsSL https://browser-use.com/profile.sh | \
BROWSER_USE_API_KEY=XXXX sh
特性开源版云端版(推荐)费用免费(需自备 LLM API)免费额度 + 按量Stealth❌ 需自配✅ Proxy 轮换 + CAPTCHA 解决维护需自己运维✅ 全托管自定义工具✅ 深度集成✅ 支持并发规模受限于本地资源✅ 可水平扩展
python
agent = Agent(
task="Fill in this job application with my resume and information.",
llm=ChatBrowserUse(),
browser=Browser(),
)
await agent.run()
python
agent = Agent(
task="Put this list of items into my instacart: milk, eggs, bread.",
llm=ChatBrowserUse(),
browser=Browser(),
)
await agent.run()
python
agent = Agent(
task="Help me find parts for a custom PC within budget $1500.",
llm=ChatBrowserUse(),
browser=Browser(),
)
await agent.run()
问题解决方案Chromium 未安装uvx browser-use installAPI Key 报错检查 .env 文件配置浏览器无法启动chrome --version 确认已安装 Chrome被网站检测使用云端版 Browser(use_cloud=True)任务失败增加 max_steps 参数
bash
# 安装 MCP
cd /root/.openclaw/workspace
npx clawhub@latest install browser-use-mcp
# 添加到 mcporter 配置
openclaw mcp add browser-use --command "python -m browser_use.mcp"
bash
mkdir -p ~/.claude/skills/browser-use
curl -o ~/.claude/skills/browser-use/SKILL.md \
https://raw.githubusercontent.com/browser-use/browser-use/main/skills/browser-use/SKILL.md
类型价格(每 1M tokens)输入$0.20缓存输入$0.02输出$2.00
模型特点bu-30b-a3b-previewBrowser Use 专用优化模型claude-sonnet-4-6Anthropic 最新旗舰gemini-3-flash-previewGoogle 高效模型**llama3(Ollama)**免费本地运行
text
用户说「帮我自动填表」→ browser-use 填表示例
用户说「自动帮我购物」→ browser-use 购物示例
用户说「AI 控制浏览器」→ 展示 browser-use 能力
用户说「安装 browser-use」→ 执行安装步骤
用户说「配置 API key」→ 执行配置流程
text
用户:「帮我自动化完成这个求职申请流程」
→ 分析表单字段
→ 调用 browser-use Agent
→ 配置 ChatBrowserUse() LLM
→ 自动执行填表 + 上传简历
关联技能关系chrome-devtools-mcp浏览器自动化底层工具browser-automation-stealth隐身浏览器技术cognee-memory记忆管理(跨会话持久化)ai-research-tools科研数据自动采集
text
⚠️ 注意事项:
- Python >= 3.11 required
- 建议使用 uv 管理依赖
- 云端版有免费额度
- 部分网站有反爬机制,建议使用云端 stealth 浏览器
- 遵守网站使用条款,勿用于非法爬虫
本技能整合 browser-use 完整安装配置与应用指南