Agent Trace Schema 模板
| 字段 |
值 |
| 版本 |
v1.0 |
| 最后更新 |
2026-07 |
| 使用时机 |
Agent 轨迹采集与评测设计时 |
| 填写角色 |
平台工程师+评测工程师 |
| 下游消费者 |
归因分析团队、Agent 开发者 |
适用场景
用于记录 Agent 执行过程,支撑过程评分、成本分析、归因和复现。
字段说明
| 字段 |
说明 |
| trace_id |
轨迹标识 |
| case_id |
关联评测样本 |
| goal |
任务目标 |
| steps |
执行步骤 |
| state_before / state_after |
步骤前后状态 |
| action |
动作 |
| observation |
工具或环境返回 |
| cost / latency |
成本与延迟 |
| final_state |
终态 |
模板
trace_id:
case_id:
goal:
initial_state:
steps:
- step_id:
state_before:
action_type:
action_name:
action_input:
observation:
state_after:
expected_behavior:
deviation:
cost:
input_tokens:
output_tokens:
tool_cost:
latency_ms:
error:
final_state:
score:
task_success:
process_safety:
tool_accuracy:
state_consistency:
cost_acceptability:
填写示例
trace_id: trace_refund_001
case_id: eval_refund_member_partial_001
goal: 判断会员部分退款对优惠券和积分的影响
initial_state:
identity_verified: true
refund_type: partial
steps:
- step_id: 1
state_before:
refund_type: partial
action_type: tool
action_name: refund_rule_calc
action_input:
order_id: O123
item_id: I456
refund_type: partial
observation:
points_adjustment: requires_recalculation
state_after:
refund_rule_checked: true
expected_behavior: 正确调用退款规则工具
deviation: none
cost:
input_tokens: 1200
output_tokens: 300
tool_cost: 1
latency_ms: 850
final_state:
answer_based_on_tool: true
score:
task_success: pass
process_safety: pass
tool_accuracy: pass
state_consistency: pass
cost_acceptability: pass
常见误区
| 误区 |
修正方式 |
| 只记录最终回答 |
记录步骤、状态、工具和观察 |
| Trace 过于自由文本 |
使用结构化字段 |
| 不记录成本 |
每步记录 token、工具和延迟 |
| 终态成功就忽略过程风险 |
同时评分任务成功和过程安全 |