• 建構
  • 管理
  • 模型與定價
  • 客戶端 SDK
  • API 參考
Search...
⌘K
Log in
工具組合
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

Solutions

  • AI agents
  • Code modernization
  • Coding
  • Customer support
  • Education
  • Financial services
  • Government
  • Life sciences

Partners

  • Amazon Bedrock
  • Google Cloud's Vertex AI

Learn

  • Blog
  • Courses
  • Use cases
  • Connectors
  • Customer stories
  • Engineering at Anthropic
  • Events
  • Powered by Claude
  • Service partners
  • Startups program

Company

  • Anthropic
  • Careers
  • Economic Futures
  • Research
  • News
  • Responsible Scaling Policy
  • Security and compliance
  • Transparency

Learn

  • Blog
  • Courses
  • Use cases
  • Connectors
  • Customer stories
  • Engineering at Anthropic
  • Events
  • Powered by Claude
  • Service partners
  • Startups program

Help and security

  • Availability
  • Status
  • Support
  • Discord

Terms and policies

  • Privacy policy
  • Responsible disclosure policy
  • Terms of service: Commercial
  • Terms of service: Consumer
  • Usage policy
建構/工具基礎架構

工具組合

Anthropic 提供的常見工具配對,適用於研究代理、編碼代理和長期運行代理。

Anthropic 提供的工具設計用於協同工作。常見的代理模式將涵蓋工作流程互補階段的工具配對在一起:一個工具用於收集或發現,另一個工具用於處理或執行。下面的組合是起點,而不是規定。根據您的任務混合搭配它們。

每個代碼片段只顯示 tools 陣列。有關完整的請求形狀,請參閱處理工具呼叫。

研究代理:web_search + code_execution

搜尋查找來源;代碼執行分析和綜合。Claude 搜尋數據,然後編寫 Python 來處理、製表或視覺化數據。此配對適合需要最新信息和對該信息進行非平凡計算的問題,例如「比較前五大雲提供商本季度的收益」。

{
  "tools": [
    { "type": "web_search_20260209", "name": "web_search" },
    { "type": "code_execution_20250825", "name": "code_execution" }
  ]
}

流程通常是搜尋,然後執行,如果第一次通過發現了差距,則可選擇再次搜尋。代碼執行在伺服器端運行,因此沒有客戶端沙箱需要管理。

編碼代理:text_editor + bash

文本編輯器讀取和修改文件;bash 運行測試和構建命令。這是規範的軟體開發循環:檢查代碼、進行編輯、運行測試、重複。兩個工具都是客戶端執行的,因此您的應用程式控制哪些文件和命令可訪問。

{
  "tools": [
    { "type": "text_editor_20250728", "name": "str_replace_based_edit_tool" },
    { "type": "bash_20250124", "name": "bash" }
  ]
}

如果代理在不受信任的代碼上運行,請將其與受限的工作目錄和命令允許清單配對。有關執行契約,請參閱文本編輯器工具和 Bash 工具。

引用後獲取:web_search + web_fetch

搜尋顯示候選 URL;獲取檢索相關 URL 的完整頁面內容。這避免了預先獲取所有內容。Claude 運行搜尋,檢查片段,選擇看起來實際相關的兩三個結果,並僅獲取那些結果。

{
  "tools": [
    { "type": "web_search_20260209", "name": "web_search" },
    { "type": "web_fetch_20260209", "name": "web_fetch" }
  ]
}

當答案位於長篇內容(文檔頁面、文章、規範)中時,此配對很有用,搜尋片段無法完全捕獲。獲取會拉取完整頁面,以便 Claude 可以引用特定段落。

長期運行代理:memory + 任何工具集

記憶在對話中保持狀態;其他工具執行工作。將記憶添加到任何需要記住先前會話的代理,例如回憶客戶早期問題的支援代理或追蹤上週做出的決定的項目助手。

{
  "tools": [{ "type": "memory_20250818", "name": "memory" }]
}

在同一陣列中將您的其他工具與 memory 一起添加。

記憶與您的其餘工具集正交。它不會改變其他工具的行為方式;它為 Claude 提供了一個地方來記錄和稍後檢索事實,否則這些事實在上下文窗口重置時會丟失。有關存儲模型,請參閱記憶工具。

一體化:computer_use

計算機使用工具通過操作完整桌面來包含大多數其他工具。Claude 看到螢幕截圖並發出滑鼠和鍵盤操作,這意味著它可以驅動人類可以驅動的任何應用程式。當任務需要更具體的工具無法達到的任意 GUI 交互時,請使用此工具:沒有 API 的舊版軟體、視覺驗證步驟或跨越多個桌面應用程式的工作流程。

{
  "tools": [
    {
      "type": "computer_20250124",
      "name": "computer",
      "display_width_px": 1280,
      "display_height_px": 800
    }
  ]
}

計算機使用是最通用的選項,也是最慢的,因為每個操作都需要螢幕截圖往返。當更狹隘的工具涵蓋您的用例時,優先選擇它們,當沒有其他選項適合時,使用計算機使用。有關沙箱設置,請參閱計算機使用工具。

後續步驟

工具參考

Anthropic 提供的工具的完整目錄,包括類型字符串和參數。

工具使用概述

工具使用的工作原理以及何時使用 Anthropic 工具與定義您自己的工具。

Was this page helpful?

  • 研究代理:web_search + code_execution
  • 編碼代理:text_editor + bash
  • 引用後獲取:web_search + web_fetch
  • 長期運行代理:memory + 任何工具集
  • 一體化:computer_use