AAAEC Resources返回官网
AAAEC Resources

7. 验证与监控

10 模块知识库第 7 篇——讲 agent 完成任务后如何被验证和监督:Test / Trace / Log / Monitoring / Eval / Audit 6 大验证机制,以及生产环境的可观测性建设。


本文覆盖 3 层 verification gate + 评估方法:

  • 3 层 verification gate unit test / LLM-as-judge / harness 评分,各自覆盖什么
  • LLM-as-judge 评估 prompt 设计 + 偏差控制 + 与人工评估的偏差校准
  • Benchmark 4 维度 能力 / 速度 / 成本 / 鲁棒性,选 benchmark 的判断
  • Reward Hacking 警告 3 个常见 hack 模式 + 怎么在 prompt / eval 里堵住

选型快查 (TL;DR)

场景推荐机制代表 agent
CI 自动 review / fixCI must pass gate + Stop hookDevin / Claude Code + GitHub Actions
生产 agent 监控Audit Trail + Anomaly DetectionAgentforce / Devin / Claude Code
主观输出评估(写作 / 创意)Human-in-the-loop evalDevin custom eval / WorkBuddy
客观输出评估(代码 / 数学)自动化 test + benchDevin SWE-bench / Claude Code eval
业务 case 评估Custom eval set(50 真实题)Qwen-Agent 1M RAG / Claude Code custom
防 reward hackingHold-out test + 工具白名单Stage 7 reward-hacking 防御

1. 这是什么 + 为什么重要

验证与监控回答 agent 系统的"体检"问题:怎么知道它干得好不好? agent 不同于传统软件 —— 输出有概率、决策路径非确定、错误模式更隐蔽(LLM "看起来正常但答案错")。传统 pass/fail 单测不够用,需要专门机制:

  • Test(单元 / 集成 / 批量 / 回归):单步 tool 调用 + 多步链路 + 一组用例 + 旧功能没坏
  • Trace(全链路 / span 级别):每步"做什么 → 调哪个 tool → 输入输出 → 耗时"
  • Log(audit log):不可变操作日志(谁、何时、做了什么)
  • Monitoring(延时 / token / cost):实时指标,防"成本失控"
  • Eval(benchmark / score):标准化题库打分,衡量版本间差异
  • Audit trail / Compliance reporting:满足 SOC 2 / HIPAA / ISO 27001 / EU AI Act

为什么重要:模块 7 是 demo 走向生产的"最后一公里"。三个最常见生产事故都是验证缺失 —— 幻觉(自信地答错)、成本失控(死循环调 tool)、合规失败(无 audit log 被罚款)。Anthropic 工程博客:"If you can't observe it, you can't improve it."。来源:https://www.anthropic.com/engineering/claude-code-best-practices ✅。


2. 子模块分解

2.1 Test(单元 / 集成 / 批量 / 回归)

是什么:agent 系统的测试比传统软件更复杂 —— 同一 prompt 两次跑答案可能不同。Test 因此分四层:单元(单 tool 调用)、集成(多步 task 端到端)、批量(一组用例通过率)、回归(旧功能没坏)。

5 种 grader 模式(行业事实标准):

模式描述代表
Code-basedPython function 返回 pass/fail,确定性OpenAI / Anthropic evals exact_match
Model-based(LLM-as-judge)用 GPT-5.5 / Claude 评判 fuzzy 输出OpenAI model-based / Agentforce AI Evaluations
HumanUI 手动打分,适合主观判断OpenAI human / Devin custom eval
Heuristicregex / string match / similarityOpenAI heuristic
Multi-turn autorater评估整段多轮对话逻辑一致性Antigravity 企业版

来源:OpenAI https://platform.openai.com/docs/guides/graders ✅ + Anthropic https://github.com/anthropics/evals ✅ + Google Cloud https://cloud.google.com/blog/products/ai-machine-learning/introducing-gemini-enterprise-agent-platform ✅。

跨 agent 差异表

