技術指南

特務腳手架和安全帶

代理工具或支架是圍繞語言模型的程式碼,將其轉變為代理:它運行呼叫模型、執行其請求的工具、回饋結果以及決定何時停止的循環。

聆聽此指南AI 語音敘述 · ~3 min

本頁閱讀時間3分鐘
  1. 概述
  2. 深入探討
  3. 現實世界的實施
  4. 特務腳手架和安全帶的未來
  5. 付諸實踐
  6. 不斷探索
  7. 常見問題

概述

這很重要,因為工具對結果有很大影響,因此同一模型在同一基準上的得分可能會非常不同,具體取決於其工具、上下文和錯誤處理的設計方式。

深入探討

A language model on its own produces text. An agent needs a program that repeatedly asks the model what to do, performs the action, and shows the model what happened. That program is the harness. Its core parts are the loop, tool definitions, tool dispatch, context management, stopping rules and error handling. The loop sends the conversation so far to the model. If the model requests a tool, the harness validates the arguments, runs the tool, and appends the result. If the model gives a final answer, the loop ends. Stopping rules add limits: a maximum number of steps, a token or cost budget, a timeout, or a check such as tests passing. Tool design has large effects. The SWE-agent project from Princeton researchers, published in 2024, argued that agents need an agent-computer interface designed for models, with concise file viewers, search commands and immediate feedback on bad edits, and showed this improved results over giving the model a plain shell. Output formatting matters too: truncating huge outputs, summarising errors clearly and returning structured results help the model act correctly. Context management decides what the model sees as the history grows: keeping recent steps, summarising older ones, or storing notes in files. Error handling decides whether a failed tool call crashes the run or is returned to the model as information it can react to. This is why benchmark numbers need context. On coding benchmarks such as SWE-bench, reported scores for one model vary across scaffolds, retry policies and step limits. A common misconception is that a leaderboard number measures the model alone; it measures the model plus harness plus settings. Products such as command-line coding agents are, in large part, carefully engineered harnesses around a model.

現實世界的實施

編碼代理工具為模型提供了查看文件、編輯特定行範圍和運行測試的工具,然後循環直到測試通過或達到步驟限制。

研究助理工具在 20 次工具呼叫後停止循環,並要求模型提供來源摘要,以防止成本失控。

一個團隊用文件編輯器替換了原始 shell 工具,該編輯器顯示一小段行視窗並立即報告語法錯誤,並且他們的代理在內部任務上的成功率在不更改模型的情況下得到了提高。

客戶營運代理工具會攔截任何超過設定金額的退款工具調用,並在執行前暫停以供人工批准。

特務腳手架和安全帶的未來

模型提供者越來越多地提供自己的代理產品和軟體開發工具包,這些工具標準化了一些工具模式,例如工具模式、權限和上下文壓縮。用於將工具連接到模型的協定(例如模型上下文協定)使工具整合更具可重用性。線束設計可能仍然是性能差異的一個有意義的來源,而評估正朝著與模型一起報告支架的方向發展。對於建構者來說,無論下面的模型是什麼,仔細的工具設計、明確的停止規則和良好的日誌記錄都將始終很重要。

付諸實踐

為什麼這很重要

  • 成本與預算. 多年來,架構決策決定著效能和營運成本。
  • 更明確的決策. 技術教育幫助團隊選擇正確的堆疊,而不僅僅是最新的堆疊。
  • 品質管控. 更好的工程選擇可以減少生產中的可靠性事故。

留意

  • 優化一項基準測試可以隱藏更廣泛的系統弱點。
  • 基礎設施和維護成本常常被低估。
  • 隨著系統變得更加複雜,安全性和可觀察性差距可能會擴大。

後續步驟

  1. 在實施之前定義延遲、品質和成本目標。
  2. 在實際負載和資料條件下進行基準測試。
  3. 儀器監控錯誤、漂移和使用者影響。
  4. 在擴展之前準備回滾和事件回應路徑。

不斷探索

免費電子報

獲取每日 AI 簡報

每個工作日上午提供三則經過驗證的 AI 新聞,以淺顯易懂的英文撰寫。永久免費,無廣告。

每個工作日一封電子郵件。一鍵取消訂閱。我們絕不出售或分享您的地址。

測試一下自己

參加特務腳手架和安全帶測驗

每個答案皆有即時回饋,通過課程後可獲得具備可驗證 ID 的可分享證書。

開始測驗

支持免費的 AI 教育。AI Understanding 是一個 501(c)(3) 非營利組織——絕無廣告,絕無付費牆。 捐款

常見問題

什麼是特務腳手架和安全帶?

代理工具或支架是圍繞語言模型的程式碼,將其轉變為代理:它運行呼叫模型、執行其請求的工具、回饋結果以及決定何時停止的循環。這很重要,因為工具對結果有很大影響,因此同一模型在同一基準上的得分可能會非常不同,具體取決於其工具、上下文和錯誤處理的設計方式。

什麼是代理程式的 harness?

該工具是將文本生成模型轉變為代理的外圍程序。

以下哪一項是停止規則的例子?

停止規則會根據步數、預算、逾時或成功檢查等限制結束循環。

SWE-agent 專案強調了什麼?

SWE-agent 認為,為模型設計的工具比普通 shell 能改善結果。

為什麼同一個模型在不同報告中的 SWE-bench 分數會不同?

基準分數衡量整個系統,而不僅僅是模型。

harness 通常應如何處理失敗的工具呼叫?

傳回可操作的錯誤可以讓模型修正其方法,而不是結束運行。