Choosing evaluation criteria for agents
Pick the check that can actually see the failure you care about. Predict what exact, in-order and any-order trajectory matching accept, use model-judged criteria only where there is no single right answer, and run evaluation in CI and in production.
Chapter 5Evaluate and deployLesson 4 of 5ShowHide
Chapter 5 of 7 in Google Cloud Professional Agentic Architect
- Choosing evaluation criteria for agentsYou're here
Prerequisites: Building evaluation datasets for agents
The check decides what you can see
The last lesson built a golden dataset: cases with expected trajectories and expected replies. This lesson's refund path adds a policy check between the lookup and the refund. Now you choose how to score those cases. This choice matters more than it looks. Each criterion can see some failures and is blind to others, and an eval that passes because it measured the wrong thing is worse than no eval at all, because people trust it.
So start every choice with one question: what must be true, and which check can actually see it?
Three ways to match a trajectory
ADK's tool_trajectory_avg_score compares the tool calls the agent made with the
expected ones, turn by turn. By default, a call matches only when its name
and its arguments are equal (the criterion's ignore_args option compares
names only). Then one of three decides whether the turn passes:
- EXACT (the default): the same calls in the same order, with nothing extra and nothing missing.
- IN_ORDER: every expected call appears in order, and extra calls may appear between them.
- ANY_ORDER: every expected call appears, in any order, and extra calls are allowed.
Each turn scores 1.0 or 0.0, and the case's score is the average across its turns. Try the modes on a refund agent whose expected path is look up the order, check the policy, then refund:
Five things stand out:
- An extra, harmless lookup fails EXACT but passes IN_ORDER and ANY_ORDER. EXACT is strict enough to flag every deviation, including the ones you do not care about.
- A harmless swap of the two lookups fails IN_ORDER as well as EXACT. Only ANY_ORDER passes a reorder, harmless or not.
- Refund first passes ANY_ORDER. If the order of two calls is the point, as "check the policy before you refund" is, ANY_ORDER cannot see the failure.
- A wrong argument (a $600 refund instead of $60) fails every mode, because that call no longer matches the expected one.
- An extra refund after the expected calls passes IN_ORDER and ANY_ORDER. Both modes allow extra calls whatever those calls do, so an extra $600 refund passes, and so does a refund before the check that is followed by the full expected sequence. IN_ORDER checks that the expected calls appear in order, not that every refund follows a policy check.
So choose the loosest mode that still fails the runs you care about: EXACT for a fixed, side-effecting sequence; IN_ORDER when order matters but extra read-only calls are fine; ANY_ORDER when only the presence of each call matters. For a rule about every call of a tool, such as "every refund follows a policy check", add a separate deterministic check over all the calls in the run, or use EXACT with the full expected sequence.
An agent refunds once, before it checks the policy, though both calls are expected in the opposite order. Which mode still passes it?
Deterministic or model-judged
ADK's criteria fall into two families.
| Deterministic | Model-judged | |
|---|---|---|
| Examples | tool_trajectory_avg_score, response_match_score (ROUGE-1 word overlap) | final_response_match_v2 (does the reply mean the same as the reference), rubric-based criteria, hallucinations_v1, safety_v1 |
| How it scores | Compares with a reference by fixed rules | An LLM judge rates the output (most of ADK's judged criteria sample the judge several times and take a majority vote) |
| Strength | Exact and repeatable: the same run always gets the same score | Handles answers with no single right form: meaning, tone, groundedness |
| Weakness | Brittle where many answers are right | A model's opinion: can be wrong, costs model calls, needs a judge model |
The rule follows: if there is one right answer you can write down, check it deterministically. Which tools ran, in what order and with what arguments is recorded in the trajectory, so a trajectory match checks it exactly. Use a model judge for qualities where there is no single right answer: whether a reply means the same as the reference, whether it is empathetic, whether its claims are supported by the tool results.
Some things neither family can see. The trajectory records tool names and
arguments, and a judge reads only what it is given, so neither tells you under
whose identity a call ran. If policy says a tool must run as the agent's own
identity, assert that from where the call was authorised and executed: the tool's
audit logs or the trace. For example, the evalset passes, but the trace shows
update_payroll ran as a shared service account rather than the agent's own
identity, so the identity assertion fails. A later lesson covers agent identity
itself.
Which requirement is a model-judged criterion the right tool for?
ADK eval, the Gen AI evaluation service or a custom metric
Three tools cover most needs:
- ADK evaluation (
adk eval,pytest, the web UI) runs your evalsets locally or in CI, with the built-in criteria above. It is where trajectory matching and response matching live, and it is the natural CI gate. - The is
the managed evaluation in Gemini Enterprise Agent Platform, Google Cloud's
platform for building and running models and agents. It offers
rubric-based, computation-based and custom function metrics, and Google
describes adaptive rubrics, generated for each prompt. ADK's
safety_v1criterion calls it to score. Reach for it when you want managed quality metrics at scale rather than rubrics you write and maintain yourself. - A custom metric is your own function. In ADK, a custom metric is a Python function that receives the agent's invocations (and the expected ones) and returns a score. Use one for a check only your domain defines, such as "the refund amount never exceeds the order total".
ADK also reports four efficiency criteria on every run: tool_call_count_v1,
inference_call_count_v1 (model calls), token_usage_v1 and
invocation_duration_v1. They are always on and informational: they never pass
or fail a case, and ADK rejects a threshold on them. Compare them between runs;
a jump in tool calls or tokens for the same cases is an early sign of a loop or
a bloated context.
They combine. A typical setup runs ADK evaluation in CI with trajectory and response checks, a few custom metrics for business rules, and managed rubric metrics for reply quality.
Continuous evaluation
Evaluation is not a one-off before launch. It runs before release and after it, and failures flow from production back into the evalset.
Step one change around the loop. Before a failure turns up in production, predict where it goes next.
- The CI gate runs the evalset on every change: a new prompt, a model version, a tool. Reference-based checks (trajectory and response match) and judged checks both run here, and a regression fails the build before users see it.
- A scheduled run repeats the evalset on a schedule, for example daily or weekly, even when nothing was committed. The documents an agent retrieves, the APIs behind its tools and the users' wording all change without a commit, and a falling score on an unchanged agent is how that drift shows up.
- Online monitoring scores a sample of live traces after release. Live traffic has no expected trajectory or reply, so it uses reference-free checks (rubrics, groundedness, safety) alongside latency, cost and error rates.
- The loop closes when a failure found online becomes a new case in the evalset, so the CI gate tests every later change against it.
Why do online monitors use reference-free checks?
Recap
- By default, a call matches only with the same name and arguments. EXACT allows nothing extra, IN_ORDER allows extra calls between, and ANY_ORDER also ignores order. Choose the loosest mode that still fails the runs you care about.
- Check what has one right answer (which tools, what order, what arguments) deterministically; use model judges for meaning, tone and groundedness.
- Neither a trajectory match nor a judge sees the identity behind a call; assert it from logs or traces.
- Run reference-based checks in a CI gate and reference-free checks online, and turn production failures into new cases.
Sources
Show 4 sourcesHide sources
| Source | Publisher | What it supports |
|---|---|---|
| Evaluation criteria (opens in a new tab) | Google, Agent Development Kit documentation | retrieved 2026-11-17: tool_trajectory_avg_score with EXACT, IN_ORDER and ANY_ORDER, EXACT by default, per-invocation scores of 1.0 or 0.0 averaged over the case; response_match_score is ROUGE-1; judged criteria sample the judge model several times and take a majority vote; rubric_based_tool_use_quality_v1 for tool-use rules written in words, including prescribed workflows and call order; safety_v1 delegates to the Agent Platform Eval SDK; the efficiency criteria tool_call_count_v1, inference_call_count_v1, token_usage_v1 and invocation_duration_v1 are always on, never pass or fail a case, report INFORMATIONAL, and a threshold set on one is rejected |
| adk-python source, src/google/adk/evaluation/trajectory_evaluator.py | retrieved 2026-11-17: a call matches when its name and arguments are equal unless the ignore_args option is set; the three match algorithms | |
| Custom metrics (opens in a new tab) | Google, Agent Development Kit documentation | retrieved 2026-11-17: a custom metric is a Python function over the actual and expected invocations that returns an EvaluationResult |
| "Gen AI evaluation service overview" and "Determine evaluation metrics" (opens in a new tab) | Google Cloud | retrieved 2026-11-17 from the pages' descriptions: test-driven evaluation and adaptive rubrics; rubric-based, computation-based and custom function metrics |
Suggested videos
Show 2 videosHide videos
Building a custom evaluation for your agent (opens YouTube in a new tab)
Matches the lesson closely: pick a deterministic check vs a model judge, configure ADK eval criteria, and gate CI.
How to build a continuous evaluation pipeline for multi-agent systems with Gemini (opens YouTube in a new tab)
Continuous evaluation from metrics and graders to CI gates and shadow deployment in production.
Note: An 85-minute livestream: jump to the chapters.
Review
What does each trajectory match mode accept?
Check yourself
A research agent must call search_docs and search_tickets before it answers, and the order between them does not matter. Sometimes it also calls get_user first. Which match mode passes these runs and still fails a run that skips a search?