AgentTest 工具官方 doc
Claude CodeStop hook deterministic gate(exit code 2 block)+ eval SDK(exact_match / fuzzy_match / tool_sequence / end_to_end)+ /code-reviewhttps://github.com/anthropics/evals + https://code.claude.com/docs/en/hooks
DevinCI must pass gate(覆盖最全,跑全套 lint + scanner + test + CI)+ Held-out test split(train/eval/test)+ PR max iteration limit 防死循环https://www.devin.ai/security
ChatGPT AgentDatasets / Eval Suite + 4 类 Grader + Automated Prompt Optimization(A/B)+ Trace Gradinghttps://platform.openai.com/docs/guides/agent-evals
Qwen-AgentDeepPlanning Benchmark + 隐式验证(LLM 反思 + 工具错误重试)https://qwenlm.github.io/Qwen-Agent/en/benchmarks/deepplanning/
AntigravityWalkthrough Report(截图+录屏证据)+ Check Point 可回滚 + ADK evaluate(criteria + user/environment simulation)+ Custom Metricshttps://blog.google/products/gemini/gemini-3/ + https://google.github.io/adk-docs/evaluate/
AgentforceReal-time + Batch Testing(Atlas 360)+ reusable test cases 自动从真实交互生成https://www.salesforce.com/agentforce/agent-builder/
SierraAI-driven 大规模测试 Simulations + Voice Sims(语音场景)+ Regression Testinghttps://sierra.ai/product/agent-studio
Cursor 2TDD 工作流(写测试 → 失败 → 实现 → 全绿)+ Bugbot(GitHub PR 自动 review)https://cursor.com/blog/agent-best-practices
Copilot StudioCustom Graders(自然语言评判)+ Evaluate agents(测试集自动评分)+ Revert versions(版本回滚)https://learn.microsoft.com/en-us/microsoft-copilot-studio/authoring-evaluate + https://www.microsoft.com/en-us/microsoft-365-copilot/blog/custom-graders-copilot-studio/
ManusVerify Agent(对抗性测试,找其他 AI 问题)+ Replay 链接(任务录像 100% 透明)https://manus.im/docs/introduction/welcome.md
Coze 3节点级 IF-ELSE + 循环重试 + 测试对话 + 节点监控 + 版本回滚https://www.coze.cn/open/docs/guides/workflow
WorkBuddy执行监控器(异常处理)+ 自动重试 + Checkpoints 回退 + 多 Agent 中 test-agent 角色https://workbuddy.tencent.com/
AutoGPTagbenchmark(代码生成 / 工具使用 / 推理 / 长期记忆 / 多步骤规划 5 大类)+ Self-Reflection + 断点续执行(PostgreSQL)https://github.com/Significant-Gravitas/AutoGPT
Trae SoloPlan 模式人工 review + DiffView 变更追踪 + SOLO 自动调试Accio Work
Validator 验证层(每步结果校验)+ 重试 / Fallback

2.2 Trace(全链路 / span 级别)

是什么:trace 是 agent 的"黑匣子",记录每步"做什么 → 调哪个 tool → 输入输出 → 耗时"。Span-level 把"调 tool"再拆为"输入解析 → MCP 调用 → 响应解析"多个 span 独立计时。

跨 agent 差异表

