Designing Custom Evaluation Metrics in ADK for NL2SQL Data Agents
Google Cloud published an Agent Development Kit guide on December 1, 2026, detailing custom deterministic semantic metrics to evaluate BigQuery NL2SQL agents.
By Dillip Chowdary • Nov 30, 2026 • Source: Google Cloud Blog

At a glance
- Product
- Agent Development Kit
- Company
- Google Cloud
- Author
- Rupjit Chakraborty
- Warehouse
- BigQuery
- Publish date
- December 1, 2026
- Method
- Six-step deterministic normalization
In this post
Google Cloud released an evaluation guide for natural language to SQL data agents in its Agent Development Kit on December 1, 2026, authored by AI engineer Rupjit Chakraborty. According to Google Cloud Blog's report, autonomous data agents built on Agent Development Kit connect to cloud data warehouses such as BigQuery to inspect schemas, validate queries, and synthesize answers from live data. Built-in evaluation criteria like tool_trajectory_avg_score and response_match_score check for exact SQL text matches or ROUGE-1 word overlap, causing evaluation pipelines to reject valid query variations.
This analysis examines how developers and practitioners can replace brittle string and table checks with a custom deterministic semantic metric inside Agent Development Kit. The guide outlines the five failure modes of traditional SQL evaluation, establishes a three-layer assessment architecture, and provides a six-step normalization blueprint for zero-token equivalence testing.
01The evaluator dilemma and three testing layers
Standard benchmarks create a dilemma by comparing raw SQL text or using naive cell-by-cell table diffs against generated queries. These rigid checks fail when an agent introduces helpful improvements, such as aliasing cryptic column headers or selecting supplemental context columns. Even though a model retrieves the exact business data requested, traditional benchmarks flag the response as a failure.
To address this limitation, the framework combines native and custom metrics across three distinct operational layers. The first layer uses the built-in tool_trajectory_avg_score criterion configured with match_type set to IN_ORDER and ignore_args set to true. This setup verifies that the agent calls database tools in the correct order without penalizing valid SQL syntax variations inside tool arguments.
The second layer implements custom deterministic semantic equivalence, normalizing gold-standard and predicted result sets into a standard form to confirm matching data at zero LLM token cost. The third layer adds rubric-based evaluation using the rubric_based_final_response_quality_v1 criterion. This LLM-as-a-judge metric confirms that extra context columns remain useful and ensures the natural-language summary accurately reflects the retrieved data.
02Five SQL evaluation traps in standard benchmarks
Traditional evaluation fails across five common scenarios encountered in production data warehouses. In the alias problem, an agent improves readability by renaming raw column identifiers using the AS keyword, such as displaying prod_sale_rev_fy25 as Revenue FY2025. Exact string matching and naive diffs fail because the resulting column headers do not match the gold query.
The permutation and sorting problems introduce structural mismatches without altering business data. Permutation occurs when an agent selects identical columns in a different sequence, while sorting issues arise because SQL standards do not guarantee row order without an explicit ORDER BY clause. Distributed systems like BigQuery execute queries across parallel workers, producing variable row sequences that trip naive table comparisons.
Data type discrepancies and superset selections represent the remaining failure traps. An agent may return uncast numbers like 99.5 instead of an explicit DECIMAL(10, 2) value of 99.50, triggering false negatives in unnormalized string checks. Similarly, capable agents often anticipate follow-up questions by including extra columns, such as adding project_lead and due_date to a requested project_name query.
| Metric Failure Trap | Gold Query Behavior | Agent Output Behavior | Evaluator Failure Mode |
|---|---|---|---|
| Alias | Raw column name | Renamed with AS keyword | Header string mismatch |
| Permutation | Fixed column sequence | Reordered SELECT sequence | Positional cell mismatch |
| Sorting | Arbitrary engine order | Alternate parallel row order | Row index mismatch |
| Precision | Explicit cast to DECIMAL | Raw numeric output | Type string mismatch |
| Superset | Minimal requested column | Added context columns | Column count rejection |
Advertisement
Tech Pulse Daily
Get tomorrow's pulse first
Join engineers who read Tech Pulse before stand-up. Free, weekday mornings.
03Six steps for deterministic normalization
When built-in criteria cannot evaluate domain-specific SQL logic, developers author a custom Python metric registered through the custom_metrics field in the evaluation configuration. The custom metric processes gold-standard and predicted tables through a structured six-step sequence to verify equivalence deterministically.
- Standard value normalization casts numbers to floats rounded to fixed precision, converts timestamps and dates into ISO-8601 strings, and strips whitespace from text.
- Column alignment by value counts models each column as an unordered frequency counter using the collections.Counter class to neutralize column aliases.
- Superset column filtering evaluates whether predicted column counts meet or exceed gold columns when the allow_superset parameter is set to true.
- One-to-one column mapping identifies a valid unique pairing between every gold column and a distinct predicted candidate column.
- Order-invariant row hashing projects predicted rows through the mapped columns and counts row tuples with collections.Counter to ignore row sequence.
- Equality verdict generates a boolean match outcome alongside mapped column metadata for debugging before returning an EvaluationResult object.
04Configuration parameters and multi-row fixtures
To avoid false positive matches where a flawed query matches a gold table by pure coincidence, evaluators must run against realistic multi-row test fixtures. Single-row fixtures create risks where different columns holding identical values, such as zero counts or common flags, falsely map to one another during frequency analysis.
The custom metric requires setting allow_superset to true whenever agents are permitted to supply bonus context columns. When strict minimal output is required by business rules, setting the flag to false forces the evaluator to demand identical column counts across both tables.
Note: Evaluation pipelines should enforce row sorting checks only when user prompts explicitly request ranked or limited results, such as top five customer queries.
05Production readiness for enterprise data agents
Building semantic evaluation into Agent Development Kit allows engineering teams to separate superficial output styling from data accuracy. Developers can update agent prompts, modify underlying models, or adjust warehouse connectors without rewriting rigid gold-standard queries whenever formatting rules change.
Combining deterministic Python normalization with rubric-based LLM judges protects engineering budgets by offloading table matching to local compute. The custom Python evaluator consumes zero language model tokens while processing result sets. LLM-as-a-judge criteria run solely to evaluate final conversational summaries.
This structured evaluation pipeline ensures enterprise NL2SQL agents transition smoothly from single-shot query prototypes into production systems. By systematically eliminating false negatives across aliasing, permutations, sorting, precision, and column supersets, data teams establish reliable validation benchmarks on cloud data warehouses.
Frequently asked questions
Why do standard metrics fail on enterprise NL2SQL agents?
Standard metrics like string match and naive table diff penalize agents for cosmetic variations, including column aliasing, reordered columns, parallel execution row sorting, decimal precision differences, and helpful extra columns.
How does Agent Development Kit evaluate tool execution paths?
It uses the built-in tool_trajectory_avg_score criterion configured with match_type set to IN_ORDER and ignore_args set to true, checking that database tools run in sequence without failing on SQL syntax variations.
What does the allow_superset parameter control in the custom metric?
When set to true, allow_superset permits the evaluator to accept predicted tables that include extra context columns beyond the required gold-standard columns.
Sources
Author
Dillip Chowdary
Writes Tech Bytes coverage of AI, engineering, and the tools that actually ship. Editor of Tech Pulse Daily.
Related on Tech Bytes
Advertisement