---
title: 瀏覽器使用工具
url: https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-tool
description: 透過瀏覽器使用工具，讓 Claude 在您自己的瀏覽器環境中瀏覽、閱讀網頁並與之互動。
featureMetadata:
  status: stable
  zdr:
    eligibility: eligible
    note: Excludes [Covered Models](https://platform.claude.com/docs/en/manage-claude/api-and-data-retention#model-specific-data-retention-requirements). 用戶端工具。除標準 API 處理外，Anthropic 不會執行瀏覽器動作或保留頁面內容。
  supportedModels:
    - claude-fable-5-2
    - claude-mythos-5-2
    - claude-fable-5-1
    - claude-mythos-5-1
    - claude-fable-5
    - claude-mythos-5
    - claude-mythos-preview
    - claude-opus-5-5
    - claude-opus-5
    - claude-sonnet-5-5
    - claude-sonnet-5
    - claude-haiku-5-5
    - claude-opus-4-8
  supportedPlatforms:
    Claude API: stable
    Amazon Bedrock: stable
    Amazon Bedrock (bedrock-runtime): stable
    Claude Platform on AWS: stable
    Claude Models on Google Cloud (Anthropic managed): stable
    Claude Models on Google Cloud (Google managed): stable
    Microsoft Foundry: stable
---

<Note>
  **從 SDK 工具集開始：** Python 和 TypeScript SDK 提供一個瀏覽器工具集類別，目前處於 beta 階段。您可以從[合作夥伴的整合](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-sdk#partner-integrations)開始，或參閱[使用 SDK 工具集進行瀏覽器與電腦使用](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-sdk)。請將本頁作為工具參考，或在您自行處理工具呼叫時使用。
</Note>

瀏覽器使用工具讓 Claude 能在您的應用程式所執行的瀏覽器中瀏覽、閱讀網頁並與之互動。Claude 會同時透過頁面的結構（「accessibility tree」（無障礙樹）、元素、表單和分頁）以及螢幕截圖和「viewport」（視埠）座標來處理頁面。

此工具是由 Anthropic 定義的[用戶端工具集](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/tool-reference#client-toolsets)：在 `tools` 中加入一個 `browser_toolset_20260801` 項目，預設即可為 Claude 提供 27 個成員工具，例如 `navigate`、`read_page`、`left_click` 和 `screenshot`，而當您[啟用選用成員](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-tool#enable-optional-member-tools)時還會再多四個。您的應用程式會針對其自身的瀏覽器自動化執行每一個呼叫；Anthropic 端不會執行任何操作。此工具目前無法在 [Claude Managed Agents](https://platform.claude.com/docs/zh-TW/managed-agents/tools) 中使用。

當任務僅限於網頁內部且需要對網頁採取動作，或當頁面使用 JavaScript 建構其內容時，請選擇瀏覽器使用。當任務需要完整的桌面時，請使用[電腦使用工具](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/computer-use-tool)，它僅透過螢幕截圖和座標運作。若要閱讀您可以指引 Claude 前往的頁面，或在網路上尋找資料來源，[網頁擷取工具](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/web-fetch-tool)和[網頁搜尋工具](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/web-search-tool)更為輕量。它們是由 API 為您執行的[伺服器工具](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/server-tools)，無需操作瀏覽器。

使用瀏覽器使用工具時，Claude 會閱讀即時網頁並對其採取動作，因此頁面提供的所有內容都是不受信任的輸入，而 Claude 採取的動作可能產生實際影響。部署前請參閱[安全性考量](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-tool#security-considerations)。

## 快速入門

若要使用瀏覽器使用工具，請在 [Messages API](https://platform.claude.com/docs/zh-TW/api/messages/create) 請求的 `tools` 陣列中新增一個類型為 `browser_toolset_20260801` 且不含 `name` 的項目。請參閱 [API 支援](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-tool#availability-feature-support)以了解支援的模型和平台。

<CodeGroup>
  ```bash cURL
  curl https://api.anthropic.com/v1/messages \
    -H "content-type: application/json" \
    -H "x-api-key: $ANTHROPIC_API_KEY" \
    -H "anthropic-version: 2026-10-21" \
    -d '{
      "model": "claude-opus-5-5",
      "max_tokens": 2048,
      "tools": [
        {
          "type": "browser_toolset_20260801"
        }
      ],
      "messages": [
        {
          "role": "user",
          "content": "Open example.com/docs and tell me how to get started."
        }
      ]
    }'
  ```

  ```bash CLI
  ant messages create <<'YAML'
  model: claude-opus-5-5
  max_tokens: 2048
  tools:
    - type: browser_toolset_20260801
  messages:
    - role: user
      content: Open example.com/docs and tell me how to get started.
  YAML
  ```

  ```python Python
  client = anthropic.Anthropic()

  response = client.messages.create(
      model="claude-opus-5-5",
      max_tokens=2048,
      tools=[{"type": "browser_toolset_20260801"}],
      messages=[
          {
              "role": "user",
              "content": "Open example.com/docs and tell me how to get started.",
          }
      ],
  )
  print(response)
  ```

  ```typescript TypeScript
  const client = new Anthropic();

  const response = await client.messages.create({
    model: "claude-opus-5-5",
    max_tokens: 2048,
    tools: [{ type: "browser_toolset_20260801" }],
    messages: [
      {
        role: "user",
        content: "Open example.com/docs and tell me how to get started."
      }
    ]
  });

  console.log(response);
  ```

  ```csharp C#
  var client = new AnthropicClient();

  var parameters = new MessageCreateParams
  {
      Model = Model.ClaudeOpus5_5,
      MaxTokens = 2048,
      Tools = [new BrowserToolset20260801()],
      Messages =
      [
          new UserMessageParam { Content = "Open example.com/docs and tell me how to get started." },
      ],
  };

  var response = await client.Messages.Create(parameters);
  Console.WriteLine(response);
  ```

  ```go Go
  client := anthropic.NewClient()

  response, err := client.Messages.New(context.TODO(), anthropic.MessageNewParams{
  	Model:     anthropic.ModelClaudeOpus5_5,
  	MaxTokens: 2048,
  	Tools: []anthropic.ToolUnionParam{
  		{OfBrowserToolset20260801: &anthropic.BrowserToolset20260801Param{}},
  	},
  	Messages: []anthropic.MessageParam{
  		anthropic.NewUserMessage(anthropic.NewTextBlock("Open example.com/docs and tell me how to get started.")),
  	},
  })
  if err != nil {
  	log.Fatal(err)
  }
  fmt.Println(response.RawJSON())
  ```

  ```java Java
  import com.anthropic.models.messages.BrowserToolset20260801;
  // ...

  void main() {
      AnthropicClient client = AnthropicOkHttpClient.fromEnv();

      MessageCreateParams params = MessageCreateParams.builder()
          .model(Model.CLAUDE_OPUS_5_5)
          .maxTokens(2048L)
          .addTool(BrowserToolset20260801.builder().build())
          .addUserMessage("Open example.com/docs and tell me how to get started.")
          .build();

      Message response = client.messages().create(params);
      IO.println(response);
  }
  ```

  ```php PHP
  $client = new Client();

  $response = $client->messages->create(
      maxTokens: 2048,
      messages: [
          ['role' => 'user', 'content' => 'Open example.com/docs and tell me how to get started.'],
      ],
      model: Model::CLAUDE_OPUS_5_5,
      tools: [
          ['type' => 'browser_toolset_20260801'],
      ],
  );

  echo $response;
  ```

  ```ruby Ruby
  client = Anthropic::Client.new

  response = client.messages.create(
    model: Anthropic::Model::CLAUDE_OPUS_5_5,
    max_tokens: 2048,
    tools: [
      { type: "browser_toolset_20260801" }
    ],
    messages: [
      {
        role: "user",
        content: "Open example.com/docs and tell me how to get started."
      }
    ]
  )

  puts response
  ```
</CodeGroup>

Claude 的第一個回應以 `stop_reason: "tool_use"` 結束，並帶有一個或多個成員 `tool_use` 區塊，每個區塊在 `name` 中指定一個成員工具，並帶有 `"toolset_name": "browser"`：

```json Output
{
  "id": "msg_01HCDu4XSTLzTAcodEQ58vDo",
  "type": "message",
  "role": "assistant",
  "model": "claude-opus-5-5",
  "content": [
    {
      "type": "text",
      "text": "I'll open the documentation and read the page to find the getting-started instructions."
    },
    {
      "type": "tool_use",
      "id": "toolu_01NRLabsLyVHZPKxbKvkfSMn",
      "name": "navigate",
      "toolset_name": "browser",
      "input": { "url": "https://example.com/docs" }
    },
    {
      "type": "tool_use",
      "id": "toolu_01UvHU5cDyTZ2vXKf5wCkPqR",
      "name": "read_page",
      "toolset_name": "browser",
      "input": { "filter": "interactive" }
    }
  ],
  "stop_reason": "tool_use",
  "stop_sequence": null
}
```

您的「executor」（執行器，即應用程式中驅動瀏覽器並產生工具結果的部分）會先執行 `navigate`，再執行 `read_page`。您的應用程式在下一個請求中為每個區塊回傳一個 `tool_result`，並在每個結果上回傳 `toolset_name`。`navigate` 結果會在 `browser_state` 區塊中報告其載入的分頁；`read_page` 結果是文字，其中每個元素都帶有一個參照：

```json
{
  "role": "user",
  "content": [
    {
      "type": "tool_result",
      "tool_use_id": "toolu_01NRLabsLyVHZPKxbKvkfSMn",
      "toolset_name": "browser",
      "content": [
        { "type": "text", "text": "Navigated to https://example.com/docs" },
        {
          "type": "browser_state",
          "tabs": [
            {
              "tab_id": "tab-1",
              "title": "Documentation",
              "url": "https://example.com/docs",
              "active": true
            }
          ]
        }
      ]
    },
    {
      "type": "tool_result",
      "tool_use_id": "toolu_01UvHU5cDyTZ2vXKf5wCkPqR",
      "toolset_name": "browser",
      "content": [
        {
          "type": "text",
          "text": "link \"Documentation\" [ref_1]\nlink \"Getting started\" [ref_2]\ntextbox \"Search docs\" [ref_3]\nbutton \"Search\" [ref_4]\nlink \"Pricing\" [ref_5]"
        }
      ]
    }
  ]
}
```

Claude 現在持有可以操作的參照，因此它的下一輪可以點擊 `ref_2` 來開啟入門頁面，而無需先在螢幕截圖中定位連結。

## 瀏覽器使用的運作方式

瀏覽器使用在您的應用程式中以「agent loop」（代理迴圈）的形式執行：Claude 回傳成員工具呼叫，您的執行器對瀏覽器執行這些呼叫，然後您回傳結果，直到 Claude 以文字回答為止。

<Steps>
  <Step title="為 Claude 提供瀏覽器使用工具和使用者提示">
    * 在您的 API 請求中加入 `browser_toolset_20260801` 項目，並可選擇加入其他工具。
    * 包含一個需要處理網頁的使用者提示，例如「開啟 example.com/docs 並告訴我如何開始使用。」
  </Step>

  <Step title="Claude 以成員工具呼叫回應">
    * Claude 在單一助理回合中回傳一個或多個 `tool_use` 區塊；同一回合中的多個區塊構成一個批次動作，例如先 `left_click`，接著 `type`，再 `key`。
    * 每個區塊的 `name` 是成員名稱，每個區塊都帶有 `"toolset_name": "browser"`，且 `input` 僅包含該成員的參數，沒有 `action` 欄位。回應的 `stop_reason` 為 `tool_use`。
  </Step>

  <Step title="依序執行呼叫並回傳結果">
    * 逐一處理 `response.content` 中的每個 `tool_use` 區塊（不要假設只有一個），並依其出現的順序依序執行，因為後面的呼叫通常依賴前面的呼叫。
    * 在新的 `user` 訊息中為每個區塊回傳一個 `tool_result`，以 `tool_use_id` 對應，並在每個結果上回傳 `"toolset_name": "browser"`。請回應每一個呼叫，否則下一個請求會被拒絕。
    * 如果某個呼叫失敗，請為該區塊回傳 `is_error: true` 以及文字說明，然後對該回合中之後的每個區塊套用[批次動作](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-tool#batch-actions)中的停止規則。
  </Step>

  <Step title="Claude 持續進行直到任務完成">
    * Claude 會讀取結果（頁面文字、無障礙樹、螢幕截圖、分頁狀態），如果需要更多資訊，會回傳進一步的成員呼叫，這會讓您回到步驟 3。
    * 否則，它會向使用者回傳文字回應。
  </Step>
</Steps>

以下分兩部分展示該迴圈工具呼叫步驟的骨架。首先，以存根成員處理常式代替您的瀏覽器自動化。五個成員（`navigate`、`read_page`、`left_click`、`type` 和 `screenshot`）會回傳成為結果內容的文字（`screenshot` 則回傳圖片區塊），而分派器會對任何未實作的成員引發錯誤。

<CodeGroup exclude="shell">
  ```python Python
  # 佔位圖片資料；實際的執行器會擷取視埠並回傳 PNG 位元組
  PLACEHOLDER_PNG = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg=="


  def navigate(url):
      return f"navigated to {url}"


  def read_page():
      return 'link "Docs" [ref_1]\nbutton "Search" [ref_2]'


  def click(target):
      # target 是來自 read_page 或 find 的元素參照，或是視埠座標
      if target["type"] == "ref":
          return f"clicked {target['ref']}"
      return f"clicked at ({target['x']}, {target['y']})"


  def type_text(text):
      return f"typed: {text}"


  def capture_screenshot() -> list[ImageBlockParam]:
      # screenshot 以圖片區塊而非文字回應：回傳結果內容清單
      return [
          {
              "type": "image",
              "source": {
                  "type": "base64",
                  "media_type": "image/png",
                  "data": PLACEHOLDER_PNG,
              },
          }
      ]


  def handle_browser_action(name, tool_input):
      if name == "navigate":
          return navigate(tool_input["url"])
      elif name == "read_page":
          return read_page()
      elif name == "left_click":
          return click(tool_input["target"])
      elif name == "type":
          return type_text(tool_input["text"])
      elif name == "screenshot":
          return capture_screenshot()
      # 視需要處理其他動作
      raise ValueError(f"Unknown or unimplemented member: {name}")
  ```

  ```typescript TypeScript
  // 佔位圖片資料；實際的執行器會將可視區域擷取為 PNG 位元組
  const PLACEHOLDER_PNG =
    "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==";

  function navigate(url: string): string {
    return `navigated to ${url}`;
  }

  function readPage(): string {
    return 'link "Docs" [ref_1]\nbutton "Search" [ref_2]';
  }

  function clickElement(ref: string): string {
    return `clicked ${ref}`;
  }

  function clickAt(x: number, y: number): string {
    return `clicked at (${x}, ${y})`;
  }

  function typeText(text: string): string {
    return `typed: ${text}`;
  }

  function captureScreenshot(): Anthropic.ImageBlockParam[] {
    // screenshot 以圖片區塊而非文字回應
    return [
      {
        type: "image",
        source: {
          type: "base64",
          media_type: "image/png",
          data: PLACEHOLDER_PNG
        }
      }
    ];
  }

  function handleBrowserAction(
    action: string,
    input: unknown
  ): string | Anthropic.ImageBlockParam[] {
    const params: object = typeof input === "object" && input !== null ? input : {};
    if (action === "navigate" && "url" in params) {
      return navigate(String(params.url));
    } else if (action === "read_page") {
      return readPage();
    } else if (action === "left_click" && "target" in params) {
      // target 是來自 read_page 的元素參照或可視區域座標
      const target: object =
        typeof params.target === "object" && params.target !== null ? params.target : {};
      if ("type" in target && target.type === "ref" && "ref" in target) {
        return clickElement(String(target.ref));
      } else if ("x" in target && "y" in target) {
        return clickAt(Number(target.x), Number(target.y));
      }
    } else if (action === "type" && "text" in params) {
      return typeText(String(params.text));
    } else if (action === "screenshot") {
      return captureScreenshot();
    }
    // 視需要處理其他動作
    throw new Error(`Unknown or unimplemented member: ${action}`);
  }
  ```

  ```csharp C#
  // 佔位圖片資料；實際的執行器會擷取可視區域並回傳 PNG 位元組
  const string PlaceholderPng = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==";

  string Navigate(string url) => $"navigated to {url}";

  string ReadPage() =>
      """
      link "Docs" [ref_1]
      button "Search" [ref_2]
      """;

  string ClickRef(string elementRef) => $"clicked {elementRef}";

  string ClickAt(int x, int y) => $"clicked at ({x}, {y})";

  // target 為 {"type": "ref", "ref": "ref_1"} 或 {"type": "coordinate", "x": 640, "y": 380}
  string Click(JsonElement target) =>
      target.GetProperty("type").GetString() == "ref"
          ? ClickRef(target.GetProperty("ref").GetString()!)
          : ClickAt(target.GetProperty("x").GetInt32(), target.GetProperty("y").GetInt32());

  string TypeText(string text) => $"typed: {text}";

  // screenshot 以圖片區塊而非文字回應：回傳結果內容清單
  List<Block> CaptureScreenshot() =>
      [
          new ImageBlockParam(
              new Base64ImageSource { Data = PlaceholderPng, MediaType = MediaType.ImagePng }
          ),
      ];

  ToolResultBlockParamContent HandleBrowserAction(
      string action,
      IReadOnlyDictionary<string, JsonElement> input
  ) =>
      action switch
      {
          "navigate" => Navigate(input["url"].GetString()!),
          "read_page" => ReadPage(),
          "left_click" => Click(input["target"]),
          "type" => TypeText(input["text"].GetString()!),
          "screenshot" => CaptureScreenshot(),
          // 視需要處理其他動作
          _ => throw new NotSupportedException($"Unknown or unimplemented member: {action}"),
      };
  ```

  ```go Go
  // placeholderPNG 代替真實的擷取畫面：執行器會將
  // 視埠以 base64 編碼的 PNG 資料回傳。
  const placeholderPNG = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg=="

  // textContent 將文字包裝為 tool_result 內容。
  func textContent(text string) []anthropic.ToolResultBlockParamContentUnion {
  	return []anthropic.ToolResultBlockParamContentUnion{
  		{OfText: &anthropic.TextBlockParam{Text: text}},
  	}
  }

  func navigate(url string) string {
  	return fmt.Sprintf("navigated to %s", url)
  }

  func readPage() string {
  	return "link \"Docs\" [ref_1]\nbutton \"Search\" [ref_2]"
  }

  func clickRef(ref string) string {
  	return fmt.Sprintf("clicked %s", ref)
  }

  func clickAt(x, y int) string {
  	return fmt.Sprintf("clicked at (%d, %d)", x, y)
  }

  func typeText(text string) string {
  	return fmt.Sprintf("typed: %s", text)
  }

  // captureScreenshot 回傳影像區塊而非文字。
  func captureScreenshot() []anthropic.ToolResultBlockParamContentUnion {
  	return []anthropic.ToolResultBlockParamContentUnion{{
  		OfImage: &anthropic.ImageBlockParam{
  			Source: anthropic.ImageBlockParamSourceUnion{
  				OfBase64: &anthropic.Base64ImageSourceParam{
  					MediaType: anthropic.Base64ImageSourceMediaTypeImagePNG,
  					Data:      placeholderPNG,
  				},
  			},
  		},
  	}}
  }

  func handleBrowserAction(action string, params map[string]any) ([]anthropic.ToolResultBlockParamContentUnion, error) {
  	switch action {
  	case "navigate":
  		if url, ok := params["url"].(string); ok {
  			return textContent(navigate(url)), nil
  		}
  	case "read_page":
  		return textContent(readPage()), nil
  	case "left_click":
  		// target 可以是來自 read_page 的元素參照，或是視埠座標
  		target, _ := params["target"].(map[string]any)
  		if ref, ok := target["ref"].(string); ok && target["type"] == "ref" {
  			return textContent(clickRef(ref)), nil
  		}
  		x, xok := target["x"].(float64)
  		y, yok := target["y"].(float64)
  		if xok && yok {
  			return textContent(clickAt(int(x), int(y))), nil
  		}
  	case "type":
  		if text, ok := params["text"].(string); ok {
  			return textContent(typeText(text)), nil
  		}
  	case "screenshot":
  		return captureScreenshot(), nil
  	// 視需要處理其他動作
  	default:
  		return nil, fmt.Errorf("unknown or unimplemented member: %s", action)
  	}
  	// 當成員的輸入缺少欄位或欄位型別錯誤時會執行到此處
  	return nil, fmt.Errorf("invalid input for %s", action)
  }
  ```

  ```java Java
  /** Placeholder pixels; a real executor captures the viewport and base64-encodes the PNG. */
  static final String PLACEHOLDER_PNG = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==";

  ToolResultBlockParam.Content captureScreenshot() {
      ImageBlockParam image = ImageBlockParam.builder()
          .source(Base64ImageSource.builder()
              .mediaType(Base64ImageSource.MediaType.IMAGE_PNG)
              .data(PLACEHOLDER_PNG)
              .build())
          .build();
      return ToolResultBlockParam.Content.ofBlocks(
          List.of(ToolResultBlockParam.Content.Block.ofImage(image)));
  }

  String navigate(String url) {
      return "navigated to " + url;
  }

  String readPage() {
      return """
          link "Docs" [ref_1]
          button "Search" [ref_2]""";
  }

  String clickRef(String ref) {
      return "clicked " + ref;
  }

  String clickAt(long x, long y) {
      return "clicked at (" + x + ", " + y + ")";
  }

  String typeText(String text) {
      return "typed: " + text;
  }

  /** Runs one browser toolset member; {@code action} is the tool_use block's name. */
  ToolResultBlockParam.Content handleBrowserAction(String action, Map<String, JsonValue> input) {
      if (action.equals("screenshot")) {
          return captureScreenshot(); // the one member here that answers with an image block
      }
      String output = switch (action) {
          case "navigate" -> navigate(input.get("url").asStringOrThrow());
          case "read_page" -> readPage();
          case "left_click" -> {
              // target 為 {"type": "ref", "ref": "ref_1"} 或 {"type": "coordinate", "x": 640, "y": 380}
              Map<String, JsonValue> target =
                  (Map<String, JsonValue>) input.get("target").asObject().get();
              if (target.get("type").asStringOrThrow().equals("ref")) {
                  yield clickRef(target.get("ref").asStringOrThrow());
              }
              long x = ((Number) target.get("x").asNumber().get()).longValue();
              long y = ((Number) target.get("y").asNumber().get()).longValue();
              yield clickAt(x, y);
          }
          case "type" -> typeText(input.get("text").asStringOrThrow());
          // 視需要處理其他動作
          default -> throw new UnsupportedOperationException("Unknown or unimplemented member: " + action);
      };
      return ToolResultBlockParam.Content.ofString(output);
  }
  ```

  ```php PHP
  // 代替真實 PNG 位元組的佔位資料；真實的執行器會擷取視埠畫面
  const PLACEHOLDER_PNG = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==';

  function navigateTo(string $url): string
  {
      return "navigated to {$url}";
  }

  function readPage(): string
  {
      return <<<'TEXT'
          link "Docs" [ref_1]
          button "Search" [ref_2]
          TEXT;
  }

  function clickTarget(array $target): string
  {
      // 目標可以是來自 read_page 或 find 的元素參照，或是視埠的像素座標
      if ($target['type'] === 'ref') {
          return "clicked {$target['ref']}";
      }

      return "clicked at ({$target['x']}, {$target['y']})";
  }

  function typeText(string $text): string
  {
      return "typed: {$text}";
  }

  function captureScreenshot(): array
  {
      // screenshot 以圖片區塊而非文字回應，因此回傳結果內容清單
      $image = [
          'type' => 'image',
          'source' => ['type' => 'base64', 'media_type' => 'image/png', 'data' => PLACEHOLDER_PNG],
      ];

      return [$image];
  }

  function handleBrowserAction(string $name, array $input): string|array
  {
      return match ($name) {
          'navigate' => navigateTo($input['url']),
          'read_page' => readPage(),
          'left_click' => clickTarget($input['target']),
          'type' => typeText($input['text']),
          'screenshot' => captureScreenshot(),
          // 視需要處理其他動作
          default => throw new \RuntimeException("Unknown or unimplemented member: {$name}"),
      };
  }
  ```

  ```ruby Ruby
  # 替代用的影像資料；實際的執行器會將視埠擷取為 PNG。
  PLACEHOLDER_PNG = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg=="

  def navigate(url)
    "navigated to #{url}"
  end

  def read_page
    <<~TREE
      link "Docs" [ref_1]
      button "Search" [ref_2]
    TREE
  end

  def click(target)
    return "clicked #{target[:ref]}" if target[:type] == "ref"

    "clicked at (#{target[:x]}, #{target[:y]})"
  end

  def type_text(text)
    "typed: #{text}"
  end

  def capture_screenshot
    [
      {
        type: "image",
        source: { type: "base64", media_type: "image/png", data: PLACEHOLDER_PNG }
      }
    ]
  end

  def handle_browser_action(name, input)
    case name
    when "navigate"
      navigate(input[:url])
    when "read_page"
      read_page
    when "left_click"
      # target 是元素參照（來自 read_page 或 find）或座標
      click(input[:target])
    when "type"
      type_text(input[:text])
    when "screenshot"
      capture_screenshot
    # 視需要處理其他動作
    else
      raise ArgumentError, "Unknown or unimplemented member: #{name}"
    end
  end
  ```
</CodeGroup>

第二部分依序執行一個批次，將每個區塊分派給這些處理常式，在每個結果上回傳 `toolset_name`，並套用[批次動作](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-tool#batch-actions)中的停止規則，將處理常式錯誤轉換為錯誤結果。呼叫它的取樣迴圈就是[了解代理迴圈](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/computer-use-tool#understanding-the-agentic-loop)中所示的迴圈，只是 `tools` 中換成瀏覽器工具集。

<CodeGroup exclude="shell">
  ```python Python
  NOT_EXECUTED = "Not executed: an earlier action in this turn failed."


  def process_tool_calls(response: Message) -> list[ToolResultBlockParam]:
      """
      Run the browser actions in Claude's response in order and answer each
      one. After the first failure the rest are skipped, because Claude planned
      them assuming the earlier actions succeeded.
      """
      tool_results: list[ToolResultBlockParam] = []
      failed = False
      for block in response.content:
          # 僅宣告了瀏覽器工具集；若您新增其他工具，請在此處路由
          if block.type != "tool_use" or block.toolset_name != "browser":
              continue
          result: ToolResultBlockParam = {
              "type": "tool_result",
              "tool_use_id": block.id,
              "toolset_name": "browser",
          }
          if failed:
              result["content"] = NOT_EXECUTED
              result["is_error"] = True
          else:
              try:
                  # 字串或內容區塊清單；實際的執行器還會在
                  # 導覽與分頁管理的結果中加入 browser_state 區塊
                  result["content"] = handle_browser_action(block.name, block.input)
              except Exception as err:
                  result["content"] = f"Error: {err}"
                  result["is_error"] = True
                  failed = True
          tool_results.append(result)
      return tool_results
  ```

  ```typescript TypeScript
  const HALT_TEXT = "Not executed: an earlier action in this turn failed.";

  function browserResult(
    toolUseId: string,
    content: string | Anthropic.ImageBlockParam[],
    isError?: boolean
  ): Anthropic.ToolResultBlockParam {
    return {
      type: "tool_result",
      tool_use_id: toolUseId,
      toolset_name: "browser",
      content,
      is_error: isError
    };
  }

  function processToolCalls(response: Anthropic.Message): Anthropic.ToolResultBlockParam[] {
    const toolResults: Anthropic.ToolResultBlockParam[] = [];
    let failed = false;
    for (const block of response.content) {
      if (block.type !== "tool_use") {
        continue;
      }
      if (block.toolset_name !== "browser") {
        // 此範例僅宣告瀏覽器工具集；若您新增其他工具，
        // 請在此處進行路由。
        continue;
      }
      if (failed) {
        // 批次會在第一次失敗時停止；後續動作不執行，直接回應
        toolResults.push(browserResult(block.id, HALT_TEXT, true));
        continue;
      }
      try {
        // 字串或圖片區塊清單；實際的執行器也會在
        // 導覽與分頁管理結果中加入 browser_state 區塊
        const result = handleBrowserAction(block.name, block.input);
        toolResults.push(browserResult(block.id, result));
      } catch (error) {
        failed = true;
        const message = error instanceof Error ? error.message : String(error);
        toolResults.push(browserResult(block.id, `Error: ${message}`, true));
      }
    }
    return toolResults;
  }
  ```

  ```csharp C#
  const string HaltText = "Not executed: an earlier action in this turn failed.";

  List<ContentBlockParam> ProcessToolCalls(Message response)
  {
      List<ContentBlockParam> toolResults = [];
      var failed = false;
      foreach (var block in response.Content)
      {
          if (!block.TryPickToolUse(out var toolUse))
          {
              continue;
          }

          if (toolUse.ToolsetName != "browser")
          {
              // 此範例僅宣告瀏覽器工具集；若您新增其他工具，
              // 請在此處進行路由。
              continue;
          }

          if (failed)
          {
              // 批次會在第一次失敗時停止；對後續動作直接回應而不執行
              toolResults.Add(
                  new ToolResultBlockParam(toolUse.ID)
                  {
                      Content = HaltText,
                      IsError = true,
                      ToolsetName = "browser",
                  }
              );
              continue;
          }

          try
          {
              // 字串或內容區塊清單；實際的執行器還會在
              // 導覽與分頁管理結果中加入 browser_state 區塊
              var result = HandleBrowserAction(toolUse.Name, toolUse.Input);
              toolResults.Add(
                  new ToolResultBlockParam(toolUse.ID) { Content = result, ToolsetName = "browser" }
              );
          }
          catch (Exception e)
          {
              failed = true;
              toolResults.Add(
                  new ToolResultBlockParam(toolUse.ID)
                  {
                      Content = $"Error: {e.Message}",
                      IsError = true,
                      ToolsetName = "browser",
                  }
              );
          }
      }
      return toolResults;
  }
  ```

  ```go Go
  const notExecuted = "Not executed: an earlier action in this turn failed."

  // browserToolResult 為單一瀏覽器動作建構結果。與
  // 一般工具結果不同，它必須回傳工具集名稱。真實的執行器也會
  // 在導覽與分頁管理結果中加入 browser_state 區塊。
  func browserToolResult(toolUseID string, content []anthropic.ToolResultBlockParamContentUnion, isError bool) anthropic.ContentBlockParamUnion {
  	result := anthropic.ToolResultBlockParam{
  		ToolUseID:   toolUseID,
  		ToolsetName: anthropic.String("browser"),
  		Content:     content,
  	}
  	if isError {
  		result.IsError = anthropic.Bool(true)
  	}
  	return anthropic.ContentBlockParamUnion{OfToolResult: &result}
  }

  // processToolCalls 依序執行 Claude 回應中的瀏覽器動作，並
  // 為每個 tool_use 區塊建立一個 tool_result。第一次失敗後會略過
  // 其餘動作：Claude 是在假設先前動作成功的前提下規劃它們的。
  func processToolCalls(response *anthropic.Message) []anthropic.ContentBlockParamUnion {
  	var toolResults []anthropic.ContentBlockParamUnion
  	failed := false
  	for _, block := range response.Content {
  		switch variant := block.AsAny().(type) {
  		case anthropic.ToolUseBlock:
  			// 此範例僅宣告瀏覽器工具集；若您新增其他工具，請在此處路由。
  			if variant.ToolsetName != "browser" {
  				continue
  			}
  			if failed {
  				toolResults = append(toolResults, browserToolResult(variant.ID, textContent(notExecuted), true))
  				continue
  			}
  			var input map[string]any
  			var content []anthropic.ToolResultBlockParamContentUnion
  			err := json.Unmarshal(variant.Input, &input)
  			if err == nil {
  				content, err = handleBrowserAction(variant.Name, input)
  			}
  			if err != nil {
  				failed = true
  				content = textContent("Error: " + err.Error())
  			}
  			toolResults = append(toolResults, browserToolResult(variant.ID, content, err != nil))
  		}
  	}
  	return toolResults
  }
  ```

  ```java Java
  /** The exact text the toolset contract prescribes for member calls skipped after a failure. */
  static final String HALT_TEXT = "Not executed: an earlier action in this turn failed.";

  /** Every result answering a browser toolset member echoes toolset_name. */
  ToolResultBlockParam.Builder browserResult(ToolUseBlock toolUse) {
      return ToolResultBlockParam.builder()
          .toolUseId(toolUse.id())
          .toolsetName("browser");
  }

  /**
   * Run the browser actions in Claude's response in order and build one
   * tool_result for each tool_use block. After the first failure, skip the rest:
   * Claude planned them assuming the earlier actions succeeded.
   */
  List<ContentBlockParam> processToolCalls(Message response) {
      List<ContentBlockParam> toolResults = new ArrayList<>();
      boolean failed = false;
      for (ContentBlock block : response.content()) {
          // 此範例僅宣告瀏覽器工具集；若您新增其他工具，請在此處路由。
          if (!block.isToolUse() || !block.asToolUse().toolsetName().equals(Optional.of("browser"))) {
              continue;
          }
          ToolUseBlock toolUse = block.asToolUse();
          ToolResultBlockParam result;
          if (failed) {
              result = browserResult(toolUse)
                  .content(HALT_TEXT)
                  .isError(true)
                  .build();
          } else {
              try {
                  Map<String, JsonValue> input =
                      (Map<String, JsonValue>) toolUse._input().asObject().get();
                  ToolResultBlockParam.Content output = handleBrowserAction(toolUse.name(), input);
                  // 實際的執行器也會在導覽與分頁管理的結果中加入 browser_state 區塊；
                  // 請參閱本頁的「使用 browser_state 追蹤分頁」。
                  result = browserResult(toolUse)
                      .content(output)
                      .build();
              } catch (RuntimeException e) {
                  failed = true;
                  result = browserResult(toolUse)
                      .content("Error: " + e.getMessage())
                      .isError(true)
                      .build();
              }
          }
          toolResults.add(ContentBlockParam.ofToolResult(result));
      }
      return toolResults;
  }
  ```

  ```php PHP
  const HALT_TEXT = 'Not executed: an earlier action in this turn failed.';

  function processToolCalls(Message $response): array
  {
      $toolResults = [];
      $failed = false;
      foreach ($response->content as $block) {
          // 此範例僅宣告瀏覽器工具集；若您新增其他工具，請在此處進行路由。
          if (!($block instanceof \Anthropic\Messages\ToolUseBlock) || $block->toolsetName !== 'browser') {
              continue;
          }
          $result = ['type' => 'tool_result', 'tool_use_id' => $block->id, 'toolset_name' => 'browser'];
          if ($failed) {
              // 批次會在第一個失敗處停止；其餘動作會在不執行的情況下回應
              $toolResults[] = [...$result, 'content' => HALT_TEXT, 'is_error' => true];
              continue;
          }
          try {
              // 真實的執行器也會在導覽與分頁管理結果中回傳 browser_state 區塊
              $toolResults[] = [...$result, 'content' => handleBrowserAction($block->name, $block->input)];
          } catch (\Throwable $e) {
              $failed = true;
              $toolResults[] = [...$result, 'content' => 'Error: ' . $e->getMessage(), 'is_error' => true];
          }
      }

      return $toolResults;
  }
  ```

  ```ruby Ruby
  NOT_EXECUTED = "Not executed: an earlier action in this turn failed."

  # 依序執行 Claude 回應中的瀏覽器動作，並為每個
  # tool_use 區塊建立一個 tool_result。第一次失敗後，略過其餘動作：
  # Claude 規劃這些動作時，假設先前的動作皆已成功。
  def process_tool_calls(response)
    tool_results = []
    failed = false
    response.content.each do |block|
      # 此範例僅宣告瀏覽器工具集；若您新增其他工具，
      # 請在此處進行路由。
      next unless block.type == :tool_use && block.toolset_name == "browser"

      result = { type: "tool_result", tool_use_id: block.id, toolset_name: "browser" }
      if failed
        result.update(content: NOT_EXECUTED, is_error: true)
      else
        begin
          # 字串，或螢幕截圖的內容區塊。實際的執行器也會
          # 在導覽與分頁管理結果中加入 browser_state 區塊。
          result[:content] = handle_browser_action(block.name, block.input)
        rescue => e
          result.update(content: "Error: #{e.message}", is_error: true)
          failed = true
        end
      end
      tool_results << result
    end
    tool_results
  end
  ```
</CodeGroup>

請依據（`toolset_name`、`name`）這一組值來分派每個區塊，而不是只依據 `name`，因為同一請求中的自訂工具可能與某個成員同名；[用戶端工具集](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/tool-reference#client-toolsets)說明了兩個工具集共用的此合約部分。如果 Claude 指定了您的執行器未實作的成員，或您已停用的成員，請以[錯誤結果](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-tool#return-errors-from-your-executor)回應該區塊，而不是將其捨棄。

當您以「streaming」（串流）方式接收回應時，每個成員的 `input` 會以一個完整的 `input_json_delta` 送達，而非分段送達，因此請等待該回合結束後再執行批次。

### 批次動作

包含多個成員呼叫的回合即為批次動作：依出現順序執行呼叫，在第一次失敗時停止，並以 `is_error: true` 和確切的文字 `Not executed: an earlier action in this turn failed.` 回應之後的每個呼叫。批次使用與[平行工具使用](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/parallel-tool-use)相同的回應形式；差別在於您是依序執行區塊，而非同時執行。以下範例中，Claude 在一個回合內點擊它先前找到的搜尋框、輸入查詢，然後按下 Enter：

```json
{
  "role": "assistant",
  "content": [
    {
      "type": "tool_use",
      "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
      "name": "left_click",
      "toolset_name": "browser",
      "input": { "target": { "type": "ref", "ref": "ref_3" } }
    },
    {
      "type": "tool_use",
      "id": "toolu_01Ez4kLb1nQ2vXo8sJ9pWm3c",
      "name": "type",
      "toolset_name": "browser",
      "input": { "text": "install" }
    },
    {
      "type": "tool_use",
      "id": "toolu_01FkP8rTz6uYh2mNq4LsXw7v",
      "name": "key",
      "toolset_name": "browser",
      "input": { "text": "Enter" }
    }
  ]
}
```

您的應用程式在一則 `user` 訊息中回傳三個 `tool_result` 區塊，每個區塊都帶有 `toolset_name` 和一段簡短的文字確認，例如 `Clicked element ref_3.`。按下 Enter 會載入結果頁面，因此 `key` 結果也會帶有一個含有分頁更新後 URL 的 `browser_state` 區塊（[其他結果上的分頁上下文](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-tool#tab-context-on-other-results)）。如果點擊失敗，其結果會帶有您的錯誤文字，而另外兩個結果則會帶有停止文字，如[從您的執行器回傳錯誤](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-tool#return-errors-from-your-executor)中所示。

您不需要在每次呼叫後都回傳螢幕截圖。Claude 通常會以一個觀察呼叫（`screenshot`、`read_page` 或 `get_page_text`）結束批次，而您的應用程式也可以將自己的觀察（例如新的螢幕截圖或無障礙樹）作為額外的內容區塊附加在批次的最後一個結果上，以節省一次往返。由於分頁管理結果必須恰好是一個 `browser_state` 區塊，請將其附加到最後一個非分頁管理呼叫的結果上。

如果您的執行器每次往返只能執行一個呼叫，請在 `tool_choice` 中將 `disable_parallel_tool_use` 設為 `true`，Claude 每個回合最多只會回傳一個成員呼叫，代價是需要更多往返（[停用平行工具使用](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/parallel-tool-use#disable-parallel-tool-use)）。[電腦使用工具的批次動作](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/computer-use-tool#batch-actions)中其餘的合約內容同樣適用，包括在下一則 `user` 訊息中為每個 `tool_use` 回傳一個 `tool_result`，但有兩點例外：停止文字，以及成功結果的 `content` 所包含的內容。結果內容改為遵循本頁的[成員工具](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-tool#member-tools)：`new_tab`、`switch_tab`、`close_tab` 或 `list_tabs` 的結果恰好是一個 `browser_state` 區塊，不含文字或圖片（[分頁管理結果](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-tool#tab-management-results)），而任何其他成員的結果則可以在其文字或圖片之外加上一個 `browser_state` 區塊（[其他結果上的分頁上下文](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-tool#tab-context-on-other-results)）。批次中快取中斷點的生效位置，請參閱電腦使用工具[工具參數](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/computer-use-tool#tool-parameters)中的 `cache_control` 列。

### 目標與座標

作用於某個位置的成員工具會接受一個 `target` 物件，它可以是視埠像素座標，或是對 `read_page` 或 `find` 所回傳元素的參照。[成員工具](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-tool#member-tools)表格中以 `Target` 表示可接受任一形式的參數。

| 形式 | `target.type` | 欄位 | 接受的成員 |
| ----- | ----- | ----- | ----- |
| `CoordinateTarget` | `"coordinate"` | `x`、`y`（整數，視埠像素） | `left_click`、`right_click`、`middle_click`、`double_click`、`triple_click`、`hover`、`left_click_drag`（`from` 和 `target`）、`left_mouse_down`、`left_mouse_up`、`mouse_move`、`scroll` |
| `RefTarget` | `"ref"` | `ref`（元素參照，例如 `"ref_2"`） | `left_click`、`right_click`、`middle_click`、`double_click`、`triple_click`、`hover`、`scroll_to`、`form_input`、`file_upload` |

**座標是視埠像素**，即完整視埠 `screenshot` 的像素空間，原點位於已渲染頁面的左上角；周圍沒有桌面或視窗框架。工具集不宣告顯示尺寸，Claude 會從您回傳的螢幕截圖推斷視埠大小，因此請讓螢幕截圖保持一致的尺寸。`zoom` 不會改變座標框架，因此其 `region` 以及 Claude 在收到放大圖片後發出的任何座標，仍然是完整視埠的像素。

**螢幕截圖必須符合圖片限制。** API 不會縮小工具集圖片：超過您模型的[圖片大小限制](https://platform.claude.com/docs/zh-TW/build-with-claude/vision#evaluate-image-size)，或超過請求中包含[超過 20 張圖片](https://platform.claude.com/docs/zh-TW/build-with-claude/vision#request-limits)時所適用的更嚴格單張圖片限制的螢幕截圖或縮放圖片，將會被拒絕。請在回傳前調整大小，並在分派 Claude 的座標之前，以您縮放係數的倒數將其放大回原尺寸（[調整螢幕截圖大小以符合圖片限制](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/computer-use-tool#handle-coordinate-scaling-for-higher-resolutions)）。

**元素參照來自 `read_page` 和 `find`。** 它們輸出中的每個元素都帶有一個標記，例如 `[ref_2]`，如快速入門的結果所示：

```text wrap
link "Documentation" [ref_1]
link "Getting started" [ref_2]
textbox "Search docs" [ref_3]
button "Search" [ref_4]
link "Pricing" [ref_5]
```

Claude 會在之後的點擊、`hover`、`scroll_to`、`form_input` 或 `file_upload` 呼叫中，以 `{"type": "ref", "ref": "ref_2"}` 目標的形式傳回參照，或在 `read_page` 上以 `ref` 參數傳回參照來讀取子樹。您的執行器負責指派參照，保存每個參照與底層節點（無障礙節點 ID、儲存的選擇器或同等物）之間的對應，並在參照傳回時對該節點採取動作。

參照的範圍限於產生它們的分頁，並在該分頁導覽離開或其 DOM 發生實質變更之前保持有效。API 無法偵測過時或未知的參照，因此當 Claude 傳入您的執行器不再能識別的參照時，請回傳錯誤結果，例如 `Error: ref_3 is stale or not found on the current page. Re-read the page to get fresh references.`。Claude 接著就會重新讀取頁面。在分頁導覽離開之前，請不要對已發出的參照重新編號，因為這會在不知不覺中讓 Claude 仍持有的參照失效。

Claude 會同時使用兩種目標指定方式，並根據頁面所提供的內容在兩者之間切換；您的提示和執行器回傳的內容會影響這個選擇：

* **在頁面具有可用的無障礙樹時，優先使用參照。** 參照能在使像素座標變得不可靠的版面位移和重排中保持有效，並讓 Claude 能對難以用指標點擊的控制項採取動作。
* **對於樹未描述的內容，改用座標。** 以 canvas 渲染的介面、內嵌的影片或遠端桌面畫面、大量虛擬化的清單，以及跨來源 iframe 內的元素，通常沒有有用的節點，因此 Claude 會透過 `screenshot` 和 `zoom` 處理，並以座標點擊；由您的執行器判斷座標落在哪個框架中。
* **限定讀取範圍，並在截圖之前先讀取樹。** 在大型頁面上，使用 `filter: "interactive"` 或容器的 `ref` 呼叫 `read_page` 會回傳聚焦的子樹，而讀取典型頁面的樹所耗用的輸入 token 通常比螢幕截圖更少，同時還能給予 Claude 可立即操作的參照。當視覺版面、圖片或渲染狀態很重要時，螢幕截圖仍是合適的觀察方式。

## 安全性考量

瀏覽器使用帶有標準 API 功能所沒有的風險，因為 Claude 會閱讀並操作來自開放網路的內容，而任何頁面都可能包含為操縱它而撰寫的文字。

<Warning>
  為了降低這些風險，請採取以下預防措施：

  1. 在專用的容器或虛擬機器中執行瀏覽器和執行器，並給予最低權限、使用不含任何憑證的全新設定檔，且不得存取敏感的檔案系統或內部網路；與其一起執行的任何工具也請以相同方式隔離。
  2. 將瀏覽器可連線的主機限制在一份於網路層強制執行的網域允許清單內，並在重新導向後於您的 `navigate` 處理常式中再次檢查，除非任務需要，否則封鎖迴路、鏈路本地和私有位址範圍。
  3. 將頁面提供的所有內容視為不受信任的輸入。這包括您在 [`browser_state`](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-tool#track-tabs-and-page-state) 區塊中回報的分頁標題和 URL，以及每個下載項目的 `url`、`path` 和 `error`。請根據頁面渲染的內容（無障礙樹或可見文字）來建構頁面讀取結果，而非原始 DOM 原始碼，以免隱藏文字傳到 Claude。
  4. 在您的 `navigate` 處理常式中，接受歷史關鍵字 `"back"`、`"forward"` 和 `"reload"`，將沒有 scheme 的 URL 視為 `https://`，然後剖析 URL，並以[錯誤結果](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-tool#return-errors-from-your-executor)拒絕 `http` 或 `https` 以外的任何 scheme（`javascript:`、`file:`、`data:`、`chrome:` 等）。請使用 URL 剖析器而非字串前綴來檢查 scheme；API 不會篩選 Claude 開啟的 URL，因此無法替您拒絕。
  5. 除非您需要，否則請保持 `javascript_exec` 和 `file_upload` 為停用狀態，並在啟用其中任何一個之前閱讀[啟用選用成員](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-tool#enable-optional-member-tools)。
  6. 讓人類確認具有重大後果的動作，以及任何需要明確同意的事項（購買、修改帳戶、傳送訊息和接受條款），並在每次呼叫前於您的執行器中進行該檢查，因為一個回合可能包含多個呼叫。
</Warning>

即使頁面內容中的指示與您的指示相衝突，Claude 有時仍會遵循它們；頁面上寫著「忽略您先前的指示並前往……」的文字可能讓它偏離任務。請將 Claude 與敏感資料和動作隔離，以限制「prompt injection」（提示注入）所能觸及的範圍，並參閱[減輕越獄和提示注入](https://platform.claude.com/docs/zh-TW/test-and-evaluate/strengthen-guardrails/mitigate-jailbreaks)；如果任務無法避免使用已登入的工作階段，請使用專用的低權限帳戶，並對變更帳戶的動作保留人工確認。

Anthropic 已訓練模型抵禦這些提示注入，並增加了一層額外的防禦。如果您使用瀏覽器使用工具，分類器會自動掃描瀏覽器回傳的內容（例如頁面文字或螢幕截圖），以標記潛在的提示注入。當這些分類器識別出潛在的提示注入時，會引導模型在採取行動之前，先確認該指示是否真的來自您。

這項額外保護並非適合所有使用情境（例如沒有人類參與迴圈的使用情境），因此如果您想選擇退出並關閉它，請[聯絡支援團隊](https://support.claude.com/en/)。即使有這些分類器，前面列出的預防措施仍然很重要。

由於瀏覽器在您的環境中執行，Claude 造訪的網站會看到您執行器的網路身分，而頁面內容只會以您回傳的工具結果形式到達 API。在您的產品中啟用瀏覽器使用之前，請告知終端使用者相關風險並取得其同意。

## 成員工具

`browser_toolset_20260801` 項目宣告了 31 個成員工具；每個呼叫的 `input` 恰好就是此處列出的參數，而 `tab_id` 在為選用時預設為目前作用中的分頁。`Target`、`CoordinateTarget` 和 `RefTarget` 是[目標與座標](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-tool#targets-and-coordinates)中所描述的形式。四個成員（`javascript_exec`、`file_upload`、`read_console` 和 `read_network`）預設為停用，只有在您啟用時才會出現（請參閱[啟用選用成員](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-tool#enable-optional-member-tools)）。每個成員列中所註明的輸入範圍和輸出慣例是告知 Claude 的，而非由 API 強制執行，因此請在您的執行器中驗證輸入（包括依據您的視埠驗證座標）並套用這些慣例。

只有 `screenshot` 和 `zoom` 需要在其結果中包含 [`image` 區塊](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/handle-tool-calls#handling-results-from-client-tools)，而四個分頁管理成員（`new_tab`、`list_tabs`、`switch_tab` 和 `close_tab`）會恰好回傳一個 `browser_state` 區塊（請參閱[分頁管理結果](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-tool#tab-management-results)）。其他每個成員都會回傳一個 `text` 區塊：可以是簡短的確認，例如 `Clicked element ref_2.`，或是該成員的輸出。除分頁管理結果之外的任何結果也都可以帶有一個 `image` 區塊，通常是動作之後擷取的螢幕截圖，讓 Claude 無需另外呼叫 `screenshot` 即可得知結果；[批次動作](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-tool#batch-actions)說明了在批次中應將其附加在何處。成員 `tool_result` 只能包含 `text`、`image` 和 `browser_state` 內容區塊。

### 導覽與擷取

| 成員 | 輸入 | 說明 |
| ----- | ----- | ----- |
| `navigate` | `url`、`tab_id?` | 載入 `http` 或 `https` URL，或使用 `"back"`、`"forward"` 或 `"reload"` 在歷史紀錄中移動。將沒有 scheme 的 URL 視為 `https://`，並以錯誤結果拒絕任何其他 scheme。回傳簡短的確認，並在分頁的 URL 或標題變更時加上一個 `browser_state` 區塊。 |
| `screenshot` | `tab_id?` | 擷取視埠並回傳一個 `image` 區塊。 |
| `zoom` | `region`、`tab_id?` | 回傳 `region`（以視埠像素表示為 `[x0, y0, x1, y1]`）經裁切和放大的 `image`，以便更仔細地檢視小字或控制項。 |

### 指標

| 成員 | 輸入 | 說明 |
| ----- | ----- | ----- |
| `left_click` | `target: Target`、`modifiers?`、`tab_id?` | 以左鍵點擊座標或參照的元素。`modifiers` 是點擊時按住的組合鍵，例如 `"shift"` 或 `"ctrl+shift"`。 |
| `right_click` | `target: Target`、`modifiers?`、`tab_id?` | 以右鍵點擊座標或元素。 |
| `middle_click` | `target: Target`、`modifiers?`、`tab_id?` | 以中鍵點擊座標或元素。 |
| `double_click` | `target: Target`、`modifiers?`、`tab_id?` | 以左鍵雙擊座標或元素。 |
| `triple_click` | `target: Target`、`modifiers?`、`tab_id?` | 以左鍵三連擊座標或元素，通常用於選取一行或一個段落。 |
| `hover` | `target: Target`、`tab_id?` | 將指標移到座標或元素上方而不點擊。 |
| `left_click_drag` | `from: CoordinateTarget`、`target: CoordinateTarget`、`tab_id?` | 在 `from` 按下、拖曳到 `target`，然後放開。 |
| `left_mouse_down` | `target: CoordinateTarget`、`tab_id?` | 在座標處按住左鍵；與 `left_mouse_up` 搭配使用以進行自訂拖曳。 |
| `left_mouse_up` | `target: CoordinateTarget`、`tab_id?` | 在座標處放開左鍵。 |
| `mouse_move` | `target: CoordinateTarget`、`tab_id?` | 將指標移到某個座標。 |
| `scroll` | `target: CoordinateTarget`、`scroll_direction`、`scroll_amount?`、`tab_id?` | 在視埠位置捲動。`scroll_direction` 為 `"up"`、`"down"`、`"left"` 或 `"right"`；`scroll_amount` 以滾輪刻度為單位，範圍 1 到 10，預設為 3。 |
| `scroll_to` | `target: RefTarget`、`tab_id?` | 將參照的元素捲動到可見範圍內。 |

### 鍵盤與時間

| 成員 | 輸入 | 說明 |
| ----- | ----- | ----- |
| `type` | `text`、`tab_id?` | 在目前焦點處輸入一段字面字串。 |
| `key` | `text`、`repeat?`、`tab_id?` | 按下一個按鍵或組合鍵。`text` 為單一按鍵（`"Enter"`）、以 `+` 連接的組合鍵（`"ctrl+a"`），或以空格分隔的序列（`"Backspace Backspace"`）；`repeat` 範圍為 1 到 100，預設為 1。 |
| `hold_key` | `text`、`duration`、`tab_id?` | 按住一個按鍵或組合鍵 `duration` 秒，範圍 0 到 30。 |
| `wait` | `duration`、`tab_id?` | 暫停 `duration` 秒，範圍 0 到 30。 |

### 頁面讀取

| 成員 | 輸入 | 說明 |
| ----- | ----- | ----- |
| `read_page` | `filter?`、`depth?`、`ref?`、`tab_id?` | 以文字形式回傳頁面的無障礙樹，每個元素都標記有參照，例如 `[ref_2]`。省略 `filter` 時，回傳每個可見元素；使用 `"interactive"` 時，僅回傳可見的互動式元素；使用 `"all"` 時，也會回傳視埠外的元素。`depth` 限制樹的深度（最小為 1，預設為 15），`ref` 則將讀取範圍限定在該元素的子樹。請將輸出限制在 50,000 個字元以內，並在文字中說明；Claude 接著會使用較小的 `depth` 或 `ref` 縮小範圍。 |
| `find` | `query`、`tab_id?` | 尋找符合自然語言描述（例如 `"search field"` 或 `"add to cart button"`）的元素，並以與 `read_page` 相同的標記格式回傳最多 20 個相符項目。 |
| `get_page_text` | `tab_id?` | 以純文字回傳頁面的可見文字，優先呈現主要文章內容；適用於文章、文件和其他以文字為主的頁面。 |

### 表單與檔案

| 成員 | 輸入 | 說明 |
| ----- | ----- | ----- |
| `form_input` | `target: RefTarget`、`value`、`tab_id?` | 直接設定表單元素的值。`value` 為 `string`、`number` 或 `boolean`；核取方塊請使用 `boolean`，下拉選單請使用選項的值或可見文字。 |
| `file_upload`（預設停用） | `target: RefTarget`、`paths?`、`document_ids?`、`tab_id?` | 從執行器檔案系統上的 `paths`、您的應用程式已暫存的 `document_ids`，或兩者，設定檔案輸入元素上的檔案；至少需要其中之一。請參閱[上傳檔案](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-tool#upload-files)。 |

### 診斷與指令碼

| 成員 | 輸入 | 說明 |
| ----- | ----- | ----- |
| `read_console`（預設停用） | `tab_id?` | 回傳自上次讀取以來該分頁累積的主控台項目（記錄、警告和錯誤行），每個項目一行。請參閱[讀取主控台與網路活動](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-tool#read-console-and-network-activity)。 |
| `read_network`（預設停用） | `tab_id?` | 回傳自上次讀取以來該分頁的網路請求（方法、URL、狀態、MIME 類型、時間），每個項目一行。 |
| `javascript_exec`（預設停用） | `text`、`tab_id?` | 在頁面上下文中以 JavaScript 執行 `text`，並以文字形式回傳最後一個運算式的值。請參閱[啟用選用成員](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-tool#enable-optional-member-tools)。 |

### 分頁管理

| 成員 | 輸入 | 說明 |
| ----- | ----- | ----- |
| `new_tab` | （無） | 開啟一個分頁並將其設為作用中分頁。 |
| `list_tabs` | （無） | 回報分頁清單。 |
| `switch_tab` | `tab_id`（必要） | 將 `tab_id` 設為作用中分頁。 |
| `close_tab` | `tab_id`（必要） | 關閉 `tab_id`。 |

成功時，這些成員各自會恰好回傳一個 `browser_state` 區塊，不含文字或圖片；請參閱[分頁管理結果](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-tool#tab-management-results)。

## 設定工具集

除了 `type` 之外，工具集項目還接受 `configs`、`cache_control` 和 `allowed_callers`；這些欄位與電腦使用工具集共用的規則列於[用戶端工具集](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/tool-reference#client-toolsets)中，本節則說明瀏覽器特有的預設值。`configs` 是以成員名稱為鍵的物件，每個成員的值接受兩個欄位：

| 欄位 | 預設值 | 意義 |
| ----- | ----- | ----- |
| `enabled` | `true`，但四個[選用成員](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-tool#enable-optional-member-tools)為 `false` | 是否向 Claude 提供該成員。 |
| `defer_loading` | `false` | 是否為工具搜尋延遲載入工具集的定義。在每個已啟用的成員上必須解析為相同的值。當四個選用成員保持停用時，延遲載入工具集意味著在其他 27 個成員上設定此值；請參閱[用戶端工具集](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/tool-reference#client-toolsets)。 |

### 啟用或停用成員工具

在 `configs` 中只列出您想變更的成員；您省略的每個成員都保持其預設值。例如，一個實作了主控台讀取但未實作低階指標或按住按鍵控制的執行器，會開啟 `read_console` 並停用三個成員：

```json
{
  "type": "browser_toolset_20260801",
  "configs": {
    "read_console": { "enabled": true },
    "left_mouse_down": { "enabled": false },
    "left_mouse_up": { "enabled": false },
    "hold_key": { "enabled": false }
  }
}
```

已停用的成員會從 Claude 收到的定義中消失；但這並不保證 Claude 永遠不會指定它，因此您的執行器仍需以[錯誤結果](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-tool#return-errors-from-your-executor)回應此類呼叫。

### 與其他工具結合使用

請在同一個 `tools` 陣列中，將瀏覽器使用工具與您自己的工具以及其他 Anthropic 提供的工具一起宣告。自訂工具可以與成員同名（例如您自己的 `navigate`），因為 `toolset_name` 可區分 Claude 的呼叫，但其他項目都不能命名為 `browser`，且一個請求只能包含一個瀏覽器工具集項目。

您也可以將其與[電腦使用工具](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/computer-use-tool)一起宣告，無論是工具集或較早的電腦使用工具版本皆可。兩者獨立運作，各自使用自己的座標框架（此處為視埠像素，那裡為桌面螢幕截圖像素），而 Claude 對同名成員（例如 `screenshot` 或 `key`）的呼叫則以 `toolset_name` 區分。

## 啟用選用成員

有四個成員工具預設為停用：`javascript_exec` 和 `file_upload` 是因為它們擴大了被操縱的頁面可能讓 Claude 做的事，而 `read_console` 和 `read_network` 則是因為並非每個瀏覽器自動化堆疊都能提供這些記錄，且它們擴大了傳到 Claude 的頁面控制內容。請僅在您的執行器實作了某個成員且任務需要時，才使用 `configs` 啟用它（例如 `"configs": {"file_upload": {"enabled": true}}`）。

### 上傳檔案

`file_upload` 直接設定 `<input type="file">` 元素上的檔案，這比操作原生檔案選擇器更可靠。它的 `target` 只能是參照，因為該呼叫需要元素的身分，並且它接受 `paths`、`document_ids` 或兩者：

* `paths` 是執行器檔案系統上的檔案路徑，適用於執行器可直接讀取您應用程式檔案的部署（與您填入下載項目 `path` 的條件相同）。
* `document_ids` 是您的應用程式為瀏覽器暫存之檔案的識別碼，適用於執行器無法直接讀取的部署。這些識別碼的意義由您的應用程式定義；請以限定 `paths` 範圍的相同方式限定其解析範圍，僅限於為此任務暫存的檔案。

```json
{
  "type": "tool_use",
  "id": "toolu_01N7gVzFEfZjLjgsYwnrPgrF",
  "name": "file_upload",
  "toolset_name": "browser",
  "input": {
    "target": { "type": "ref", "ref": "ref_12" },
    "paths": ["/home/user/uploads/summary.pdf"],
    "tab_id": "tab-2"
  }
}
```

Claude 是在閱讀不受信任的頁面時寫出這些路徑的，因此不受限制的實作會讓惡意頁面得以指使將執行器可讀取的任何檔案上傳到該頁面所控制的網站。請僅在您的執行器會解析每個路徑（追蹤符號連結和 `..` 區段），且只接受位於專用、已列入允許清單、僅存放此任務所需檔案的上傳目錄內的路徑時，才啟用此成員。請勿將瀏覽器的下載目錄重複用於此用途；否則，頁面讓瀏覽器下載的每個檔案都會變成可上傳的。

### 在頁面中執行 JavaScript

`javascript_exec` 在頁面的上下文中執行 Claude 撰寫的運算式，並以文字形式回傳最後一個運算式的值；Claude 撰寫的是運算式，而非 `return` 陳述式。程式碼以頁面的完整權限執行，包括其 cookie、儲存空間和同源請求。請僅在不持有任何憑證的工作階段中啟用此成員，並讓[安全性考量](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-tool#security-considerations)中的網域允許清單保持生效，將回傳的值視為不受信任的輸入，並記錄 Claude 發出的程式碼。

### 讀取主控台與網路活動

`read_console` 回傳分頁的主控台項目，`read_network` 回傳其網路請求，兩者皆以文字形式呈現，自該分頁上次讀取以來累積的每個項目各佔一行。主控台行包含一筆記錄、警告或錯誤項目；網路行則包含方法、URL、狀態、MIME 類型和時間。項目只會從您的瀏覽器自動化附加到該分頁的那一刻起存在，因此空的結果並不代表一個原本就已開啟的分頁沒有任何流量。

這些成員讓 Claude 無需反覆截圖，就能診斷行為異常的頁面（載入指示器背後的失敗請求、無回應按鈕背後的指令碼錯誤）。主控台和網路項目由頁面控制，且經常包含機密資訊，例如請求 URL 中的 token，因此請在回傳前遮蔽您不希望出現在 Claude 上下文中的類似憑證的值，並截斷過長的項目。

## 使用 `browser_state` 追蹤分頁

Claude 透過 `tab_id` 來指定分頁，您的應用程式是哪些分頁存在的唯一事實來源（source of truth），而您會在 `browser_state` 內容區塊中回報該狀態。Claude 永遠不會直接收到此區塊：API 會將其轉譯成 Claude 讀取的文字。

```json
{
  "type": "browser_state",
  "tabs": [
    {
      "tab_id": "tab-1",
      "title": "Documentation",
      "url": "https://example.com/docs",
      "active": true
    },
    { "tab_id": "tab-2", "title": "Pricing", "url": "https://example.com/pricing" }
  ]
}
```

* `tabs` 是呼叫後所有已開啟分頁的完整清單，而非差異（delta）。它可以為空；只要不為空，就必須恰好有一個項目帶有 `"active": true`。
* `state_changes`（此處未顯示）回報呼叫的副作用：針對呼叫所開啟且在呼叫完成時仍開啟的每個分頁，提供一個 `tab_opened` 項目，其 `tab_id` 也必須出現在 `tabs` 中；以及[下載事件](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-tool#report-downloads)。沒有任何內容需要回報時，請省略此欄位；空陣列會被拒絕。
* 僅在回應瀏覽器成員呼叫的結果上傳送此區塊，每個 `tool_result` 最多一次，且絕不在帶有 `is_error: true` 的結果上傳送。若要表達「沒有分頁狀態需要回報」，請省略此區塊。
* API 會將 `tabs` 以及 `state_changes` 中的任何下載項目轉譯成提供給 Claude 的文字。接下來的兩個章節與[回報下載](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-tool#report-downloads)會展示該文字。

**`tab_id` 值由您指定。** 任何穩定的字串皆可，例如您的自動化程式庫的頁面識別碼或您自己的計數器，只要在具有該識別碼的分頁仍於先前結果中列為開啟時，不重複使用該 `tab_id` 即可。API 會對此區塊強制執行以下限制：

* 每個 `tab_id`、`title` 和 `url` 最多 4,096 個字元，`tab_id` 不得為空，且皆不得包含控制字元（包括換行字元）或 Unicode 行分隔符或段落分隔符。
* 一個區塊最多可列出 100 個分頁和 200 個狀態變更。
* 相同的限制也適用於 Claude 傳遞給 `switch_tab` 和 `close_tab` 的 `tab_id`，因為 API 會將其轉譯到結果文字中；因此，若呼叫的 `tab_id` 違反這些限制，請以錯誤結果回應，而非 `browser_state` 區塊。

<Warning>
  分頁標題和 URL 來自頁面，並會被轉譯成 Claude 讀取的文字，因此它們是「prompt injection」（提示注入）的攻擊面。API 會逐字轉譯分頁 URL，因此在填入 `tabs` 之前，請先清理頁面提供的 URL。API 在轉譯標題時會跳脫雙引號和反斜線，因此請勿預先跳脫標題（預先跳脫的標題到達 Claude 時會被雙重跳脫）；截斷或捨棄可疑的標題仍然是值得的做法。下載項目的 `url`、`path` 和 `error` 也會被轉譯成 Claude 讀取的文字，因此也請將它們視為不受信任；API 會如同處理標題一樣為其加上引號並跳脫。API 強制執行的長度與字元限制只是最低要求，而非防禦措施。
</Warning>

### 分頁管理結果

對於 `new_tab`、`switch_tab`、`close_tab` 和 `list_tabs`，成功結果的 `content` 恰好是一個 `browser_state` 區塊，不含任何文字或圖片，而 Claude 收到的文字由 API 撰寫。`new_tab` 結果的區塊還必須恰好帶有一個 `tab_opened` 狀態變更，其 `tab_id` 與標記為 `active: true` 的項目相符。

| 成員 | Claude 收到的文字 |
| ----- | ----- |
| `switch_tab` | `Switched to tab {tab_id}`，取自呼叫的 `input.tab_id` |
| `close_tab` | `Closed tab {tab_id}`，取自呼叫的 `input.tab_id` |
| `new_tab` | `Created new tab with tab_id: {tab_id}, URL: {url}. It is now the current tab.`，取自標記為 `active: true` 的項目 |
| `list_tabs` | `Available tabs:` 後接每個分頁一行，或在 `tabs` 為空時為 `No tabs available` |

若 `list_tabs` 結果的區塊列出兩個分頁且第一個為作用中分頁，其轉譯結果如下，每行縮排兩個空格，且僅在作用中分頁後附加 `(current)`：

```text wrap
Available tabs:
  • tab_id tab-1: "Documentation" (https://example.com/docs) (current)
  • tab_id tab-2: "Pricing" (https://example.com/pricing)
```

這些成員的錯誤結果則相反：`content` 中為一般錯誤文字、`is_error: true`，且沒有 `browser_state` 區塊。

例如，當 Claude 呼叫 `new_tab`（其 `input` 為空）時，您的執行器會開啟該分頁、將其設為作用中，並回傳包含一個 `tab_opened` 項目的清單：

```json
{
  "role": "user",
  "content": [
    {
      "type": "tool_result",
      "tool_use_id": "toolu_01WvHSbQVV9j5nWGvTmk4vNL",
      "toolset_name": "browser",
      "content": [
        {
          "type": "browser_state",
          "tabs": [
            { "tab_id": "tab-1", "title": "Documentation", "url": "https://example.com/docs" },
            { "tab_id": "tab-2", "title": "Pricing", "url": "https://example.com/pricing" },
            { "tab_id": "tab-3", "title": "", "url": "about:blank", "active": true }
          ],
          "state_changes": [{ "type": "tab_opened", "tab_id": "tab-3" }]
        }
      ]
    }
  ]
}
```

Claude 會收到 `Created new tab with tab_id: tab-3, URL: about:blank. It is now the current tab.`。請如此處所示回報分頁開啟時的 URL，而非之後重新導向的 URL；後續結果會回報該分頁當時的 URL。

### 其他結果中的分頁上下文

在其他所有成員上，此區塊是選用的：當開啟的分頁集合、作用中分頁，或某個分頁的標題或 URL 發生變更時，或有 `state_changes` 需要回報時，請傳送此區塊，並且一律包含完整的 `tabs` 清單。當結果同時帶有文字和 `browser_state` 區塊時，API 會在該結果的文字後附加 `Tab Context` 頁尾，並以空白行與您的文字分隔，讓 Claude 無需另外呼叫 `list_tabs` 即可收到新狀態：

```text wrap
Tab Context:
- Executed on tab_id: tab-1
- Available tabs:
  • tab_id tab-1: "Documentation" (https://example.com/docs)
  • tab_id tab-2: "Pricing" (https://example.com/pricing)
```

`Executed on` 指出呼叫執行所在的分頁：若有 `tab_id` 輸入則為該值，否則為作用中分頁；頁尾的分頁行不帶 `(current)` 標記。請勿自行附加此文字；請傳送結構化區塊，讓 API 轉譯它。頁尾會去除重複，因此相同的分頁狀態不會在後續結果中再次轉譯，大方地填入此區塊也不會有任何成本。

以下三種情況即使有此區塊也不會轉譯頁尾：

* 任何 `zoom` 結果。
* 沒有 `text` 區塊的結果（例如僅含圖片的 `screenshot` 結果）。該結果不會轉譯也不會記錄任何內容；分頁上下文會出現在下一個同時帶有文字和 `browser_state` 區塊的結果上，因此若您希望分頁變更在同一個結果中傳達給 Claude，請在圖片旁附上一個簡短的文字區塊。例外情況是區塊回報了[下載事件](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-tool#report-downloads)的結果。API 會將下載行作為文字區塊加入，而頁尾會像在任何帶有文字的結果上一樣接在其後。
* 在未帶有 `tab_id` 的呼叫中，`tabs` 清單為空的結果，因為沒有可指名的分頁。

例如，當 Claude 在此工作階段稍早點擊「Pricing」連結（`ref_5`）時，頁面在一個 Claude 並未要求的新分頁中開啟它；若不回報，Claude 將必須呼叫 `list_tabs` 才能發現它。請回傳點擊的確認訊息，加上一個 `state_changes` 指名已開啟分頁的區塊，並標記您的執行器所保留的作用中分頁：

```json
{
  "role": "user",
  "content": [
    {
      "type": "tool_result",
      "tool_use_id": "toolu_01EgTXj1FjE2FCTt2zNFWLao",
      "toolset_name": "browser",
      "content": [
        { "type": "text", "text": "Clicked element ref_5." },
        {
          "type": "browser_state",
          "tabs": [
            {
              "tab_id": "tab-1",
              "title": "Documentation",
              "url": "https://example.com/docs",
              "active": true
            },
            { "tab_id": "tab-2", "title": "Pricing", "url": "https://example.com/pricing" }
          ],
          "state_changes": [{ "type": "tab_opened", "tab_id": "tab-2" }]
        }
      ]
    }
  ]
}
```

Claude 會收到 `Clicked element ref_5.`，後接前面所示的 Tab Context 頁尾。在失敗的呼叫期間開啟的分頁不會有 `tab_opened` 項目，因為錯誤結果不帶 `browser_state`；它會改為出現在下一個成功結果的 `tabs` 清單中。在批次中，請將區塊附加到變更發生期間所執行之呼叫的結果上，並為每個成功的分頁管理結果提供自己的區塊，即使同一回合中較早的結果已回報了相同的狀態。

### 回報下載

當點擊或導覽開始一個檔案下載時，請在下載發生期間所執行之呼叫的結果上，於 `state_changes` 中回報，並透過您指定的 `download_id` 在各結果之間關聯。下載是非同步執行的，可能跨越多個結果，因此有三種事件類型：

| `type` | 欄位 | 傳送時機 |
| ----- | ----- | ----- |
| `download_started` | `download_id`、`url` | 在下載開始期間所執行之呼叫的結果上。`url` 是經過重新導向後提供檔案的最終 URL。 |
| `download_completed` | `download_id`、`url`、`path?`、`size_bytes?` | 在下載完成時正在執行的後續呼叫的結果上。僅在同一環境中的其他工具（例如 [bash 工具](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/bash-tool)或 `file_upload`）能在該處讀取檔案時才包含 `path`；否則 `download_id` 是該下載唯一的識別碼。 |
| `download_failed` | `download_id`、`url`、`error?` | 當下載失敗或被取消時，若瀏覽器提供原因，請放在 `error` 中。 |

API 會依照項目出現的順序，將每個項目轉譯成一行提供給 Claude 的文字。它會將這些行加在結果的文字之後（以空白行分隔），並在任何 Tab Context 頁尾之前。每種成員結果都會帶有這些行，包括 `zoom` 和分頁管理結果。沒有 `text` 區塊的結果會以獨立的文字區塊取得這些行。每一行會提供 `download_id` 和 `url`，並在您有傳送時加上 `path` 和 `size_bytes`（針對 `download_completed`）或 `error`（針對 `download_failed`）。您不需要在自己的文字中描述下載。API 會以雙引號包住 `url`、`path` 和 `error`，並跳脫其中的雙引號和反斜線，因此請勿預先跳脫這些值。

例如，在 Pricing 分頁中點擊「Download price list (CSV)」（`ref_8`）會開始一個下載，因此該點擊的結果帶有一個 `download_started` 項目，其 `download_id` 為 `"dl-1"` 並包含檔案的 URL。下載在後續一個 `screenshot` 呼叫執行期間完成，因此該結果的 `content` 包含圖片、一個文字區塊（例如 `Screenshot captured.`），以及這個在相同 `download_id` 下回報完成的 `browser_state` 區塊：

```json
{
  "type": "browser_state",
  "tabs": [
    { "tab_id": "tab-1", "title": "Documentation", "url": "https://example.com/docs" },
    {
      "tab_id": "tab-2",
      "title": "Pricing",
      "url": "https://example.com/pricing",
      "active": true
    }
  ],
  "state_changes": [
    {
      "type": "download_completed",
      "download_id": "dl-1",
      "url": "https://example.com/pricing/price-list.csv",
      "path": "/home/user/downloads/price-list.csv",
      "size_bytes": 48213
    }
  ]
}
```

Claude 會收到 `Screenshot captured.`，後接一個空白行和類似以下的一行：

```text wrap
Download completed with download_id: dl-1, URL: "https://example.com/pricing/price-list.csv". Saved to "/home/user/downloads/price-list.csv". Size: 48213 bytes.
```

下載回報遵循以下規則：

* 在單一區塊中，每個 `download_id` 最多傳送一個項目，因此在同一個呼叫期間開始並完成的下載只會回報 `download_completed`。
* 絕不在 `is_error: true` 結果上傳送 `state_changes`；在失敗呼叫期間發生的下載事件，請在下一個成功結果上回報。
* `state_changes` 並非進行中下載的清單；每個事件只回報一次。
* 每個項目只帶有其 `type` 所宣告的欄位。`size_bytes` 是非負整數，`download_id` 不得為空，且 `download_id`、`url`、`path` 和 `error` 各自最多 4,096 個字元，不得包含控制字元或 Unicode 行分隔符或段落分隔符。`url` 來自遠端伺服器，經過重新導向後常帶有已簽署的查詢字串憑證，因此在回報它或將它用於檔案系統路徑之前，請移除您不希望出現在 Claude 上下文中的查詢參數並加以清理。

## 處理錯誤

將失敗的呼叫以一般錯誤結果回報給 Claude：`is_error: true`、說明問題所在的文字內容、回傳 `toolset_name`，且不含 `browser_state` 區塊。

### 從您的執行器回傳錯誤

請讓錯誤文字具體明確，因為 Claude 會讀取並據以調整：`Error: Navigation to https://example.com/status timed out after 30 seconds. The page may be unavailable.` 讓 Claude 有可以採取行動的依據，而單純的 `Error: navigation failed` 則無法做到。其他常見情況：

<AccordionGroup>
  <Accordion title="拒絕的導覽協定">
    ```json
    {
      "type": "tool_result",
      "tool_use_id": "toolu_01LeUTyqkhRxBFq1QTG3pkwN",
      "toolset_name": "browser",
      "is_error": true,
      "content": "Error: Navigation refused. Only http and https URLs are allowed."
    }
    ```
  </Accordion>

  <Accordion title="過時或未知的元素參照">
    ```json
    {
      "type": "tool_result",
      "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV",
      "toolset_name": "browser",
      "is_error": true,
      "content": "Error: ref_3 is stale or not found on the current page. Re-read the page to get fresh references."
    }
    ```
  </Accordion>

  <Accordion title="已停用或未實作的成員">
    ```json
    {
      "type": "tool_result",
      "tool_use_id": "toolu_013h2Q55HcNwVyapSpy2s5ZG",
      "toolset_name": "browser",
      "is_error": true,
      "content": "Error: javascript_exec is not enabled in this environment."
    }
    ```
  </Accordion>

  <Accordion title="因回合中較早的失敗而略過">
    當[批次動作](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-tool#batch-actions)中對 `ref_3` 的 `left_click` 因前面所示的過時參照錯誤而失敗時，其後的 `type` 和 `key` 呼叫各自會得到此結果：

    ```json
    {
      "type": "tool_result",
      "tool_use_id": "toolu_01FkP8rTz6uYh2mNq4LsXw7v",
      "toolset_name": "browser",
      "is_error": true,
      "content": "Not executed: an earlier action in this turn failed."
    }
    ```
  </Accordion>
</AccordionGroup>

### 請求錯誤

API 會驗證工具集項目以及對話中每個成員的 `tool_use` 和 `tool_result` 區塊。當其中之一格式錯誤時，API 會在 Claude 執行之前回傳 `invalid_request_error`。在下表中，左欄列出您所傳送的內容。

| 請求 | 失敗原因與處理方式 |
| ----- | ----- |
| 工具集項目不接受的選項或組合，例如：`name`、`strict: true`、`input_examples`、項目本身上的 `defer_loading`、不是成員名稱的 `configs` 鍵、成員 `configs` 值中除 `enabled` 或 `defer_loading` 以外的欄位（[設定工具集](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-tool#configure-the-toolset)）、已啟用成員的 `defer_loading` 值不一致（[設定工具集](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-tool#configure-the-toolset)）、未啟用任何成員的 `configs`、`allowed_callers` 中的程式碼執行呼叫者、請求上的 `fine-grained-tool-streaming-2025-05-14` beta 標頭、類型為 `tool` 且指名 `browser` 或某成員的 `tool_choice`，或第二個瀏覽器工具集項目或另一個名為 `browser` 的工具 | 用戶端工具集不支援這些項目。請參閱[用戶端工具集](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/tool-reference#client-toolsets)了解每條規則及其替代方案。 |
| 回應成員呼叫但未帶 `"toolset_name": "browser"` 或帶有不同值的 `tool_result`，或在非成員呼叫的結果上帶有 `toolset_name` | 在成員結果上，且僅在成員結果上，原樣回傳 `toolset_name`。 |
| 較早回合中沒有相符 `tool_result` 的成員 `tool_use` | 回應每個成員呼叫，包括因失敗而未執行的呼叫。 |
| 成員結果中除 `text`、`image` 或 `browser_state` 以外的內容區塊 | 成員結果只接受這三種區塊類型。 |
| 違反[使用 `browser_state` 追蹤分頁](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-tool#track-tabs-and-page-state)中規則的 `browser_state` 區塊，例如：位於 `is_error: true` 結果上或未回應瀏覽器成員呼叫的結果上、一個結果中有多個、非空的 `tabs` 卻沒有恰好一個 `active: true` 項目、重複的 `tab_id`、空的 `state_changes` 陣列、`tab_id` 不在 `tabs` 中的 `tab_opened`、同一 `download_id` 有兩個狀態變更，或其 `type` 未宣告的狀態變更欄位（[回報下載](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-tool#report-downloads)），或超出限制的欄位 | 修正該區塊。「沒有內容需要回報」應以省略區塊或 `state_changes` 欄位來表達，而絕非使用空值。 |
| 成功的 `new_tab`、`switch_tab`、`close_tab` 或 `list_tabs` 結果，其 `content` 不是恰好一個 `browser_state` 區塊，或 `new_tab` 結果沒有恰好一個與作用中分頁相符的 `tab_opened` | API 會從該區塊轉譯這些結果，並需要它具有確切的形式；請參閱[分頁管理結果](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-tool#tab-management-results)。 |
| 結果中的 `image` 超過您模型的[圖片大小限制](https://platform.claude.com/docs/zh-TW/build-with-claude/vision#evaluate-image-size)，或在請求包含[超過 20 張圖片](https://platform.claude.com/docs/zh-TW/build-with-claude/vision#request-limits)時超過更嚴格的單張圖片限制（計入較早結果中的截圖和 `zoom` 圖片） | API 不會縮小工具集圖片。請在回傳之前調整截圖大小（[調整截圖大小以符合圖片限制](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/computer-use-tool#handle-coordinate-scaling-for-higher-resolutions)）。 |
| 不支援 `browser_toolset_20260801` 的 `model` | 請參閱 [API 支援](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-tool#availability-feature-support)了解支援的模型。 |

## 限制

* **僅支援完整輸入串流：**&#x7576;您使用「streaming」（串流）時，每個成員的 `input` 會以一個完整的 `input_json_delta` 送達（[用戶端工具集](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/tool-reference#client-toolsets)）。
* **元素參照為盡力而為：**&#x9AD8;度動態的頁面（虛擬化清單、以 canvas 渲染的介面、捲動時會重新渲染的頁面）可能無法提供穩定的參照，Claude 在這些情況下會退而使用螢幕截圖和座標點擊。
* **`read_console` 和 `read_network` 取決於您的瀏覽器自動化：**&#x5B83;們只會回報瀏覽器自動化能夠擷取的內容，且僅限於其附加到分頁之後的時間點。
* **一般代理限制同樣適用：**「latency」（延遲）、視覺準確度以及「prompt injection」（提示注入）風險都會沿用自電腦使用（請參閱電腦使用工具的[限制](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/computer-use-tool#understand-computer-use-limitations)），而其在[透過提示最佳化模型效能](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/computer-use-tool#optimize-model-performance-with-prompting)、[管理螢幕截圖歷史記錄](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/computer-use-tool#manage-screenshot-history)以及[遵循實作最佳實務](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/computer-use-tool#follow-implementation-best-practices)（動作延遲、動作驗證和記錄）中的指引也同樣適用於瀏覽器執行器。

## 定價與資料保留

瀏覽器使用遵循標準的[工具使用定價](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/overview#pricing)。使用瀏覽器使用工具時：

**工具集定義開銷：** 宣告帶有預設成員的 `browser_toolset_20260801` 會為請求增加約 6,600 個輸入 token（在 Claude Sonnet 5 上約為 6,670 個，在其他支援的模型上約為 6,610 個），這涵蓋了成員工具定義以及工具使用系統提示。啟用全部四個選用成員會增加約 880 個 token，而使用 `configs` 停用成員則會減少此數量。請求的確切數量會在回應的 `usage` 中回報，您也可以使用 [token 計數端點](https://platform.claude.com/docs/zh-TW/build-with-claude/token-counting)預先估算。

**額外的 token 消耗：**

* 工具結果中回傳的螢幕截圖與縮放影像，以影像輸入計費（請參閱[視覺定價](https://platform.claude.com/docs/zh-TW/build-with-claude/vision#evaluate-image-size)）
* 回傳給 Claude 的文字工具結果，例如無障礙樹（accessibility tree）、頁面文字，以及主控台或網路項目

<Note>
  如果您在瀏覽器使用之外，同時使用電腦使用工具、bash 工具、文字編輯器工具或您自己的工具，這些工具各有其 token 成本，詳見各自的說明頁面。
</Note>

瀏覽器工作階段、下載和上傳的檔案都保留在您的環境中；您回傳的截圖、頁面文字和分頁狀態屬於您的 API 請求內容，並遵循標準保留政策，或您的 ZDR 協議（如果您有的話）。瀏覽器使用工具符合 ZDR 資格；請參閱 [API 與資料保留](https://platform.claude.com/docs/zh-TW/manage-claude/api-and-data-retention)了解各功能的保留期限和資格。

## 後續步驟

<CardGroup cols={2}>
  <Card title="使用 SDK 工具集進行瀏覽器與電腦使用" icon="code" href="https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-sdk">
    從合作夥伴的驅動程式開始，或以 Python 或 TypeScript 撰寫您自己的驅動程式。SDK 會執行迴圈以及您設定的檢查。
  </Card>

  <Card title="瀏覽器驅動程式範例" icon="github-logo" href="https://github.com/anthropics/claude-quickstarts/tree/main/browser-toolset">
    閱讀一個適用於 SDK 瀏覽器工具集的精簡 Python 與 TypeScript 驅動程式。它透過 Chrome DevTools Protocol 控制 Chromium，並非正式環境用的程式碼。
  </Card>

  <Card title="電腦使用工具" icon="computer" href="https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/computer-use-tool">
    當任務超出瀏覽器範圍時，讓 Claude 控制完整的桌面；其實作指引也適用於瀏覽器執行器。
  </Card>

  <Card title="處理工具呼叫" icon="wrench" href="https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/handle-tool-calls">
    格式化 `tool_result` 區塊、回傳圖片和錯誤，並繼續對話。
  </Card>

  <Card title="工具參考" icon="book" href="https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/tool-reference">
    瀏覽用戶端工具集以及其他所有 Anthropic 提供的工具，包括其版本和參數。
  </Card>
</CardGroup>

## 可用性

瀏覽器使用工具在特定模型上可供使用，且具備零資料保留資格。

### API 支援

#### [Messages API](https://platform.claude.com/docs/zh-TW/build-with-claude/working-with-messages)

* 可用性：可用

| 狀態 | 雲端平台 | 模型 |
| ----- | ----- | ----- |
| 可用 | Claude API, [Claude Models on Google Cloud (Google managed)](https://platform.claude.com/docs/zh-TW/build-with-claude/claude-models-on-google-cloud/google-managed) | [Claude Fable 5.2](https://platform.claude.com/docs/zh-TW/models/fable-5-2/overview), [Claude Mythos 5.2](https://platform.claude.com/docs/zh-TW/models/mythos-5-2/overview), [Claude Fable 5.1](https://platform.claude.com/docs/zh-TW/models/fable-5-1/overview), [Claude Mythos 5.1](https://platform.claude.com/docs/zh-TW/models/mythos-5-1/overview), [Claude Fable 5](https://platform.claude.com/docs/zh-TW/models/fable-5/overview), [Claude Mythos 5](https://platform.claude.com/docs/zh-TW/models/mythos-5/overview), Claude Mythos Preview, [Claude Opus 5.5](https://platform.claude.com/docs/zh-TW/models/opus-5-5/overview), [Claude Opus 5](https://platform.claude.com/docs/zh-TW/models/opus-5/overview), [Claude Sonnet 5.5](https://platform.claude.com/docs/zh-TW/models/sonnet-5-5/overview), [Claude Sonnet 5](https://platform.claude.com/docs/zh-TW/models/sonnet-5/overview), [Claude Haiku 5.5](https://platform.claude.com/docs/zh-TW/models/haiku-5-5/overview), [Claude Opus 4.8](https://platform.claude.com/docs/zh-TW/models/opus-4-8/overview) |
| 可用 | [Claude Models on Google Cloud (Anthropic managed)](https://platform.claude.com/docs/zh-TW/build-with-claude/claude-models-on-google-cloud/anthropic-managed) | [Claude Fable 5.2](https://platform.claude.com/docs/zh-TW/models/fable-5-2/overview), [Claude Mythos 5.2](https://platform.claude.com/docs/zh-TW/models/mythos-5-2/overview), [Claude Fable 5.1](https://platform.claude.com/docs/zh-TW/models/fable-5-1/overview), [Claude Mythos 5.1](https://platform.claude.com/docs/zh-TW/models/mythos-5-1/overview), [Claude Fable 5](https://platform.claude.com/docs/zh-TW/models/fable-5/overview), [Claude Mythos 5](https://platform.claude.com/docs/zh-TW/models/mythos-5/overview), [Claude Opus 5.5](https://platform.claude.com/docs/zh-TW/models/opus-5-5/overview), [Claude Opus 5](https://platform.claude.com/docs/zh-TW/models/opus-5/overview), [Claude Sonnet 5.5](https://platform.claude.com/docs/zh-TW/models/sonnet-5-5/overview), [Claude Sonnet 5](https://platform.claude.com/docs/zh-TW/models/sonnet-5/overview), [Claude Haiku 5.5](https://platform.claude.com/docs/zh-TW/models/haiku-5-5/overview), [Claude Opus 4.8](https://platform.claude.com/docs/zh-TW/models/opus-4-8/overview) |
| 可用 | [Claude Platform on AWS](https://platform.claude.com/docs/zh-TW/build-with-claude/claude-platform-on-aws), [Microsoft Foundry](https://platform.claude.com/docs/zh-TW/build-with-claude/claude-in-microsoft-foundry) | [Claude Fable 5.2](https://platform.claude.com/docs/zh-TW/models/fable-5-2/overview), [Claude Mythos 5.2](https://platform.claude.com/docs/zh-TW/models/mythos-5-2/overview), [Claude Fable 5.1](https://platform.claude.com/docs/zh-TW/models/fable-5-1/overview), [Claude Mythos 5.1](https://platform.claude.com/docs/zh-TW/models/mythos-5-1/overview), [Claude Fable 5](https://platform.claude.com/docs/zh-TW/models/fable-5/overview), [Claude Mythos 5](https://platform.claude.com/docs/zh-TW/models/mythos-5/overview), [Claude Opus 5.5](https://platform.claude.com/docs/zh-TW/models/opus-5-5/overview), [Claude Opus 5](https://platform.claude.com/docs/zh-TW/models/opus-5/overview), [Claude Sonnet 5.5](https://platform.claude.com/docs/zh-TW/models/sonnet-5-5/overview), [Claude Sonnet 5](https://platform.claude.com/docs/zh-TW/models/sonnet-5/overview), [Claude Haiku 5.5](https://platform.claude.com/docs/zh-TW/models/haiku-5-5/overview), [Claude Opus 4.8](https://platform.claude.com/docs/zh-TW/models/opus-4-8/overview) |
| 可用 | [Amazon Bedrock](https://platform.claude.com/docs/zh-TW/build-with-claude/claude-in-amazon-bedrock) | [Claude Fable 5.1](https://platform.claude.com/docs/zh-TW/models/fable-5-1/overview), [Claude Mythos 5.1](https://platform.claude.com/docs/zh-TW/models/mythos-5-1/overview), [Claude Fable 5](https://platform.claude.com/docs/zh-TW/models/fable-5/overview), [Claude Mythos 5](https://platform.claude.com/docs/zh-TW/models/mythos-5/overview), [Claude Opus 5.5](https://platform.claude.com/docs/zh-TW/models/opus-5-5/overview), [Claude Opus 5](https://platform.claude.com/docs/zh-TW/models/opus-5/overview), [Claude Sonnet 5.5](https://platform.claude.com/docs/zh-TW/models/sonnet-5-5/overview), [Claude Sonnet 5](https://platform.claude.com/docs/zh-TW/models/sonnet-5/overview), [Claude Haiku 5.5](https://platform.claude.com/docs/zh-TW/models/haiku-5-5/overview), [Claude Opus 4.8](https://platform.claude.com/docs/zh-TW/models/opus-4-8/overview) |
| 可用 | [Amazon Bedrock (bedrock-runtime)](https://platform.claude.com/docs/zh-TW/build-with-claude/claude-on-amazon-bedrock-legacy) | [Claude Fable 5.2](https://platform.claude.com/docs/zh-TW/models/fable-5-2/overview), [Claude Mythos 5.2](https://platform.claude.com/docs/zh-TW/models/mythos-5-2/overview), [Claude Fable 5.1](https://platform.claude.com/docs/zh-TW/models/fable-5-1/overview), [Claude Fable 5](https://platform.claude.com/docs/zh-TW/models/fable-5/overview), [Claude Opus 5.5](https://platform.claude.com/docs/zh-TW/models/opus-5-5/overview), [Claude Opus 5](https://platform.claude.com/docs/zh-TW/models/opus-5/overview), [Claude Sonnet 5.5](https://platform.claude.com/docs/zh-TW/models/sonnet-5-5/overview), [Claude Sonnet 5](https://platform.claude.com/docs/zh-TW/models/sonnet-5/overview), [Claude Haiku 5.5](https://platform.claude.com/docs/zh-TW/models/haiku-5-5/overview), [Claude Opus 4.8](https://platform.claude.com/docs/zh-TW/models/opus-4-8/overview) |

#### [Managed Agents](https://platform.claude.com/docs/zh-TW/managed-agents/overview)

* 可用性：不可用

### 資料處理

[資料處理概覽](https://platform.claude.com/docs/zh-TW/manage-claude/api-and-data-retention#feature-eligibility)

| 項目 | 零資料保留 | HIPAA |
| ----- | ----- | ----- |
| 狀態 | 符合資格（不含 [涵蓋的模型](https://platform.claude.com/docs/zh-TW/manage-claude/api-and-data-retention#model-specific-data-retention-requirements)） | 不符合資格 |
| 詳細資訊 | 用戶端工具。除標準 API 處理外，Anthropic 不會執行瀏覽器動作或保留頁面內容。 [深入了解](https://platform.claude.com/docs/zh-TW/agents-and-tools/tool-use/browser-use-tool#data-retention) | 不在 HIPAA 就緒範圍內；包含瀏覽器使用工具的請求不會被封鎖。 |

適用端點：

* `/v1/messages` 搭配 `browser` 工具集