AgentTrace 能力官方 doc
Claude CodeBashOutput / Stop hook + JSONL session + OpenTelemetry 导出(claude_code.session.count / claude_code.tool.usage / claude_code.cost.usd)https://code.claude.com/docs/en/monitoring-usage
ChatGPT AgentInteraction tracing + Trace Grading(逐步评分)+ AgentKit UIhttps://platform.openai.com/docs/guides/agent-evals
Qwen-Agent应用观测全链路(阿里云百炼应用观测)+ 延时/Tokenhttps://www.aliyun.com/sswb/1762906.html
AntigravityWalkthrough Report + ADK Observability 三件套(Logging 结构化日志 + Metrics 自定义指标 + Traces 分布式链路)+ Mission Control(多 Agent 进度)https://google.github.io/adk-docs/observability/
AgentforceInteraction Tracing(span-level 全链路) + Spark query-driven observability(4 亿条记录 / 800GB,debug 从 2 周 → 当天)https://www.salesforce.com/agentforce/agent-builder/ + https://engineering.salesforce.com/reducing-agentforce-ai-debugging-from-two-weeks-to-same-day-with-query-driven-observability/
SierraObservability(tracing every tool call / decision / latency)+ Auditing(reasoning + knowledge sources)https://sierra.ai/
Copilot StudioActivity map(实时可视化决策路径,显示每步 tool/topic/knowledge 选定原因)+ Trigger activity log + Conversation Transcript(CSV 完整回放)https://learn.microsoft.com/en-us/microsoft-copilot-studio/authoring-triggers-events + https://learn.microsoft.com/en-us/power-virtual-agents/analytics-sessions
DevinInteractive Browser trace(每步截图/操作)+ session transcript(export SIEM)https://www.devin.ai/security
ManusReplay 链接(每个任务公开 replay URL,金融/合规/团队审计)https://manus.im/docs/features/wide-research.md
Coze 3节点监控(每个节点的运行时间 / 输入 / 输出)https://www.coze.cn/open/docs/guides/workflow
Cursor 2Composer trace + DiffViewhttps://cursor.com/blog/enterprise
WorkBuddy执行监控器(实时异常处理)Trae Solo
DiffView + 控制台报错主动监控AutoGPTTask / Step / Artifact 三层状态机
Accio Work实时监控(任务进度条)
最佳实践:ADK Observability 三件套(Logging + Metrics + Traces)是行业事实标准 —— 结构化日志用于排查,自定义指标(token 消耗/任务耗时)用于告警,分布式链路追踪定位多 Agent 协作瓶颈。来源:https://google.github.io/adk-docs/observability/ ✅。

常见坑:Copilot Studio Activity.Text 变量不总含上一条消息,要用 LastMessage.Text。来源:Microsoft Learn ✅。


2.3 Log(audit log)

是什么:audit log 是"不可变操作日记",记录"谁、何时、做了什么"。与 trace 区别:trace 给开发者调试(可能丢弃),audit log 给合规审计(必须长期保存)。

跨 agent 差异表

AgentAudit log 关键特性官方 doc
Claude Codesession transcript JSONL + Audit hooks(InstructionsLoaded / ConfigChange / SubagentStart / SubagentStop)+ SIEM exporthttps://code.claude.com/docs/en/security
DevinAudit-ready transcript format(Export Splunk / Datadog / Elastic)+ 每 commit/comment/merge 关联 session IDhttps://www.devin.ai/security
ChatGPT AgentAudit + Self-Critique(PII 屏蔽 / Jailbreak detection / Content moderation / Hallucination check)https://platform.openai.com/docs/guides/agents/guardrails-approvals
WorkBuddy审计事件 9 大类型细粒度(user.login / knowledge.upload / knowledge.delete / knowledge.query / permission.grant 等)+ 企业管理后台
https://engineering.salesforce.com/architecting-ai-agent-auditing-systems-in-agentforce/Cursor 2Audit Log(企业版 19 种事件类型)(access / asset edits / config updates,CSV 导出)
https://cursor.com/blog/enterpriseCopilot StudioMicrosoft Purview 审计(tenant-wide + DLP 违规 + 租户健康状态)+ Trigger activity log + Power Platform audit
https://learn.microsoft.com/en-us/microsoft-copilot-studio/authoring-triggers-eventsQwen-Agent企业版审计日志
SierraAuditing(reasoning + knowledge sources + systems accessed)https://sierra.ai/product/insights
ManusAudit logs(企业级 compliance + audit trail)https://manus.im/team
Coze 3HiAgent 高级审计日志(高级专业版 99 元/月)https://www.coze.cn/open
Trae SoloSOLO 自我修复日志AutoGPT
基于 PostgreSQL 持久化的三层状态机Accio Work操作历史(进度条)
最佳实践:审计日志必须含数据保护层(PII 屏蔽 + 加密 + 访问控制),满足 GDPR/HIPAA/SOC 2 通用要求。Anthropic 提供 Data Residency 选项(HIPAA 客户强制 US-only inference)。来源:https://platform.claude.com/docs/en/build-with-claude/data-residency ✅。

