Agent Trace Viewer

Agent Trace Viewer 是可视化查看 Agent 执行过程的工具,展示每次 LLM 调用、工具执行、状态转换的详细信息。它是调试 Agent 的核心工具。

#type / concept #status / evergreen #tech / ai #tech / ops

[!info] related notes

Agent Trace Viewer

一句话定义

Agent Trace Viewer 是可视化查看 Agent 执行过程的工具。Agent 出了问题,需要看”为什么做出这个决策”——Trace Viewer 展示完整的执行链路。

核心原理

Trace 可视化

Agent Run (run_001) - 5.8s - 3850 tokens
├── Step 1: LLM Call (2.3s - 1200 in / 50 out)
│   Input: system_prompt + user_message
│   Output: tool_call(search_knowledge)

├── Step 2: Tool Execution (0.45s)
│   Tool: search_knowledge
│   Args: {"query": "膝关节康复"}
│   Result: 3 chunks found

├── Step 3: LLM Call (3.1s - 1800 in / 80 out)
│   Input: + tool_result
│   Output: tool_call(create_chart)

└── Step 4: Tool Execution (1.2s)
    Tool: create_chart
    Result: chart created

平台工具

平台特点
LangSmithLangChain 生态,功能全面
Langfuse开源,可自部署
Helicone专注 LLM 监控

常见坑

  1. 不做 Trace: 出问题无法复现
  2. Trace 数据太大: 完整记录占用大量存储
  3. 不做采样: 生产环境全量记录影响性能

参考资料

创建于 2026/6/30 更新于 2026/7/15