跳到主要内容Skip to main content

Agent 评估怎么做How to Evaluate Agents

微型指南 · 约 8 分钟Guide · about 8 min · 引用核验 2026-11-03(仅引用链接与日期) · refs checked 2026-11-03 (reference links and dates only)

Agent 的成败不只在最终答案:工具选对没、参数对不对、走了多少步、花了多少钱,都要进评测。Agent success is not only the final answer: whether tools were chosen correctly, arguments were right, how many steps it took and what it cost all belong in the eval.

怎么做How to

先定义任务成功条件:不是「回答像样」,而是「目标完成 + 工具调用正确 + 没有越权」。

记录完整轨迹:消息、工具调用、参数、返回值、步数、耗时与 token;没有轨迹就无法归因。

分开评四件事:最终答案、工具选择、参数正确性、过程效率(步数与成本)。

多次运行时分别记录成功率与失败类型;pass@k 表示多次尝试中至少一次成功,不能用它代替每次都可靠。需要衡量重复可靠性时,应明确“全部 k 次成功”的统计口径。

按每次调用分别计算输入、输出和工具费用,再对全部步骤与重试求和;不要将已经汇总的 Token 再乘步数。

建回归集:把线上失败案例收进固定题集,每次换模型/改提示词后重跑。

Define task success first: not "a plausible answer" but "goal achieved + correct tool calls + no overreach".

Record the full trajectory: messages, tool calls, arguments, return values, steps, latency and tokens; without it you cannot attribute failure.

Score four things separately: final answer, tool choice, argument correctness and process efficiency (steps and cost).

Across repeated runs, record success rate and failure types. pass@k concerns at least one success, not success every time. For repeatability, explicitly report an all-k-success metric.

Calculate input, output and tool charges for each call, then sum steps and retries. Do not multiply already aggregated tokens by the step count again.

Build a regression set: put production failures into a fixed question set and rerun after every model or prompt change.

例子与判断Example and interpretation

以下是教学情境,不是本站运行或实测记录。A teaching scenario, not a measured or executed site test.

同一练习任务运行五次,只成功一次,说明它有过成功机会,不代表每次都可靠。记录每次是否完成、失败步骤和成本;区分“多次里至少一次成功”与“多次全部成功”的指标。An agent succeeding once in five attempts has demonstrated a success, not repeatable reliability. Record completion, failing step and cost for every run. Distinguish at-least-one-success from all-attempts-success metrics.

出处Sources
  • OpenAI Evals 官方指南OpenAI Working with Evals ↗
  • LangSmith · Evaluation 文档LangSmith Evaluation ↗
  • AgentBench 论文(arXiv 2308.03688)AgentBench: Evaluating LLMs as Agents ↗
  • τ-bench 论文(重复可靠性指标,2026-11-04 核对)τ-bench paper (repeatability metrics, checked 2026-11-04) ↗