2.4 Monitoring(延时 / token / cost)

是什么:实时监控关键运行指标。这是"成本失控"事故的防火墙 —— agent 一旦死循环调 tool,token 与成本会爆炸。

跨 agent 差异表

AgentMonitoring 关键能力官方 doc
Claude CodeOpenTelemetry 3 指标(session.count / tool.usage / cost.usd)+ per-session 实时成本https://code.claude.com/docs/en/monitoring-usage
ChatGPT AgentToken monitoring + per-agent consumptionhttps://platform.openai.com/docs/guides/agents
WorkBuddy企业管理后台(权限/成本/治理/用量统计)
Qwen-Agent延时、Token 量指标(阿里云百炼应用观测)https://www.aliyun.com/sswb/1762906.html
AntigravityContext Caching(降低 latency+cost)+ Mission Control + ADK Metricshttps://blog.google/products/gemini/gemini-3/
AgentforceFlex Credits 监控 + 端到端推理性能(元数据延迟 400ms → 1ms,降幅 27%)+ Mock LLM Service(省 50 万美元/年) + 每分钟 24000 次请求测试https://engineering.salesforce.com/how-salesforce-delivers-reliable-low-latency-ai-inference/ + https://engineering.salesforce.com/how-a-mock-llm-service-cut-500k-in-ai-benchmarking-costs/
Copilot StudioPer-agent consumption tracking(tenant 不汇总,每个 agent 可查,适合成本归因)+ Real-time Voice Quality Monitoring + Upgraded Analytics(2 分钟刷新,原 24 小时)https://learn.microsoft.com/en-us/microsoft-copilot-studio/admin-licensing
SierraSession metric(每 session 独立监控)https://sierra.ai/
Devinsession transcript + SIEMhttps://www.devin.ai/security
Cursor 2Upgraded Analytics(2 分钟刷新)https://cursor.com/blog/enterprise
Coze 3节点监控 + 用量统计Trae Solo
控制台报错主动监控AutoGPT基于 PostgreSQL 持久化状态
Accio Work实时监控(任务进度条)
ManusReplay + session metrichttps://manus.im/team

最佳实践:分级缓存降低延迟(Agentforce 通过多层 L1+L2 缓存,数据库故障时仍维持 65% 服务可用性,端到端延迟降 27%);Context Caching 行业首创(Google 内置到 Gemini API)。来源:Salesforce + Google 工程博客 ✅。

常见坑:无 max iteration limit 时,死循环会致单 session 数千美元成本。Devin 提供 PR max iteration,Claude Code Stop hook 8 次 block 强制结束。


2.5 Eval(benchmark / score)

是什么:用标准化题库衡量 agent 整体能力。Eval 输出分数,可在不同版本/不同 agent 间横向比较。与 test 区别:test 评估"特定行为对不对",eval 评估"整体能力"。

跨 agent 差异表

