Before you trust an analytics agent, test it. Learn how to measure accuracy, latency, and hallucinations with golden-query test suites.

Ka Ling Wu
Co-Founder & CEO, Upsolve AI
10 min

An agent evaluation framework is a structured way to measure whether your analytics agent returns correct, trustworthy answers before and after you put it in front of real users. If your agent demoed beautifully but breaks the moment someone asks a slightly different question, you do not have a model problem; you have an evaluation problem, and this guide walks through how to fix it.
Most teams test an analytics agent the way they test a demo: they ask a handful of questions they already know the answers to, watch it nail them, and ship. Then production users ask the questions nobody rehearsed, and the whole thing wobbles. The gap between "looks impressive in a meeting" and "reliable enough to trust with a board metric" is exactly what a real evaluation framework closes.
Key Takeaways |
|---|
|
Why Evaluating an Analytics Agent Is Harder Than It Looks
Traditional software is deterministic. Given the same input, it produces the same output, so a passing test today means a passing test tomorrow. Analytics agents are not like that. They interpret ambiguous language, choose among many valid query paths, and generate answers that can be subtly wrong in ways that still look completely plausible.
This is where evaluation gets uncomfortable. A dashboard either loads the right number or it does not. An agent can return a confident, well-formatted, wrong answer, and unless you already know the correct figure, you will not catch it. That is the trap behind the "verification tax": users spend so much time double-checking outputs that the promised time savings evaporate. MIT's widely cited finding that about 95% of enterprise generative AI pilots fail to deliver measurable impact traces largely to this pattern, where tools that dazzle in demos collapse once real workflows demand context and consistency.
The core problem: An analytics agent does not fail loudly. It fails quietly, with an answer that is 90% right and 10% catastrophic. Your evaluation framework exists to surface the 10% before your CFO does.
There is also a trust asymmetry that makes this worse. As one enterprise AI researcher put it, in serious work a single high-confidence miss costs more credibility than ten correct answers earn. One wrong revenue number in a leadership meeting can end an agent's career inside your company, no matter how many questions it answered correctly the week before. Evaluation is not a nice-to-have; it is the thing that protects the agent's credibility long enough for it to become useful.

What a Good Agent Evaluation Framework Measures
Before you can test anything, you have to define what "good" means in numbers. Too many teams collapse the entire question into a single word, accuracy, and then argue about it. A production-grade framework measures four distinct dimensions, because an agent can excel at one while quietly failing another.
Metric | What It Measures | How to Measure It | Target Signal |
|---|---|---|---|
Accuracy | Did the answer match the verified ground truth, both technically and semantically | Compare agent output against a golden query set | High pass rate on your own dataset, not a public leaderboard |
Hallucination rate | How often the agent invents a number, column, or relationship that does not exist | Flag answers with no valid query path or fabricated fields | As close to zero as possible for trusted metrics |
Latency | How long a user waits for an answer | Time from question submitted to answer returned | Fast enough that users prefer it over Slacking an analyst |
Cost per query | Compute and token cost of producing each answer | Sum model, retrieval, and execution cost per query | Predictable and sustainable at expected query volume |
Accuracy: Technical Versus Semantic
Accuracy is really two questions wearing one label. Technical accuracy asks whether the generated SQL runs and pulls from the right tables. Semantic accuracy asks whether the answer actually means what the user intended. An agent can produce flawless SQL against the wrong definition of "active customer" and be 100% technically correct while being 100% useless.
This distinction is where most evaluation frameworks are too shallow. A query that executes without error is not the same as a query that answers the question. The reason agents get semantic accuracy wrong is almost never the model; it is the missing business context, which is a topic in its own right. For the full treatment of what context an agent needs to be accurate, see our context engineering guide. For evaluation purposes, the key move is simple: your ground truth has to encode the correct business meaning, not just a query that happens to run.
Hallucination Rate
In analytics, a hallucination is not a made-up sentence; it is a made-up join, a fabricated column, or a metric definition the agent invented on the spot. These are dangerous precisely because they are formatted like real answers. Measure hallucination rate by tracking how often the agent produces an answer with no valid, verifiable query path behind it. For any metric a human will act on, this number needs to trend toward zero.
Latency
Speed matters because the entire value proposition of an analytics agent is that it beats the alternative. If a business user waits three to five days for an answer from the data team today, an agent that responds in twenty seconds is transformational; an agent that takes four minutes and sometimes times out is not. Track latency at the median and the tail, because the slow 5% of queries are the ones that erode trust.
Cost Per Query
Cost is the metric teams forget until the bill arrives. A pipeline that calls a large model multiple times per query, retrieves broad context, and runs several candidate queries can be accurate and completely unaffordable at scale. Measure cost per query early, and treat it as a first-class constraint rather than an afterthought. The goal is an agent that stays accurate as query volume grows without the economics falling apart.
Pro tip: Never optimize a single metric in isolation. It is trivial to drive hallucination rate to zero by making the agent refuse everything, and trivial to drive latency down by skipping validation. The framework works because these four metrics trade off against one another: gaming any single one immediately shows up as damage to another.

