Week 15 • Day 6Week 15
Day 6:Evaluating Agents — Trajectory Metrics, Tool Selection F1 & Step Efficiency
Battle-tested daily lesson note • 100% runnable code, interview Q&A, test suite & interactive quiz
Day 6: Evaluating Agents — Trajectory Metrics, Tool Selection F1 & Step Efficiency
1. First-Principles Agent Evaluation: Why Final-Answer Grading Is Not Enough
An agent can arrive at the right final text answer by luck (e.g., guessing that a service is healthy after calling the wrong tool or passing the wrong namespace) or via an inefficient 12-step detour when 2 steps were optimal.
Therefore, production agent evaluation grades the Execution Trajectory against a reference Golden Trajectory :
- Tool Selection Precision, Recall & :
- Argument Exact Match Rate: Fraction of expected
(tool, args)calls where all required arguments match the golden specification. - Trajectory Optimality Ratio (Step Efficiency):
If requires
2steps and the agent takes5steps, .
In Simple English: Grading the Whole Path, Not Just the Final Answer (Trajectory Metrics)
Suppose two agents both correctly tell a user "Payments service is fixed":
- Agent A called
[check_pod_logs, restart_worker](2 steps, 100% optimal!). - Agent B panicked, called
[list_all_buckets, delete_temp, check_pod_logs, grep_wrong_file, restart_worker](5 steps, 3 useless tools!). Trajectory Evaluation grades HOW the agent arrived: - Tool Precision & Recall (): Did it pick the right tools without noisy wrong calls?
- Step Efficiency (): Agent A took $2/2 = \mathbf{100%} efficient; Agent B took \2/5 = \mathbf{40%}$ efficient!