Designing Custom Evaluation Metrics In ADK For NL2SQL Data Agents
AIThis post was created with the assistance of artificial intelligence (AI).

TL;DR

Google Cloud’s Rupjit Chakraborty describes a way to evaluate natural-language-to-SQL agents built with the Agent Development Kit without relying only on exact SQL strings or rigid table comparisons. The proposed approach combines tool-trajectory checks, deterministic comparison of normalized query results and rubric-based review of the agent’s answer.

Google Cloud’s Rupjit Chakraborty has outlined a custom evaluation approach for natural-language-to-SQL agents built with the Agent Development Kit (ADK), arguing that exact SQL-string and rigid table comparisons can mark valid answers as failures. The method combines checks of an agent’s tool use, normalized comparisons of database results and rubric-based review of its final response, addressing a practical testing challenge as NL2SQL systems take on more agent-like tasks.

Buying for a business?Offer from Amazon

Get business pricing on monitors, keyboards and dev gear

  • Business-only prices and quantity discounts
  • Tax-exempt purchasing
  • Multiple users, one account, clear invoices
As an affiliate, we earn on qualifying purchases.

Chakraborty, identified in the source as an AI engineer, says ADK’s built-in metrics can be too strict when used alone. The tool_trajectory_avg_score criterion can require an exact match for tool arguments, including raw SQL, while response_match_score uses ROUGE-1 word overlap. Those checks may penalize an agent even when it produces equivalent results or a clearer response.

The proposed evaluation uses three layers. For tool trajectories, the post recommends configuring tool_trajectory_avg_score with match_type set to IN_ORDER and ignore_args set to true, so evaluators check the sequence of database-tool calls without treating every SQL variation as an error. For result correctness, it proposes a custom deterministic metric that normalizes the reference and predicted result sets before comparing them. A rubric-based final-response criterion, rubric_based_final_response_quality_v1, can then assess whether extra context is useful and whether the natural-language explanation matches the returned data.

The post identifies five sources of false failures in simple SQL benchmarks: different column aliases, different column order, different row order, equivalent numeric values represented with different types or precision, and extra columns that may provide useful context. The supplied examples show that labels such as “Revenue FY2025” can replace a database field name, or that 99.50 and 99.5 can represent the same value, without changing the underlying answer.

At a glance
reportWhen: Published date not provided in the sour…
The developmentA Google Cloud blog post explains how to build custom semantic evaluation metrics in ADK for natural-language-to-SQL data agents.
Google Cloud · Briefing

Evaluating NL2SQL agents beyond exact matches

Rupjit Chakraborty outlines a three-layer ADK evaluation for distinguishing wrong answers from harmless SQL and presentation differences.

Three layers, one evaluation

Check how the agent works, what data it returns, and how well it explains the result.

1
Check tool use

Match database-tool calls in order while ignoring argument differences such as raw SQL variations.

2
Compare results

Normalize reference and predicted result sets, then compare them deterministically.

3
Review the answer

Use a rubric to assess whether the explanation matches the data and added context is useful.

Why literal checks fail

Valid SQL answers can differ in form while preserving the requested information.

Labels

Different aliases

“Revenue FY2025” can label the same field more clearly.

Layout

Column and row order

Column order may vary, and row order is not guaranteed unless requested.

Values

Equivalent numbers

99.50 and 99.5 can represent the same value.

Context

Useful extra fields

Additional columns may help readers, depending on the request.

Fit the check to the request

Enforce order
  • The prompt asks for a ranking or sorted list.
  • A top-five request needs the requested order.
Allow variation
  • The prompt does not specify a row order.
  • Aliases and equivalent numeric formatting differ.

What teams still need to define

The source gives a design and examples, but no complete normalization algorithm or reported benchmark results.

Evaluation detailOpen question
Result normalizationHow should duplicates, nulls, dates, and numeric tolerances be handled?
Extra columnsWhen does added context fit the user’s request and data domain?
Rubric reviewHow reliably does the judge assess answer quality?
Key pointEvaluate tool use, data equivalence, and answer quality separately so harmless SQL variation does not hide genuinely wrong results.
The takeaway
ADK’s layered evaluation can make NL2SQL tests more meaningful, but teams must define equivalence rules and validate them on representative queries.

Making SQL Agent Tests Reflect Meaning

The evaluation choice affects whether teams can tell the difference between a genuinely wrong answer and a harmless change in formatting or presentation. Exact-string checks are easy to automate, but they can conflate query wording with query correctness. A result comparison that accounts for SQL semantics can give developers a more useful signal when tuning an agent for production use.