Building a Unit Test Suite for Your Analytics Agent
Software engineers do not ship code without unit tests, and you should not ship an analytics agent without the equivalent. The analytics version of a unit test is golden query testing: a curated set of questions paired with verified correct answers, run automatically every time you change the agent's context, prompts, or model.
What a Golden Query Is
A golden query is a question plus its verified ground truth. Not the SQL the model happened to generate, but the answer a trusted analyst has confirmed is correct. "What was net revenue in Q1 2026?" paired with the exact figure, produced by the exact query definition your finance team endorses, is a golden query. The verified answer is the gold; the agent's job is to match it.
How to Structure a Golden Query Set
A useful golden query set is not just a list of easy wins. Build coverage across difficulty and risk:
Core metrics: The questions your business asks constantly. Revenue, active users, churn, pipeline. If the agent misses these, nothing else matters.
Ambiguous phrasing: The same question asked five different ways, including sloppy, colloquial, and abbreviated versions. Real users do not phrase things cleanly.
Definitional traps: Questions that hinge on a specific business rule, like which fiscal calendar applies or how "active" is defined. These test semantic accuracy directly.
Multi-step questions: Queries that require joins, filters, and follow-up reasoning rather than a single lookup.
Out-of-scope questions: Things the agent should refuse or escalate rather than guess. A good agent knows what it does not know.
Running the Suite in Continuous Integration
The point of a golden query suite is that it runs on autopilot. Wire it into your deployment pipeline so that every change to context, prompts, or model version triggers the full set and reports a pass rate. When a change improves accuracy on new questions but silently breaks three core metrics, the suite catches it immediately, the same way a regression test catches a broken build. Without this, you are flying blind every time you tune the agent.

How to Create an Evaluation Dataset
Your evaluation is only as good as the dataset behind it. A framework built on twenty cherry-picked questions will tell you your agent is excellent right up until production proves otherwise. Building a representative dataset is unglamorous work, and it is the highest-leverage thing you can do.
Source Questions From Real Usage
The best questions are the ones your users actually ask. If you have an existing analytics request queue, a support inbox, or Slack channels where people beg the data team for numbers, that is your goldmine. Pull real questions, in real language, with all their ambiguity intact. According to Upsolve's customer data, roughly 47% of the data queue is repeat questions, which means a relatively small, well-chosen dataset can cover a large share of real demand.
Cover Edge Cases, Ambiguity, and Scope
A dataset weighted toward easy questions produces a falsely optimistic score. Deliberately over-represent the hard cases:
Questions with genuinely ambiguous intent
Questions that require a specific, non-obvious business rule
Questions that span multiple tables or time periods
Questions that should be refused because the data does not exist
Near-duplicate questions phrased differently to test consistency
Label and Maintain Ground Truth
Every question in the dataset needs a verified answer, and someone who understands the business has to sign off on it. This is where evaluation datasets quietly rot: the correct answer to "monthly recurring revenue" changes when finance updates the definition, and if your ground truth does not change with it, your agent gets penalized for being right. Treat the dataset as living infrastructure. Version it, review it, and update ground truth whenever definitions shift.
Key insight: The hardest part of evaluation is not scoring the agent. It is agreeing on what the correct answer actually is. That agreement is itself institutional knowledge, and encoding it is half the battle.
The Failure Modes Your Evaluation Has to Catch
When analytics agents get answers wrong, they tend to fail in three distinct ways. Naming them makes your evaluation sharper, because you can build test cases that target each one deliberately rather than hoping your dataset happens to cover them. These map directly to the broader patterns behind why agents break, and you can go deeper on the common failure modes in our diagnosis of production failures.
Interpretation Failures
An interpretation failure happens when the agent misunderstands what the user meant. The user asks for "last quarter" during the first week of July, and the agent returns the calendar quarter when the company runs on a fiscal calendar. The SQL is perfect. The interpretation is wrong. Test for these by loading your dataset with questions that hinge on shared assumptions a human analyst would resolve automatically.
Framing Failures
A framing failure is subtler. The agent understands the question and returns a technically correct number, but frames it in a way that misleads. It reports raw revenue when the user clearly needed net, or shows a total without the segmentation that gives it meaning. The answer is not false, but it points the user toward the wrong conclusion. These are the hardest failures to catch automatically, which is exactly why they belong in your dataset with carefully labeled expected framing.
Scope Failures
A scope failure is when the agent answers a question it should have refused. The data needed to answer it does not exist, or lives outside the agent's authorized access, and instead of saying so, the agent produces a plausible-looking number anyway. This is where hallucination and trust collide. A well-evaluated agent scores well not only on the questions it answers, but on the questions it correctly declines.

