全局安装(推荐)
Section titled “全局安装(推荐)”安装原生 Rust 二进制文件以获得最佳性能:
npm install -g agent-browseragent-browser install # 首次从 Chrome for Testing 下载 Chrome这是最快的方式:命令会直接通过原生 Rust CLI 运行,解析开销低于毫秒级。
快速开始(无需安装)
Section titled “快速开始(无需安装)”npx agent-browser install # 仅首次下载 Chromenpx agent-browser open example.com项目安装(本地依赖)
Section titled “项目安装(本地依赖)”适合希望在 package.json 中固定版本的项目:
npm install agent-browsernpx agent-browser install # 首次下载 Chrome之后可通过 npx 或 package.json scripts 使用。
Homebrew(macOS)
Section titled “Homebrew(macOS)”brew install agent-browseragent-browser install # 首次下载 ChromeCargo(Rust)
Section titled “Cargo(Rust)”cargo install agent-browseragent-browser install # 首次下载 Chrome从源码编译约需 2–3 分钟,需要 Node.js 24+、pnpm 11+ 和 Rust 工具链。
git clone https://github.com/vercel-labs/agent-browsercd agent-browserpnpm installpnpm buildpnpm build:native./bin/agent-browser installpnpm link --globalLinux 依赖
Section titled “Linux 依赖”在 Linux 上安装系统依赖:
agent-browser install --with-deps升级到最新版本:
agent-browser upgrade该命令会检测你的安装方式(npm、Homebrew 或 Cargo),并自动运行对应的更新命令。
Doctor
Section titled “Doctor”doctor 用于诊断安装问题,并自动清理过期的守护进程文件:
agent-browser doctoragent-browser doctor --offline --quickagent-browser doctor --fixagent-browser doctor --json它会检查环境、Chrome、守护进程、配置、安全、Provider、网络以及启动测试。
自定义浏览器
Section titled “自定义浏览器”你可以使用自定义浏览器可执行文件,而不是捆绑 Chromium:
agent-browser --executable-path /path/to/chromium open example.com
AGENT_BROWSER_EXECUTABLE_PATH=/path/to/chromium agent-browser open example.comAI Agent 设置
Section titled “AI Agent 设置”安装适用于 AI 编码助手的 skill:
npx skills add vercel-labs/agent-browser适用于 Claude Code、Codex、Cursor、Gemini CLI、GitHub Copilot、Goose、OpenCode 和 Windsurf。
AGENTS.md / CLAUDE.md
Section titled “AGENTS.md / CLAUDE.md”可添加:
## Browser Automation
Use `agent-browser` for web automation. Run `agent-browser --help` for all commands.
Core workflow:1. `agent-browser open <url>` - Navigate to page2. `agent-browser snapshot -i` - Get interactive elements with refs (@e1, @e2)3. `agent-browser click @e1` / `fill @e2 "text"` - Interact using refs4. Re-snapshot after page changes