The distinction matters for business users of data agents, too. A system may return the requested records with friendlier labels or relevant additional fields; a benchmark that rejects those outputs may discourage useful behavior. At the same time, flexibility should not mean overlooking errors: the post’s layered approach separates tool-use checks, data equivalence and answer quality rather than treating any one score as a complete measure of reliability.

Chakraborty says the deterministic comparison can verify result equivalence at zero LLM token cost. That is a claim about the proposed comparison step, not evidence in the source of measured savings or a guarantee that the full evaluation pipeline has no model-related costs. The source provides a design and examples, not reported benchmark results demonstrating production performance.

Products Worth Considering

DJI Osmo Action 6 Capture More Combo 8K Waterproof Action Camera

DJI Osmo Action 6 Capture More Combo 8K Waterproof Action Camera

Bose QuietComfort Wireless Noise-Cancelling Headphones, Sandstone

Bose QuietComfort Wireless Noise-Cancelling Headphones, Sandstone

As an affiliate, we earn on qualifying purchases.

Why Exact-Match SQL Scores Fall Short

The post frames NL2SQL systems as moving beyond single-shot query translation toward data agents that inspect schemas, validate queries and produce answers from live data. It describes ADK agents connected to cloud warehouses such as BigQuery, where the system may need to interact with database tools as well as explain results.

SQL often permits multiple ways to express a query or present its output. Column aliases can improve readability, SELECT columns can appear in different orders, and results without an explicit ORDER BY are not guaranteed to arrive in a fixed row sequence. Numeric formatting can also differ while values remain mathematically equal. These properties create a mismatch with tests built around literal text or position-by-position table equality.

The source recommends preserving stricter checks where they match the user’s request. For example, an evaluation should enforce row order when a prompt specifically asks for a ranking or a sorted list, such as the top five customers. It should not impose an arbitrary order on a query that makes no such request.

““The evaluator’s dilemma stems from a fundamental mismatch between rigid test assertions and flexible SQL semantics.””

— Rupjit Chakraborty, AI engineer, in the Google Cloud blog post

Limits of the Proposed Evaluation

The source material describes the evaluation design but does not provide measured accuracy, benchmark comparisons or production results. It also does not specify a complete normalization algorithm, including how an implementation should handle duplicate rows, null values, date and time zones, floating-point tolerances, or cases where column identity matters despite different labels.

How to assess the fifth scenario—additional columns that may be helpful—also depends on the user’s request and the data domain. The post proposes rubric-based review for usefulness and consistency, but the supplied material does not give a full rubric or report how reliably a judge applies it. It is therefore not possible from this source to determine how the approach performs across different schemas, workloads or ADK deployments.

Implementing and Testing the ADK Metric

The next step described by the post is to implement and run a custom semantic SQL evaluator in ADK, using normalized result sets alongside trajectory and response-quality criteria. The supplied source excerpt introduces the five evaluation traps and the three-layer design, but ends before providing the complete implementation or instructions for running it.

Teams applying the method would need to define which differences count as equivalent for their own workloads, including when result order is required and whether extra fields are acceptable. They would also need to test the evaluator against representative queries and incorrect outputs. The source does not state a release date for further material or report a formal validation milestone.

Key Questions

What development does the Google Cloud post describe?

It describes a custom evaluation approach in ADK for NL2SQL data agents, combining tool-use checks, normalized result comparisons and rubric-based review of final answers.

Why can exact SQL matching give misleading results?

Two queries can use different SQL text or column aliases while returning equivalent data. An exact-string test can mark that valid variation as a failure.

When should an evaluator enforce row order?

According to the post, it should enforce order when the request explicitly calls for a ranking or sorted list. For queries without that requirement, row order may vary.

Does the source show that the custom metric improves production accuracy?

No. It presents the design and illustrative cases, but the supplied material reports no benchmark results or measured production outcomes.

Source: Google Cloud Blog

You May Also Like

Selenium vs. Playwright in 2025: Head‑to‑Head Showdown

Selenium vs. Playwright in 2025: Head‑to‑Head Showdown—see which automation tool dominates as we explore their strengths and weaknesses for your projects.

11 AI-Powered Transcription Software Options For 2027

A source-based guide compares 11 transcription software and recorder options, while noting that pricing, features and 2027 availability need verification.

What Is Your Understanding of Quality Assurance in Software Development

Quality assurance in software development involves the systematic monitoring and evaluation of processes to ensure that the final product meets the specified requirements and standards.

CI Runners for QA: The Hardware Checklist Before You Scale Automation

Just before scaling your CI runners for QA, ensure your hardware is ready to handle increased demands—and here’s why that matters.