AgentEval 工具官方 doc
Claude CodeAnthropic eval SDK(SWE-bench Verified SOTA)+ Held-out test set + A/B testing tool descriptionshttps://github.com/anthropics/evals
DevinSWE-bench eval(GitHub issue → diff → pytest 验证,45 min time limit)+ Custom eval(企业用 golden dataset + grade + fine-tune)https://cognition.com/blog/swe-bench + https://www.devin.ai/enterprise
ChatGPT AgentDatasets / Eval Suite + 4 类 Grader + Automated Prompt Optimization(A/B)+ External models eval(对比 Claude / Gemini)https://platform.openai.com/docs/guides/agent-evals + https://platform.openai.com/docs/guides/external-models
Qwen-AgentDeepPlanning Benchmark(任务规划能力)https://qwenlm.github.io/Qwen-Agent/en/benchmarks/deepplanning/
AntigravityAgent Evaluation 多轮 autorater(整段对话评分,不是单条)+ Custom Metrics + Optimizationhttps://cloud.google.com/blog/products/ai-machine-learning/introducing-gemini-enterprise-agent-platform + https://google.github.io/adk-docs/optimize/
AgentforceReal-time + Batch Testing + AI-powered Evaluations(生产数据:83% 自动解决率,weekly 32,000 interactions,human 从 10,000 → 5,000)https://www.salesforce.com/agentforce/
SierraExperiments(多元测试 A/B/n)+ Ghostwriter(自动分析真实交互 + 找出改进点 + 验证)https://sierra.ai/product/agent-studio
AutoGPTagbenchmark(代码生成 / 工具使用 / 推理 / 长期记忆 / 多步骤规划)https://github.com/Significant-Gravitas/AutoGPT
Copilot StudioCustom Grader framework(2026-03,自然语言评判标准 + 测试用例)+ Frontier Tuning(2026-06,组织级 AI 调优)https://www.microsoft.com/en-us/microsoft-365-copilot/blog/custom-graders-copilot-studio/
Cursor 2Bugbot(GitHub PR 自动 review)+ Agent Reviewhttps://cursor.com/pricing
ManusVerify Agent(对抗性测试)WorkBuddy
多 Agent 中 test-agent 角色Trae SoloPlan review + SOLO 自动调试
Accio WorkValidator 验证层
最佳实践:生产数据生成 eval set(Agentforce 与 Sierra 都用真实交互生成 reusable test cases,避免"eval 集与生产场景脱节");多轮 autorater 比单轮更准(Antigravity 评估整段对话逻辑,避免漏掉中间推理错误)。

常见坑:单条响应评判忽略多轮逻辑;eval 集污染(train 与 eval 混用,分数虚高)。


2.6 Audit trail / Compliance reporting

是什么:面向监管的整套体系(含 retention policy、access control、regulatory reporting)。与 audit log 区别:audit log 是单一日志条目,audit trail 是满足 SOC 2/HIPAA/ISO 27001/EU AI Act 等法规的完整体系。

跨 agent 差异表

AgentCompliance reporting官方 doc
Claude CodeCompliance logging + Data residency(HIPAA 需 BAA + US-only inference,1.1x 价;Free 30 天/Pro 90 天/Enterprise 自定义)https://platform.claude.com/docs/en/build-with-claude/data-residency
DevinSOC 2 Type 2 + FedRAMP / DoD IL4 / ITAR-ready(Cognition for Government)+ Export Splunk / Datadog / Elastichttps://www.devin.ai/security + https://cognition.com/blog/cognition-for-government
WorkBuddy国内首批通过信通院 Claw 可信评估(V4.10.0,5 大检验项目、57 个能力项)
Qwen-AgentISO 42001 / 27001 合规Antigravity
Access Transparency(访问透明日志)+ Third-party Safety Audits(Apollo / Vaultis / Dreadnode)+ Frontier Safety Framework 第二代(CBRN/cyber-offense mitigation)+ HIPAA + FedRAMP Highhttps://cloud.google.com/gemini-enterprise + https://blog.google/products/gemini/gemini-3/Agentforce
Audit Trail + Real-time + Batch Testing(SOC 2/HIPAA/GDPR 全套)+ Einstein Trust Layerhttps://www.salesforce.com/agentforce/Copilot Studio
Microsoft Purview + Power Platform Admin Center + Microsoft Agent 365(2026-05 GA,统一控制平面,扩展 Entra ID/Defender/Purview/Intune)+ Sensitivity labels 传播https://learn.microsoft.com/en-us/microsoft-agent-365Coze 3
火山引擎智能体安全管理平台(TC260 国家标准合规,国内首个"资产盘点—漏洞和风险评估—加固与持续防护")https://new.qq.com/rain/a/20251105AManus
Enterprise-grade compliance + audit trailhttps://manus.im/teamSierra
Auditing(reasoning + knowledge sources + systems accessed)https://sierra.ai/product/insightsCursor 2
Audit Log + trust.cursor.com SOC 2 Type II attestationhttps://cursor.com/securityAutoGPT
自托管(合规可控)Trae Solo主动监控 + 自我修复
Accio Work实时监控(进度条)
最佳实践:第三方安全审计(Gemini 3 引入 Apollo/Vaultis/Dreadnode 独立审查,与英国 AISI 合作,model card 公开);Agent Identity + 加密 ID(Google 企业版每个 agent 唯一加密 ID);Anomaly Detection(Agentforce 用 statistical models + LLM-as-judge 标记异常推理)。

