Google Cloud shows how to test text-to-SQL agents on the rows they return
Google Cloud’s ADK guide compares database results directly. Data-agent teams can use the method to catch wrong row pairings and keep harmless SQL rewrites from failing regression tests.
Google Cloud published a guide on December 1 showing how to grade a text-to-SQL agent on the rows its database tool returns. For teams using Python Agent Development Kit (ADK) with a warehouse such as BigQuery, that gives a regression suite a way to accept equivalent SQL rewrites while still catching changes to the data. The guide describes a custom metric built on ADK’s existing evaluation interface and pairs it with separate checks for the tool calls and the answer the user sees. Google Cloud’s December 1 guide

Compare whole rows after aligning columns
The guide uses the frequency of values in each column to find candidate matches between the reference and actual results, even when an agent changes aliases or moves columns. It then tries one-to-one column mappings and compares counts of complete row tuples. Counting tuples preserves duplicate rows and checks which values belong together. That final step matters because two tables can contain the same values in every column and still give different answers. Google Cloud’s result comparison method
Consider an illustrative fixture for the prompt “Show each warehouse’s open order count.” The output for each warehouse matters, and the prompt leaves the display order open.
| Case | Returned warehouse and count pairs | Expected verdict |
|---|---|---|
| Reference | North, 12 and South, 7 | Expected rows |
| Reordered rows | South, 7 and North, 12 | Pass |
| Counts swapped | North, 7 and South, 12 | Fail |
The swapped result contains both warehouse names and both expected counts. A comparison that stops at column frequencies would pass it. Comparing complete tuples catches the error. To test the evaluator itself, start with a reviewed fixture and create one variant that changes only presentation and another that breaks a relationship the user depends on. Both variants should produce their expected verdicts before the metric gates a model or prompt change.
Give each fixture an explicit comparison rule
Google’s sample compares rows without regard to order. Use that rule for the warehouse example, and use a separate order-sensitive check for a prompt such as “Rank the warehouses by open orders.” When ties are possible, specify whether their order can vary or whether the prompt requires a tie-breaker. Include a case where the wrong warehouse crosses the cutoff for a top-N request. A fixture with indistinguishable counts can let a flawed query pass by coincidence. Google Cloud’s discussion of ordering and realistic fixtures
Apply the same care to value normalization. Google’s sample rounds numeric values after converting them to floats and warns about leading-zero codes and large identifiers stored as strings. In a regression suite, specify which fields are quantities and which are identifiers. Keep a code such as 02134 as text, and define the comparison precision explicitly for money. Allow extra columns only in cases where supplementary data belongs in the answer. Google Cloud’s normalization and extra-column rules
Use three verdicts to locate a regression
Start with a fixed dataset, the prompt, reviewed reference rows and the expected tool behavior. Google’s BigQuery codelab illustrates the fixed-data approach with a static ecommerce snapshot and golden responses. Its Vertex AI evaluation scores factual accuracy and completeness and records tool use. For the row-level test, add the expected database tool response to the fixture so the comparator can read the actual and expected rows from the evaluation invocations. The ADK docs show how to register a Python function by import path through custom_metrics and return an EvaluationResult with per-invocation results. Google’s BigQuery evaluation codelab · ADK custom metrics documentation
Keep the verdicts for the tool sequence, the rows and the final answer visible per case. Google’s guide configures its trajectory check to preserve tool order while ignoring argument differences, runs a deterministic comparison on the database rows and uses a rubric to judge the final answer. If the expected tools ran and the rows differ, inspect the generated query and its inputs. If the rows match and the answer still misstates the counts, inspect how the agent turns the tool response into prose. If execution failed, record that outcome distinctly from a successful query that returned an empty result. Those distinctions help a team decide which regression should block a change and where to start debugging. Google Cloud’s three-layer evaluation · Automater’s guide to agent evaluation in CI