Agent Browser 完整教學

1. 專案定位與核心價值

什麼是 Agent Browser

Agent Browser 是 Vercel Labs 開發的瀏覽器自動化 CLI 工具,以 Rust 原生編譯,透過 Chrome DevTools Protocol (CDP) 直接控制 Chrome/Chromium,專為 AI agent 設計。

解決什麼問題

傳統瀏覽器自動化工具(Playwright、Puppeteer、Selenium)在 AI agent 使用場景中面臨三大痛點:

  1. Token 消耗過高: 取得完整 DOM/HTML 需要數千甚至數萬 token,LLM context window 迅速耗盡
  2. 啟動與執行延遲: Node.js runtime 啟動成本高,每次操作需重新建立連線
  3. 元素定位不穩定: CSS selector 與 XPath 在動態頁面中容易失效

Agent Browser 的解法是 accessibility tree snapshot + ref 系統

  • snapshot 指令回傳精簡的 accessibility tree,每個可互動元素帶有 @eN ref 標記
  • 一張 snapshot 通常只佔 200-400 token(對比 raw HTML 的 10K-50K token)
  • Ref 直接指向具體 DOM 元素,操作確定性高
  • Rust daemon 常駐背景,後續指令毫秒級回應

核心優勢

面向Agent Browser傳統工具 (Playwright / Puppeteer)
語言Rust (原生 binary)Node.js
啟動速度首次 ~100ms,後續 ~5ms (daemon)每次 ~500-2000ms
Token 效率~200-400 tokens/snapshot~10K-50K tokens/DOM
AI 整合原生 MCP server + snapshot ref需額外封裝
雲端部署5 種 cloud browser provider各家 SDK
安全機制Domain allowlist + action policy + vault自行實作

2. 安裝與環境設定

2.1 系統需求

  • Chrome 瀏覽器: 首次安裝後執行 agent-browser install 自動下載 Chrome for Testing
  • Node.js 24+ / pnpm 11+: 僅從原始碼建置時需要
  • Rust: 僅從原始碼建置時需要
  • 支援平台: macOS ARM64/x64、Linux ARM64/x64、Windows x64

2.2 安裝方式

npm 全域安裝(推薦)

1npm install -g agent-browser
2agent-browser install    # 下載 Chrome for Testing(僅首次需要)

Homebrew (macOS)

1brew install agent-browser
2agent-browser install

Cargo (Rust)

1cargo install agent-browser
2agent-browser install

從原始碼建置

1git clone https://github.com/vercel-labs/agent-browser
2cd agent-browser
3pnpm install
4pnpm build
5pnpm build:native    # 需要 Rust (https://rustup.rs)
6pnpm link --global
7agent-browser install

2.3 Linux 額外依賴

1agent-browser install --with-deps

此指令會安裝 Chrome 所需的系統函式庫(libX11、libgbm 等)。

2.4 升級

1agent-browser upgrade    # 自動偵測安裝方式並執行對應更新

2.5 驗證安裝

1agent-browser --version         # 確認版本
2agent-browser doctor            # 系統環境檢查
3agent-browser open example.com  # 快速測試
4agent-browser snapshot          # 確認 snapshot 功能
5agent-browser close

3. 核心架構解析

3.1 Client-Daemon 架構

Agent Browser 採用 client-daemon 分離架構,所有瀏覽器操作透過常駐背景的 daemon 執行:


graph TB
    subgraph "AI Agent / 使用者"
        CLI["agent-browser CLI
(Rust binary)"] MCP["MCP Server 模式"] end subgraph "Daemon (背景常駐)" DAEMON["Rust Daemon
Unix Socket / Named Pipe"] CDP_CLIENT["CDP Client"] STREAM["WebSocket Stream Server
(viewport 串流)"] DASHBOARD["Observability Dashboard
(port 4848)"] end subgraph "Browser Engine" CHROME["Chrome / Chromium
(Chrome for Testing)"] LP["Lightpanda
(替代引擎)"] CLOUD["Cloud Provider
(Browserless / Browserbase /
Browser Use / Kernel / AgentCore)"] end subgraph "Plugin 系統" CRED["Credential Provider
(vault)"] BPROV["Browser Provider
(cloud-browser)"] LAUNCH["Launch Mutator
(stealth)"] CMD["Command Plugin
(captcha solver)"] end CLI -->|"IPC (Unix Socket)"| DAEMON MCP -->|"stdio JSON"| DAEMON DAEMON --> CDP_CLIENT DAEMON --> STREAM DAEMON --> DASHBOARD CDP_CLIENT -->|"CDP WebSocket"| CHROME CDP_CLIENT -->|"CDP WebSocket"| LP CDP_CLIENT -->|"CDP WebSocket"| CLOUD DAEMON -.->|"plugin.v1 stdio"| CRED DAEMON -.->|"plugin.v1 stdio"| BPROV DAEMON -.->|"plugin.v1 stdio"| LAUNCH DAEMON -.->|"plugin.v1 stdio"| CMD style CLI fill:#2563eb,color:#fff style MCP fill:#2563eb,color:#fff style DAEMON fill:#7c3aed,color:#fff style CHROME fill:#16a34a,color:#fff style CLOUD fill:#ea580c,color:#fff

3.2 核心元件說明

Rust CLI (client)

  • 解析命令列參數
  • 透過 Unix Socket (macOS/Linux) 或 Named Pipe (Windows) 與 daemon 通訊
  • IPC 讀取逾時 30 秒

Rust Daemon

  • 首次執行時自動啟動,常駐背景
  • 管理 Chrome 生命週期(啟動、關閉、session 隔離)
  • 處理 CDP 通訊、snapshot 生成、ref 映射
  • 可設定 AGENT_BROWSER_IDLE_TIMEOUT_MS 自動關閉

Browser Engine

  • 預設使用 Chrome for Testing
  • 支援 --engine lightpanda 切換為 Lightpanda
  • 支援 5 種 cloud browser provider(透過 --provider 指定)

Plugin 系統

  • 外部可執行檔,透過 agent-browser.plugin.v1 stdio JSON 協定通訊
  • 四種 capability: credential.readbrowser.providerlaunch.mutatecommand.run

3.3 Snapshot + Ref 工作流

AI agent 與網頁互動的標準流程:


sequenceDiagram
    participant Agent as AI Agent
    participant CLI as agent-browser CLI
    participant Daemon as Daemon
    participant Chrome as Chrome

    Agent->>CLI: open example.com
    CLI->>Daemon: IPC open
    Daemon->>Chrome: CDP Navigate
    Chrome-->>Daemon: Page loaded
    Daemon-->>CLI: success
    CLI-->>Agent: OK

    Agent->>CLI: snapshot -i
    CLI->>Daemon: IPC snapshot
    Daemon->>Chrome: CDP getAccessibilityTree
    Chrome-->>Daemon: A11y tree
    Daemon-->>CLI: Parsed tree with @eN refs
    CLI-->>Agent: "@e1 button Submit
@e2 textbox Email
@e3 link Learn more" Note over Agent: AI 分析 snapshot
決定操作 @e2 Agent->>CLI: fill @e2 "test@example.com" CLI->>Daemon: IPC fill ref=e2 Daemon->>Chrome: CDP resolveRef + fill Chrome-->>Daemon: Done Daemon-->>CLI: success CLI-->>Agent: OK Agent->>CLI: click @e1 CLI->>Daemon: IPC click ref=e1 Daemon->>Chrome: CDP resolveRef + click Chrome-->>Daemon: Page changed Daemon-->>CLI: success CLI-->>Agent: OK Agent->>CLI: snapshot -i Note over Agent: 重新取得 snapshot
確認操作結果

4. 主要功能詳解

4.1 導航與頁面操作

 1# 開啟 URL
 2agent-browser open https://example.com
 3
 4# 開啟空白頁(不導航)
 5agent-browser open
 6
 7# 等待頁面載入完成
 8agent-browser wait --load networkidle
 9
10# 串鏈操作
11agent-browser open example.com && agent-browser wait --load networkidle && agent-browser snapshot -i

4.2 Snapshot 與 Ref 系統

 1# 完整 accessibility tree
 2agent-browser snapshot
 3
 4# 僅互動元素(推薦 AI 使用)
 5agent-browser snapshot -i
 6
 7# 附帶 URL 的互動元素
 8agent-browser snapshot -i --urls
 9
10# 緊湊模式 + 深度限制
11agent-browser snapshot -i -c -d 5
12
13# 限定 CSS selector 範圍
14agent-browser snapshot -s "#main"
15
16# JSON 輸出(machine-readable)
17agent-browser snapshot -i --json

Snapshot 輸出範例:

1@e1 [heading level=1] "Example Domain"
2@e2 [button] "Submit"
3@e3 [textbox] placeholder="Email"
4@e4 [link] "Learn more" href="https://..."

4.3 元素互動

 1# 點擊(使用 ref)
 2agent-browser click @e2
 3
 4# 填入文字(清除後填入)
 5agent-browser fill @e3 "test@example.com"
 6
 7# 逐字輸入
 8agent-browser type @e3 "hello"
 9
10# 按鍵
11agent-browser press Enter
12agent-browser press Control+a
13
14# 勾選 / 取消勾選
15agent-browser check @e5
16agent-browser uncheck @e5
17
18# 下拉選單
19agent-browser select @e6 "option-value"
20
21# 捲動
22agent-browser scroll down 500
23agent-browser scrollintoview @e7
24
25# 拖放
26agent-browser drag @e8 @e9

4.4 資訊擷取

 1# 取得文字
 2agent-browser get text @e1
 3
 4# 取得 HTML
 5agent-browser get html @e1
 6
 7# 取得屬性
 8agent-browser get attr @e1 href
 9
10# 取得頁面標題 / URL
11agent-browser get title
12agent-browser get url
13
14# 計算匹配元素數量
15agent-browser get count "button"
16
17# Agent-readable text(新功能 v0.30.0+)
18agent-browser read                                  # 讀取當前頁面
19agent-browser read https://example.com/article       # 擷取 URL 內容
20agent-browser read https://docs.example.com --outline # 標題大綱
21agent-browser read https://docs.example.com --llms index --filter auth  # llms.txt 查找

4.5 截圖與 PDF

 1# 基本截圖
 2agent-browser screenshot page.png
 3
 4# 全頁截圖
 5agent-browser screenshot --full page.png
 6
 7# 帶標註的截圖(ref 編號覆蓋在元素上)
 8agent-browser screenshot --annotate
 9
10# 指定格式與品質
11agent-browser screenshot --screenshot-format jpeg --screenshot-quality 80
12
13# 存為 PDF
14agent-browser pdf report.pdf

4.6 JavaScript 執行

 1# 簡單表達式
 2agent-browser eval "document.title"
 3
 4# Heredoc 方式(推薦,避免引號問題)
 5cat <<'EOF' | agent-browser eval --stdin
 6document.querySelectorAll('a').length
 7EOF
 8
 9# Base64 編碼
10agent-browser eval -b "ZG9jdW1lbnQudGl0bGU="

4.7 Session 管理

 1# 建立隔離 session
 2agent-browser --session agent1 open site-a.com
 3agent-browser --session agent2 open site-b.com
 4
 5# 列出 session
 6agent-browser session list
 7
 8# 產生穩定 session ID(基於 worktree)
 9SESSION="$(agent-browser session id --scope worktree --prefix myapp)"
10
11# 自動儲存/還原 session state
12agent-browser --session "$SESSION" --restore open example.com
13
14# State 加密
15export AGENT_BROWSER_ENCRYPTION_KEY=$(openssl rand -hex 32)
16agent-browser --session secure --restore open example.com
17
18# 關閉所有 session
19agent-browser close --all

4.8 Authentication

 1# 方法一:Chrome Profile 複用
 2agent-browser profiles                              # 列出 Chrome profiles
 3agent-browser --profile Default open https://gmail.com
 4
 5# 方法二:Persistent Profile
 6agent-browser --profile ~/.myapp-profile open myapp.com
 7
 8# 方法三:HTTP Header 認證
 9agent-browser open api.example.com --headers '{"Authorization": "Bearer <token>"}'
10
11# 方法四:Credential Vault(加密儲存)
12echo "mypassword" | agent-browser auth save github --url https://github.com/login --username user --password-stdin
13agent-browser auth login github
14
15# 方法五:匯入現有 Chrome 登入狀態
16agent-browser --auto-connect state save ./my-auth.json
17agent-browser --state ./my-auth.json open https://app.example.com

4.9 MCP Server 模式

在 Claude Code、Cursor 等 AI 工具中作為 MCP server 使用:

1{
2  "mcpServers": {
3    "agent-browser": {
4      "command": "agent-browser",
5      "args": ["mcp", "--tools", "all"]
6    }
7  }
8}

4.10 AI Chat 模式

 1# 單次指令
 2agent-browser chat "open google.com and search for cats"
 3
 4# 互動式 REPL
 5agent-browser chat
 6
 7# 安靜模式(僅顯示 AI 回應文字)
 8agent-browser -q chat "summarize this page"
 9
10# 指定模型
11agent-browser --model openai/gpt-4o chat "take a screenshot"

需設定 Vercel AI Gateway:

1export AI_GATEWAY_API_KEY=gw_your_key_here
2export AI_GATEWAY_MODEL=anthropic/claude-sonnet-4.6    # 預設值

4.11 Cloud Browser Provider

 1# Browserless
 2export BROWSERLESS_API_KEY="your-api-token"
 3agent-browser -p browserless open https://example.com
 4
 5# Browserbase
 6export BROWSERBASE_API_KEY="your-api-key"
 7agent-browser -p browserbase open https://example.com
 8
 9# Browser Use
10export BROWSER_USE_API_KEY="your-api-key"
11agent-browser -p browseruse open https://example.com
12
13# Kernel(含 stealth + persistent profile)
14export KERNEL_API_KEY="your-api-key"
15export KERNEL_STEALTH=true
16export KERNEL_PROFILE_NAME=my-profile
17agent-browser -p kernel open https://example.com
18
19# AWS AgentCore
20export AGENT_BROWSER_PROVIDER=agentcore
21agent-browser open https://example.com

4.12 Observability Dashboard

1# 啟動 dashboard (port 4848)
2agent-browser dashboard start
3agent-browser dashboard start --port 8080    # 自訂 port
4
5# 停止
6agent-browser dashboard stop

Dashboard 功能:即時 viewport 串流、命令活動 feed、console 輸出、session 建立 UI、AI Chat 面板。

5. 應用場景與實戰範例

5.1 AI Agent 自動化登入與操作

 1#!/bin/bash
 2# 場景:AI agent 自動登入並擷取 dashboard 資料
 3
 4# 1. 開啟登入頁面
 5agent-browser open https://app.example.com/login
 6
 7# 2. 取得 snapshot 找到表單元素
 8agent-browser snapshot -i
 9# 輸出:
10# @e1 [textbox] placeholder="Email"
11# @e2 [input type="password"] placeholder="Password"
12# @e3 [button] "Sign in"
13
14# 3. 填入認證資訊並提交
15agent-browser fill @e1 "user@example.com"
16agent-browser fill @e2 "password123"
17agent-browser click @e3
18
19# 4. 等待頁面載入
20agent-browser wait --url "**/dashboard" --timeout 10000
21
22# 5. 擷取 dashboard 內容
23agent-browser read
24agent-browser screenshot dashboard.png
25
26# 6. 關閉
27agent-browser close

5.2 多 Session 平行爬取

 1#!/bin/bash
 2# 場景:同時爬取三個不同網站
 3
 4URLS=("https://site-a.com" "https://site-b.com" "https://site-c.com")
 5
 6for i in "${!URLS[@]}"; do
 7  (
 8    SESSION="crawler-$i"
 9    agent-browser --session "$SESSION" open "${URLS[$i]}"
10    agent-browser --session "$SESSION" wait --load networkidle
11    agent-browser --session "$SESSION" read > "output-$i.md"
12    agent-browser --session "$SESSION" screenshot "shot-$i.png"
13    agent-browser --session "$SESSION" close
14  ) &
15done
16wait
17echo "All sites scraped."

5.3 E2E 測試流程

 1#!/bin/bash
 2# 場景:驗證註冊流程
 3
 4agent-browser open http://localhost:3000/register
 5
 6# 取得 snapshot
 7OUTPUT=$(agent-browser snapshot -i --json)
 8
 9# 填入表單
10agent-browser fill @e1 "newuser@test.com"
11agent-browser fill @e2 "SecurePass123!"
12agent-browser fill @e3 "SecurePass123!"
13agent-browser click @e4
14
15# 驗證跳轉
16agent-browser wait --url "**/welcome" --timeout 5000
17TITLE=$(agent-browser get title)
18
19if echo "$TITLE" | grep -q "Welcome"; then
20  echo "PASS: Registration successful"
21else
22  echo "FAIL: Expected welcome page"
23  agent-browser screenshot failure.png
24  exit 1
25fi
26
27agent-browser close

5.4 Serverless 部署(Vercel Sandbox)

 1import { runAgentBrowserCommand, withAgentBrowserSandbox } from "@agent-browser/sandbox/vercel";
 2
 3const result = await withAgentBrowserSandbox(async (sandbox) => {
 4  // 在 microVM 中執行瀏覽器自動化
 5  await runAgentBrowserCommand(sandbox, ["open", "https://example.com"]);
 6  await runAgentBrowserCommand(sandbox, ["wait", "--load", "networkidle"]);
 7  const snapshot = await runAgentBrowserCommand(sandbox, ["snapshot", "-i", "--json"]);
 8  const screenshot = await runAgentBrowserCommand(sandbox, ["screenshot"]);
 9  return { snapshot, screenshot };
10});

6. 資安掃描報告

掃描摘要

等級評估
總體評分🟢 Low Risk

詳細發現

🟢 execSync 使用

  • 檔案: bin/agent-browser.js, scripts/postinstall.js, scripts/sync-version.js
  • 說明: execSync 用於安裝流程(偵測 glibc 版本、npm prefix 查詢、Cargo 更新),輸入皆為硬編碼字串,無使用者輸入注入風險
  • 風險: 低

🟢 eval 功能

  • 檔案: skill-data/core/SKILL.md, skill-data/core/references/commands.md
  • 說明: agent-browser eval 是設計上的功能(在瀏覽器內執行 JS),文件明確建議用 --stdin-b 避免 shell injection
  • 風險: 低(使用者需自行控制 eval 輸入)

🟢 密碼/認證相關

  • 檔案: skill-data/core/SKILL.md
  • 說明: 文件展示 password 處理流程(--password-stdin、credential vault),實際密碼不存在於程式碼中。Vault 使用 AES-256-GCM 加密,自動產生 encryption key
  • 風險: 低

🟢 安全設計亮點

  • Domain allowlist 限制導航範圍
  • Content boundary markers 防止 LLM prompt injection
  • Action policy 閘控破壞性操作
  • Plugin 權限可透過 --confirm-actions 要求明確授權
  • State 加密 (AES-256-GCM)
  • 文件明確告知 --remote-debugging-port 風險

結論

Agent Browser 展現出成熟的安全設計意識。核心 CLI 以 Rust 編寫,記憶體安全性高。安全機制均為 opt-in 設計,不影響既有工作流。唯一需注意的是 eval 指令本身具有任意 JS 執行能力,使用時應確保輸入來源可信。

7. FAQ 常見問題

Q1: Agent Browser 跟 Playwright / Puppeteer 差在哪?

Agent Browser 專為 AI agent 設計,核心差異在 snapshot + ref 系統(200-400 token vs 10K+ token)、Rust 原生效能、daemon 常駐架構(毫秒級回應)、內建 MCP server。Playwright/Puppeteer 適合傳統 E2E 測試,Agent Browser 適合 AI 驅動的瀏覽器自動化。

Q2: 需要安裝 Node.js 嗎?

不需要。npm 安裝方式會下載預編譯的 Rust binary,runtime 不依賴 Node.js。也可透過 Homebrew 或 Cargo 安裝完全跳過 Node.js。

Q3: snapshot ref 會過期嗎?

會。頁面 DOM 變動後,snapshot ref 可能指向錯誤元素(#1443)。最佳實踐是每次操作後重新 snapshot,確保 ref 與當前 DOM 一致。

click 失敗並回報 covered by <div#consent-banner> 時,先點擊 banner 上的同意/關閉按鈕,再重新 snapshot 取得新 ref。

Q5: 可以在 Docker 中使用嗎?

可以。使用 agent-browser install --with-deps 安裝系統依賴。專案提供 docker/Dockerfile.build 作為參考。

Q6: 如何限制 AI agent 只能瀏覽特定網域?

使用 --allowed-domains 旗標:

1agent-browser --allowed-domains "example.com,*.example.com" open https://example.com

Sub-resource 請求(scripts、images、fetch)也會被限制。

Q7: daemon 如何管理生命週期?

Daemon 在首次指令時自動啟動,在所有 session 關閉後繼續常駐。設定 AGENT_BROWSER_IDLE_TIMEOUT_MS 可讓 daemon 在無活動後自動退出。

8. 進階技巧

8.1 Configuration File

建立 agent-browser.json 設定持久預設值:

 1{
 2  "$schema": "https://agent-browser.dev/schema.json",
 3  "headed": false,
 4  "profile": "./browser-data",
 5  "contentBoundaries": true,
 6  "maxOutput": 50000,
 7  "allowedDomains": "example.com,*.example.com",
 8  "plugins": [
 9    {
10      "name": "vault",
11      "command": "agent-browser-plugin-vault",
12      "capabilities": ["credential.read"]
13    }
14  ]
15}

優先順序:CLI flags > 環境變數 > ./agent-browser.json > ~/.agent-browser/config.json

8.2 WebSocket 串流整合

1# 啟動串流
2AGENT_BROWSER_STREAM_PORT=9223 agent-browser open example.com
3
4# 查詢串流狀態
5agent-browser stream status

WebSocket client 可連線 ws://localhost:9223,接收 JPEG frame 並傳送滑鼠/鍵盤事件,實現 “pair browsing”(人機共看)。

8.3 iOS 真機測試

 1# 安裝 Appium + XCUITest driver
 2npm install -g appium
 3appium driver install xcuitest
 4
 5# 列出可用裝置
 6agent-browser device list
 7
 8# 在 iPhone Simulator 上操作 Safari
 9agent-browser -p ios --device "iPhone 16 Pro" open https://example.com
10agent-browser -p ios snapshot -i
11agent-browser -p ios tap @e1
12agent-browser -p ios swipe up

8.4 Plugin 開發

Plugin 透過 agent-browser.plugin.v1 stdio JSON 協定通訊。四種 capability:

Capability用途觸發方式
credential.read密碼管理auth login --credential-provider
browser.provider雲端瀏覽器--provider <name>
launch.mutate啟動前修改 Chrome 參數自動(安裝即啟用)
command.run自訂指令plugin run <name> <capability>

8.5 Annotated Screenshot 工作流

適合多模態 AI 模型(能看圖 + 讀文字):

1# 帶編號標註的截圖
2agent-browser screenshot --annotate ./page.png
3# 輸出:
4# [1] @e1 button "Submit"
5# [2] @e2 link "Home"
6# [3] @e3 textbox "Email"
7
8# 直接用 ref 操作
9agent-browser click @e2

9. 整合進其他工作流

9.1 Claude Code 整合

安裝為 Claude Code skill:

1npx skills add vercel-labs/agent-browser

或在 CLAUDE.md 中加入指引:

1## Browser Automation
2
3Use `agent-browser` for web automation. Run `agent-browser --help` for all commands.
4
5Core workflow:
61. `agent-browser open <url>` - Navigate to page
72. `agent-browser snapshot -i` - Get interactive elements with refs
83. `agent-browser click @e1` / `fill @e2 "text"` - Interact using refs
94. Re-snapshot after page changes

9.2 作為 MCP Server

1{
2  "mcpServers": {
3    "agent-browser": {
4      "command": "agent-browser",
5      "args": ["mcp", "--tools", "all"]
6    }
7  }
8}

可用於 Claude Code、Cursor、Gemini CLI、GitHub Copilot、Goose、OpenCode、Windsurf。

9.3 CI/CD Pipeline

 1# GitHub Actions 範例
 2- name: Browser automation test
 3  run: |
 4    npm install -g agent-browser
 5    agent-browser install --with-deps
 6    agent-browser open https://staging.example.com
 7    agent-browser wait --load networkidle
 8    agent-browser snapshot -i --json > snapshot.json
 9    agent-browser screenshot evidence.png
10    agent-browser close

9.4 搭配 opencli-browser

Agent Browser 可替代 opencli-browser 作為 AI agent 的瀏覽器後端,優勢在於:

  • Rust 原生效能
  • Snapshot ref 系統更適合 LLM
  • 內建 MCP server
  • Cloud browser provider 支援

10. 重點摘要 Checklist

  • 安裝 agent-browser 並執行 agent-browser install
  • 熟悉核心工作流:open -> snapshot -i -> click/fill @eN -> 重新 snapshot
  • 了解 snapshot ref (@eN) 在 DOM 變動後會失效,需重新 snapshot
  • 使用 --json 旗標取得 machine-readable 輸出
  • 使用 --session 隔離多個瀏覽器實例
  • 使用 --allowed-domains 限制 AI agent 導航範圍
  • 使用 --content-boundaries 防止 LLM 被頁面內容注入
  • 了解 read 指令可擷取 agent-friendly 文字(v0.30.0+)
  • 考慮使用 --restore 自動持久化 session state
  • 使用 MCP server 模式整合 Claude Code / Cursor
  • 了解 cloud browser provider 選項(Browserless / Browserbase / Kernel 等)
  • 使用 agent-browser doctor 排查環境問題

11. 進一步閱讀與參考資源