常见坑:HIPAA 客户必须 US-only inference(Anthropic 强制,价格上浮 1.1x);EU AI Act 风险分级,Accio Work 等小厂合规覆盖度不足。


3. 横向对比总表(15 agent × 6 子模块)

✅ = 支持;❌ = 不支持;⚠️ = 部分支持 / 信息源不足

AgentTestTraceLogMonitoringEvalAudit trail
Claude Code✅ Stop hook + SDK✅ BashOutput + OTel✅ Audit hooks + SIEM✅ OTel 3 指标✅ evals SDK✅ Compliance logging
Devin✅ CI must pass✅ Browser trace✅ Audit-ready transcript✅ session + SIEM✅ SWE-bench + Custom✅ SOC 2 + FedRAMP
ChatGPT Agent✅ Eval Suite + 4 Graders✅ Interaction tracing✅ Self-Critique✅ Token monitoring✅ Eval Suite + APO✅ Audit
WorkBuddy✅ 监控 + test-agent⚠️✅ 9 审计事件✅ 企业后台⚠️✅ 信通院 Claw
Qwen-Agent✅ DeepPlanning✅ 应用观测✅ 企业版日志✅ 延时+Token✅ DeepPlanning✅ ISO 42001
Antigravity✅ Walkthrough + Check Point✅ ADK Observability✅ Agent Identity✅ Mission Control✅ Agent Eval✅ 第三方审计
Agentforce✅ Real-time + Batch✅ Span Tracing✅ Kafka 2000 万/月✅ Flex Credits✅ AI Eval(83%)✅ SOC 2 + HIPAA
Sierra✅ Sim + Voice Sims✅ Observability✅ Auditing✅ Session metric✅ AI Eval✅ Auditing
Manus✅ Verify + Replay✅ Cloud trace✅ Audit logs⚠️⚠️✅ Enterprise
Cursor 2✅ TDD + Bugbot✅ Composer trace✅ Audit 19 类✅ Analytics 2min⚠️✅ SOC 2 Type II
Copilot Studio✅ Custom Graders✅ Activity map✅ Purview✅ Per-agent✅ Evaluate✅ Agent 365
Coze 3✅ IF-ELSE + 节点监控✅ 节点监控✅ HiAgent 审计✅ 节点监控⚠️✅ TC260 备案
Trae Solo⚠️ Plan + DiffView⚠️⚠️⚠️⚠️⚠️
AutoGPT✅ agbenchmark✅ Task/Step/Artifact⚠️⚠️✅ agbenchmark⚠️ 自托管
Accio Work⚠️ Validator⚠️ 进度条⚠️⚠️⚠️ Validator⚠️

4. 选型建议

场景首选理由
个人开发者 IDE 工作流Claude Code / Cursor 2Stop hook + Bugbot + eval SDK 完整,无外部依赖
企业编码 agent + 多 AgentDevinCI must pass gate + Held-out test split + Audit Trail 覆盖最全
客服 / 对话 agent 大规模Agentforce / Copilot StudioSpan Tracing + Flex Credits + SOC 2/HIPAA/GDPR 全套
自主任务 agent(类 AutoGPT)ManusVerify Agent + Replay 链接 100% 透明 + 企业级 audit
国产合规(信通院 / TC260)WorkBuddy / Coze 3信通院 Claw 57 项 + TC260 国家标准备案
成本敏感型监控AgentforceFlex Credits + Mock LLM Service 省 50 万美元/年案例
深度技术任务(科学 / 长 horizon)AntigravityADK Observability + Walkthrough Report(截图/录屏)+ Deep Think
多模态交互验证Copilot StudioActivity Map + Voice Quality Monitoring + Microsoft Agent 365
小团队轻量级Coze 3节点 IF-ELSE + 测试对话 + HiAgent 审计(99 元/月)

On this page