智慧體標註
在 Potato 中評估 AI 智慧體,配備 15 種 trace 格式轉換器、5 種顯示類型,以及面向工具使用、網頁瀏覽、編碼和聊天智慧體的預置方案。包含 PRM 與評分量表評估。
v2.3.0 新增
How agentic annotation works
AI 智慧體越來越多地被部署用於複雜的多步驟任務:瀏覽網頁、編寫程式碼、呼叫 API 和編排子智慧體。但評估智慧體是否真正做對了需要人類在傳統標註工具無法支援的細粒度上進行判斷。單個智慧體 trace 可能包含數十個步驟、工具呼叫、中間推理、截圖和分支決策。標註人員需要看到所有這些上下文,高效地瀏覽它們,並在 trace 級別和單個步驟級別提供結構化評估。
Potato 的智慧體標註系統通過四項能力來解決這個問題:
- 15 種 trace 格式轉換器,將來自任何主流框架的智慧體日誌標準化為統一格式
- 5 種專用顯示類型,分別為不同的智慧體模態(工具使用、網頁瀏覽、編碼、聊天、即時觀察)最佳化
- 9 個預置標註方案,覆蓋最常見的智慧體評估維度
- 4 種專門構建的標註類型,用於高階評估:軌跡評估、評分量表評估、成對比較和過程獎勵標註
Trace 格式轉換器
智慧體 trace 的格式因框架不同而差異很大。Potato 提供 15 種轉換器,將這些格式標準化為統一的內部表示。你在配置中指定轉換器,或讓 Potato 自動檢測格式。
轉換器參考
| 轉換器 | 源格式 | 提取的關鍵欄位 |
|---|---|---|
openai | OpenAI Assistants API / function calling logs | messages、tool_calls、function results |
anthropic | Anthropic Claude tool_use / Messages API | content blocks、tool_use、tool_result |
swebench | SWE-bench task traces | patch、test results、trajectory |
swe_agent_trajectory | SWE-Agent 軌跡檔案 | thought、action、observation、exit_status |
aider | Aider 結對程式設計對話歷史 | 輪次、編輯塊、被編輯的檔案路徑 |
otel | OpenTelemetry span exports (JSON) | spans、attributes、events、parent-child |
mcp | Model Context Protocol sessions | tool definitions、call/response pairs |
multi_agent | CrewAI / AutoGen / LangGraph multi-agent logs | agent roles、delegation、message passing |
langchain | LangChain callback traces | chain runs、LLM calls、tool invocations |
langfuse | LangFuse observation exports | generations、spans、scores |
react | ReAct-style Thought/Action/Observation logs | thought、action、action_input、observation |
webarena | WebArena / VisualWebArena trace JSON | actions、screenshots、DOM snapshots、URLs |
atif | Agent Trace Interchange Format (ATIF) | steps、observations、metadata |
web_agent | Web 智慧體的瀏覽軌跡(Mind2Web、Computer Use、原始錄製) | actions、coordinates、viewport、screenshots |
claude_code | Claude Code 及其他編碼智慧體的會話日誌 | tool_use 塊、差異、終端輸出 |
配置
在項目配置中指定轉換器:
agentic:
enabled: true
trace_converter: react
trace_file: "data/agent_traces.jsonl"trace 檔案中的每一行應該是一個包含原始智慧體 trace 的 JSON 物件。轉換器會處理其餘部分。
對於不同智慧體使用不同框架的多智慧體 trace,你可以指定每個智慧體的轉換器:
agentic:
enabled: true
trace_converter: multi_agent
trace_file: "data/multi_agent_traces.jsonl"
multi_agent:
agent_converters:
planner: react
coder: anthropic
reviewer: openai自動檢測
如果不確定使用哪個轉換器,設定 trace_converter: auto:
agentic:
enabled: true
trace_converter: auto
trace_file: "data/traces.jsonl"Potato 會檢查前 10 個 trace,根據欄位簽名選擇最匹配的轉換器。如果置信度低於 80%,會記錄警告日誌,此時你應該顯式指定轉換器。
自定義轉換器
如果你的智慧體框架不在列表中,可以編寫 Python 轉換器:
# converters/my_converter.py
from potato.agentic.base_converter import BaseTraceConverter
class MyConverter(BaseTraceConverter):
name = "my_framework"
def convert(self, raw_trace: dict) -> dict:
steps = []
for entry in raw_trace["log"]:
steps.append({
"type": entry.get("kind", "action"),
"content": entry["text"],
"timestamp": entry.get("ts"),
"metadata": entry.get("extra", {}),
})
return {"steps": steps}在配置中註冊:
agentic:
trace_converter: custom
custom_converter: "converters/my_converter.py:MyConverter"顯示類型
trace 轉換完成後,Potato 使用五種專用顯示類型之一進行渲染。每種都針對不同的智慧體模態進行了最佳化。
1. Agent Trace 顯示
使用工具的智慧體(OpenAI 函式呼叫、Anthropic tool_use、ReAct、LangChain 等)的預設顯示。它將每個步驟渲染為按步驟類型顏色編碼的卡片。
agentic:
enabled: true
trace_converter: openai
display_type: agent_trace
agent_trace_display:
# Color coding for step types
colors:
thought: "#6E56CF"
action: "#3b82f6"
observation: "#22c55e"
error: "#ef4444"
system: "#6b7280"
# Collapsible sections
collapse_observations: true
collapse_threshold: 500 # characters before auto-collapsing
# Step numbering
show_step_numbers: true
show_timestamps: true
# Tool call rendering
render_json: true # pretty-print JSON arguments
syntax_highlight: true # highlight code in observations功能特性:
- 步驟卡片 帶有顏色左邊框指示類型(thought、action、observation、error)
- 可摺疊部分 用於長觀測結果或工具輸出(可配置閾值)
- JSON 格式化顯示 用於工具呼叫參數和結構化響應
- 語法高亮 用於觀測結果中的程式碼塊
- 步驟時間線 側邊欄,一覽顯示完整 trace
- 跳轉到步驟 導航功能,適用於長 trace
2. Web Agent Trace 顯示
專為網頁瀏覽智慧體(WebArena、VisualWebArena、原始瀏覽器錄製)構建。渲染截圖並配有 SVG 覆蓋層,顯示智慧體點選、輸入或滾動的位置。
agentic:
enabled: true
trace_converter: webarena
display_type: web_agent
web_agent_display:
# Screenshot rendering
screenshot_max_width: 900
screenshot_quality: 85
# SVG overlay for agent actions
overlay:
enabled: true
click_marker: "circle" # circle, crosshair, or arrow
click_color: "#ef4444"
click_radius: 20
type_highlight: "#3b82f6" # highlight for text input fields
scroll_indicator: true
# Filmstrip view
filmstrip:
enabled: true
thumbnail_width: 150
show_action_labels: true
# DOM snapshot display
show_dom_snapshot: false # optional raw DOM view
show_url_bar: true
show_action_description: true功能特性:
- 截圖畫廊 支援全尺寸檢視和縮放
- SVG 覆蓋層 顯示點選目標(紅色圓圈)、文本輸入區域(藍色高亮)和滾動方向
- 膠片條檢視 在底部顯示所有截圖縮圖,用於快速導航
- 操作描述 文本顯示在每個截圖下方(例如,"點選 'Add to Cart' 按鈕")
- URL 欄 顯示每個步驟的當前頁面 URL
- 前後對比 用於修改頁面內容的步驟
3. 互動式聊天顯示
用於評估對話智慧體和聊天機器人。支援兩種子模式:即時聊天 模式下標註人員與智慧體即時互動,以及 trace 回顧 模式下標註人員評估已錄製的對話。
agentic:
enabled: true
display_type: interactive_chat
interactive_chat_display:
mode: trace_review # or "live_chat"
# Trace review settings
trace_review:
show_system_prompt: false
show_token_counts: true
show_latency: true
message_grouping: turn # "turn" or "message"
# Live chat settings (when mode: live_chat)
live_chat:
proxy: openai # agent proxy to use
max_turns: 20
timeout_seconds: 60
show_typing_indicator: true
allow_regenerate: true
# Common settings
show_role_labels: true
role_colors:
user: "#3b82f6"
assistant: "#6E56CF"
system: "#6b7280"
tool: "#22c55e"Trace 回顧模式 渲染已錄製的對話,可選顯示每條訊息的 token 計數和延遲。標註人員可以評價單個回合或整個對話。
即時聊天模式 通過智慧體代理系統(見下文)將標註人員連線到執行中的智慧體。標註人員與智慧體對話,然後標註產生的對話。
4. 編碼 Trace 顯示
專為編碼智慧體會話(Claude Code、Aider、SWE-Agent)構建。渲染帶語法高亮的程式碼 diff、深色塊中的終端輸出,以及帶行號的檔案讀取。
agentic:
enabled: true
trace_converter: claude_code
display_type: coding_trace
coding_trace_display:
diff_style: unified # unified or split
terminal_theme: dark
show_file_tree: true
collapse_long_output: true
collapse_threshold: 50 # lines
show_line_numbers: true
syntax_highlight: true功能特性:
- 統一 diff 檢視 用紅/綠高亮顯示編輯操作
- 深色終端塊 用於 bash/shell 命令輸出
- 帶行號的程式碼塊 用於檔案讀取操作
- 檔案樹側邊欄 顯示會話期間觸及的所有檔案
- 可摺疊長輸出 用於冗長的終端或檔案內容
完整參考請見編碼智慧體標註。
5. 即時智慧體顯示
對 AI 智慧體進行即時觀察,並提供人工干預的控制元件。支援網頁瀏覽智慧體和編碼智慧體。
agentic:
enabled: true
display_type: live_agent功能特性:
- 即時流式傳輸 通過 Server-Sent Events 傳輸智慧體動作
- 暫停/恢復 在步驟之間暫停或恢復智慧體
- 傳送指令 在任務進行中重定向智慧體
- 接管 手動控制
- 回滾 到任何先前的檢查點(編碼智慧體使用基於 git 的檢查點)
- 分支與重放 從任何檢查點用不同指令重新執行
高階標註類型
除了逐回合評分和預置方案外,Potato 還包含四種專門構建的標註類型,用於結構化的智慧體評估。
軌跡評估 (trajectory_eval)
帶分層錯誤分類體系和嚴重程度評分的逐步錯誤定位。每個步驟都會得到一個正確性評分、錯誤類型、嚴重程度等級和可選理由。一個連續評分計數器會根據嚴重程度遞減。
annotation_schemes:
- annotation_type: trajectory_eval
name: step_eval
error_types:
reasoning:
- logical_error
- incorrect_assumption
action:
- wrong_tool
- wrong_arguments
- premature_termination完整指南請見軌跡評估部落格文章。
評分量表評估 (rubric_eval)
MT-Bench 風格的多準則網格評估。定義自定義準則和評分量表。標註人員獨立地對每個準則評分。
annotation_schemes:
- annotation_type: rubric_eval
name: agent_rubric
criteria:
- name: correctness
description: "Did the agent produce the correct result?"
- name: efficiency
description: "Did the agent take an efficient path?"
- name: safety
description: "Did the agent avoid unsafe actions?"
scale_points: 5
scale_labels:
1: "Very Poor"
3: "Acceptable"
5: "Excellent"設定說明請見評分量表評估教程。
成對比較
並排比較兩個智慧體 trace,提供三種模式:
- 二元:點選選擇 A 或 B(可選平局)
- 量表:從"A 好得多"到"B 好得多"的滑塊
- 多維度:每個維度獨立的 A/B/平局,並要求填寫理由
annotation_schemes:
- annotation_type: pairwise
name: agent_comparison
mode: multi_dimension
allow_tie: true三種模式的說明請見成對比較指南。
過程獎勵標註
逐步二元正確性標註,針對訓練過程獎勵模型進行了最佳化。兩種模式:首個錯誤(點選第一個錯誤步驟,其餘自動標記)和逐步(獨立評估每個步驟)。
annotation_schemes:
- annotation_type: process_reward
name: prm
mode: first_error # or per_step完整參考請見過程獎勵標註。
逐回合評分
對於對話和多步驟評估,你通常需要對單個回合進行評分,而不僅僅是(或除了)對整體 trace 評分。Potato 支援任何顯示類型的逐回合標註。
annotation_schemes:
# Overall trace rating
- annotation_type: likert
name: overall_quality
description: "Rate the overall quality of this agent trace"
labels:
1: "Very Poor"
5: "Excellent"
# Per-turn ratings
- annotation_type: trajectory_eval
name: step_correctness
description: "Was this step correct?"
steps_key: agentic_steps # binds to trace steps
correctness_options:
- "Correct"
- "Partially Correct"
- "Incorrect"
- "Unnecessary"
- annotation_type: trajectory_eval
name: step_explanation
description: "Explain any issues with this step"
steps_key: agentic_steps逐回合評分內聯顯示在每個步驟卡片旁邊。conditional 塊讓你僅在選擇了特定評分時顯示後續問題,保持介面整潔。
逐回合輸出格式
逐回合標註以步驟索引儲存:
{
"id": "trace_042",
"annotations": {
"overall_quality": 3,
"step_correctness": {
"0": "Correct",
"1": "Correct",
"2": "Incorrect",
"3": "Correct"
},
"step_explanation": {
"2": "The agent searched for the wrong product name"
}
}
}智慧體代理系統
對於標註人員與智慧體即時互動的線上評估任務,Potato 提供智慧體代理層。代理位於標註介面和智慧體後端之間,記錄完整對話以供後續審查。
agentic:
enabled: true
display_type: interactive_chat
agent_proxy:
type: openai # openai, http, or echo
# OpenAI proxy
openai:
model: "gpt-4o"
api_key: ${OPENAI_API_KEY}
system_prompt: "You are a helpful customer service agent."
temperature: 0.7
max_tokens: 1024代理類型
OpenAI 代理 將訊息轉發到 OpenAI 相容的 API:
agent_proxy:
type: openai
openai:
model: "gpt-4o"
api_key: ${OPENAI_API_KEY}
system_prompt: "You are a helpful assistant."
temperature: 0.7HTTP 代理 將訊息轉發到任何 HTTP 端點(你自己的智慧體伺服器):
agent_proxy:
type: http
http:
url: "https://my-agent.example.com/chat"
method: POST
headers:
Authorization: "Bearer ${AGENT_API_KEY}"
request_template:
messages: "{{messages}}"
session_id: "{{session_id}}"
response_path: "response.content"
timeout_seconds: 30Echo 代理 將使用者的訊息回顯(用於測試和 UI 開發):
agent_proxy:
type: echo
echo:
prefix: "[Echo] "
delay_ms: 500預置標註方案
Potato 提供 9 個專為智慧體評估設計的標註方案。可直接使用或作為自定義方案的起點。
| 方案 | 類型 | 描述 |
|---|---|---|
agent_task_success | radio | 二元成功/失敗,帶部分成功選項 |
agent_step_correctness | per_turn_rating (radio) | 逐步正確/不正確/不必要評分 |
agent_error_taxonomy | per_turn_rating (multiselect) | 12 類錯誤分類(錯誤工具、幻覺、迴圈等) |
agent_safety | radio + text | 安全違規檢測,帶嚴重程度等級 |
agent_efficiency | likert | 評估智慧體是否使用了高效路徑 |
agent_instruction_following | likert | 評估對原始使用者指令的遵循程度 |
agent_explanation_quality | likert | 評估智慧體推理/解釋的品質 |
agent_web_action_correctness | per_turn_rating (radio) | 逐步網頁操作評估(正確目標、正確操作類型) |
agent_conversation_quality | multirate | 多維度聊天品質(有用性、準確性、語氣、安全性) |
按名稱載入預置方案:
annotation_schemes:
- preset: agent_task_success
- preset: agent_step_correctness
- preset: agent_error_taxonomy或將預置方案與自定義方案組合:
annotation_schemes:
- preset: agent_task_success
- preset: agent_step_correctness
# Custom schema alongside presets
- annotation_type: text
name: evaluator_notes
description: "Any additional observations about this agent trace"
label_requirement:
required: false完整示例:評估 ReAct 智慧體
以下是評估 ReAct 風格智慧體 trace 並帶逐步評分的完整配置:
# project config
task_name: "ReAct Agent Evaluation"
task_dir: "."
data_files:
- "data/react_traces.jsonl"
item_properties:
id_key: trace_id
text_key: task_description
agentic:
enabled: true
trace_converter: react
display_type: agent_trace
agent_trace_display:
colors:
thought: "#6E56CF"
action: "#3b82f6"
observation: "#22c55e"
error: "#ef4444"
collapse_observations: true
collapse_threshold: 300
show_step_numbers: true
render_json: true
annotation_schemes:
- preset: agent_task_success
- preset: agent_step_correctness
- preset: agent_efficiency
- annotation_type: text
name: failure_reason
description: "If the agent failed, describe what went wrong"
label_requirement:
required: false
output_annotation_dir: "output/"
output_annotation_format: "jsonl"示例輸入資料 (data/react_traces.jsonl):
{
"trace_id": "react_001",
"task_description": "Find the population of Tokyo and compare it to New York City",
"trace": [
{"type": "thought", "content": "I need to find the population of both cities. Let me search for Tokyo first."},
{"type": "action", "content": "search", "action_input": "Tokyo population 2024"},
{"type": "observation", "content": "Tokyo has a population of approximately 13.96 million in the city proper..."},
{"type": "thought", "content": "Now I need to find New York City's population."},
{"type": "action", "content": "search", "action_input": "New York City population 2024"},
{"type": "observation", "content": "New York City has a population of approximately 8.34 million..."},
{"type": "thought", "content": "Tokyo (13.96M) has about 67% more people than NYC (8.34M)."},
{"type": "action", "content": "finish", "action_input": "Tokyo has ~13.96 million people vs NYC's ~8.34 million, making Tokyo about 67% larger by population."}
]
}啟動伺服器:
potato start config.yaml -p 8000延伸閱讀
- 編碼智慧體標註 —— 面向編碼智慧體的 diff 渲染、終端輸出和檔案樹
- 過程獎勵標註 —— 帶首個錯誤和逐步模式的 PRM 訓練資料
- 程式碼評審標註 —— GitHub PR 風格的內聯評論和判定
- 即時編碼智慧體 —— 帶回滾和分支的即時編碼智慧體觀察
- 即時智慧體評估 —— 即時網頁智慧體觀察
- 網頁智慧體標註 —— 審查預先錄製的網頁智慧體 trace
- 評估 AI 智慧體:完整指南 —— 完整智慧體評估項目的演練
- 匯出格式 —— 匯出智慧體評估資料
有關實現詳情,請參閱源文件。