The Analytics Agent Evaluation Rubric
Pulling the pieces together, here is a rubric you can adapt to score an agent across the dimensions that matter. Treat each row as a test category, assign it a weight based on your risk tolerance, and score the agent on a consistent scale. The rubric turns "it feels pretty good" into a number you can defend and track over time.
Evaluation Criterion | What You Are Testing | Pass Condition | Why It Matters |
|---|---|---|---|
Technical accuracy | SQL executes and hits the right tables | Query runs and returns valid rows | Broken queries are obvious failures |
Semantic accuracy | Answer matches the intended business meaning | Output matches verified golden answer | A right query on a wrong definition is still wrong |
Interpretation | Agent resolves ambiguity correctly | Matches the intent a good analyst would infer | Prevents confident answers to misread questions |
Framing | Answer is presented without misleading the reader | Output includes the framing the question requires | Guards against technically true, practically false answers |
Scope handling | Agent refuses what it cannot answer | Declines or escalates instead of guessing | Turns a potential hallucination into a clear refusal |
Hallucination control | No invented columns, joins, or metrics | Every answer has a verifiable query path | Protects trust in high-stakes numbers |
Latency | Response time under load | Within your defined median and tail targets | Slow answers push users back to the old queue |
Cost efficiency | Compute and token cost per query | Sustainable at projected query volume | Keeps accuracy affordable at scale |
Consistency | Same question, same answer across phrasings | Near-identical output for equivalent questions | Inconsistency destroys user confidence fast |
Benchmarks: What Public Leaderboards Can and Cannot Tell You
Public benchmarks are useful, and they are also routinely misread. They give you a shared yardstick for comparing approaches, but they do not tell you how an agent will behave on your data, with your definitions, for your users.
Take BIRD, one of the most rigorous text-to-SQL benchmarks, built on messy, real-world databases across dozens of professional domains. The best models now reach roughly 80% execution accuracy on BIRD, which sounds production-ready until you sit with what a 20% miss rate means for numbers your leadership will act on. Worse, researchers auditing these benchmarks found that the benchmark annotations themselves contain errors, enough to reshuffle leaderboard rankings once corrected. A benchmark score is a signal, not a guarantee.
This is why independent, methodology-driven testing matters. Analytics leader Claire Gouze ran one of the more useful public evaluations by testing 14 analytics agents against a consistent set of real questions, then later expanding the benchmark to 21 tools. The value was not the ranking; it was the method. She ran the same questions across every tool, checked answers against known-correct results, and documented where each one broke. That is exactly the discipline your internal evaluation needs, applied to your own data.
Bottom line: Use public benchmarks to shortlist approaches. Use your own golden query set, built on your definitions, to make the actual decision. A leaderboard tells you what is possible; your dataset tells you what is true for you.
Monitoring Analytics Agent Performance in Production
Evaluation does not end at deployment. The moment real users start asking real questions, you get the richest evaluation dataset you will ever have, and the framework has to keep running.
Production monitoring rests on a few practices working together:
Conversation logs: Capture every question, the agent's answer, and the query behind it. This is your record of what actually happened, and the raw material for finding new failure cases.
LLM-as-a-judge scoring: Use a model to automatically score production answers against your criteria at scale. It is far cheaper than human review, but treat its verdicts with appropriate caution; research shows LLM judges can be inconsistent across repeated runs, so use them to triage and flag, not to render final judgment on high-stakes answers.
Context gap detection: When the agent repeatedly stumbles on a class of questions, that is usually a missing piece of business context, not a broken model. Surfacing these gaps tells you exactly what to encode next.
Golden query regression runs: Keep running your unit test suite on a schedule against production, so drift in the underlying data or definitions shows up before users do.
Human corrections as fuel: Every time a user or analyst corrects an answer, that correction becomes a new golden query. This is how evaluation compounds: the agent gets measurably more reliable the more it is used, rather than degrading.
That compounding loop is the entire point. The agents that make it from pilot to production are the ones whose systems learn from feedback and improve over time rather than staying frozen at their launch-day accuracy. An evaluation framework that only runs once is a snapshot. One that runs continuously is a flywheel.
Pro tip: The single highest-value habit in production is converting every corrected answer into a permanent test case. Do this and your evaluation dataset grows exactly where your agent is weakest, which is precisely where you want coverage.
Evaluate Against Your Data, Not a Leaderboard
A public benchmark tells you what is possible; only your own golden query set, built on your definitions and your users' real questions, tells you what is true for your team. That is what this whole framework points toward: stop grading an agent on how it demos and start grading it on the questions that actually flood your data queue.
Building all of this from scratch is a real infrastructure project, which is where a purpose-built platform earns its place. Upsolve's Agent Studio treats evaluation as a core part of the encode-deploy-tune loop rather than a bolt-on: golden query testing works as a unit-test suite for agent accuracy, LLM-as-a-judge scoring runs against conversation logs, and context gap detection points you at the missing institutional knowledge behind each failure.
The goal is a production-ready agent, not a POC-ready demo. If you are weighing your options, it is worth comparing platforms with built-in evaluation suites against the cost of assembling the same capabilities yourself, or uploading a CSV to start testing questions against your own data in minutes.
Frequently Asked Questions
What is an agent evaluation framework?
An agent evaluation framework is a structured system for measuring whether an AI agent produces correct, reliable outputs. For an analytics agent, it defines success metrics (accuracy, hallucination rate, latency, cost), a verified test dataset, and a process for scoring the agent both before deployment and continuously in production. It is the analytics equivalent of a software test suite.
How do you test an AI agent for accuracy?
Test accuracy against a golden query set, which is a curated collection of questions paired with verified correct answers. Run the agent against every question, compare its output to the ground truth, and track the pass rate. Crucially, test both technical accuracy (does the query run correctly) and semantic accuracy (does the answer mean what the user intended), because an agent can pass one while failing the other.
What is golden query testing?
Golden query testing is the practice of maintaining a set of questions with human-verified correct answers and running your agent against them automatically on every change. It functions like unit testing in software: if a change to context, prompts, or model version breaks a previously correct answer, the suite flags the regression immediately instead of letting it reach users.
What metrics matter most when evaluating an analytics agent?
Four metrics form the core: accuracy (technical and semantic), hallucination rate (how often the agent invents data), latency (response time), and cost per query. No single metric is sufficient on its own, because it is easy to optimize one at the expense of the others. A useful evaluation weighs all four against your specific risk tolerance and query volume.
Can I rely on public benchmarks like BIRD to choose an agent?
Public benchmarks are useful for shortlisting approaches but should not be your final decision criterion. Top models score around 80% on BIRD, yet benchmark annotations themselves have been shown to contain errors, and no public benchmark reflects your specific data, definitions, and users. Use benchmarks to narrow the field, then evaluate finalists against your own golden query set.
How often should I re-run agent evaluations?
Run your full evaluation suite on every change to the agent's context, prompts, or model, the same way continuous integration runs tests on every code commit. In production, run golden query regression checks on a schedule and score live answers continuously with automated review. Evaluation is not a one-time gate; it is an ongoing loop that compounds as user corrections become new test cases.

Try Upsolve for Embedded Dashboards & AI Insights
Embed dashboards and AI insights directly into your product, with no heavy engineering required.
Fast setup
Built for SaaS products
30‑day free trial








