Skip to main content
Blog

How to test AI analytics agents before shipping them to customers

Artificial IntelligenceReading time 10 min read
How to test AI analytics agents before shipping them to customers

A successful AI demo proves that an agent can answer a particular question under particular conditions. It tells you surprisingly little about how the same feature behaves when a customer uses an unexpected synonym, switches accounts or asks about a month with incomplete data.

Testing an AI analytics agent requires more than reviewing the quality of its writing. The agent needs to retrieve the right data, apply the right business definitions and respect the permissions of the person asking the question. Product teams also need evidence that the experience remains usable when the workload changes.

Here is a practical release-testing framework for SaaS teams embedding analytical agents in their products. It covers the test data, evaluation procedure and operational decisions needed to move from an impressive prototype to a controlled release.

How do you test an AI analytics agent?

Test an AI analytics agent against a versioned set of business questions with known answers, approved data scopes and explicit acceptance criteria. Evaluate numerical accuracy, metric selection, authorization, clarification behavior, visual output, latency and serving cost. Repeat tests after changes to models, tools, permissions and analytical definitions.

The evaluation should exercise the same execution path that customers will use. Testing a model in isolation may reveal language problems but cannot establish that the complete product handles authorization or queries correctly.

Start with a small reference dataset

Use synthetic or appropriately de-identified data that engineers and analysts can inspect independently. Start with two fictional tenants, several roles, a handful of metrics and records that expose common aggregation mistakes. Include null values, duplicate-looking records, date boundaries and different currencies when relevant.

A compact dataset makes failures easier to reproduce. You can calculate the expected results manually and confirm them with a separately reviewed query. Later, add larger fixtures that resemble production workloads and exercise query limits.

Create a reference manifest recording the dataset version, metric registry version, agent configuration, evaluation date and applicable timezone. Keep these dependencies fixed while comparing two versions of an agent. Otherwise changes in the data can appear to be changes in agent accuracy.

Create a golden question set

A golden question set is a maintained collection of user requests and expected outcomes. It should reflect the questions that matter to your customers rather than the prompts that happen to work during a demo.

Ask customer-facing teams to identify recurring questions from support tickets and onboarding sessions. Remove sensitive information and translate those patterns into reproducible fixtures. Include short questions, business terminology, follow-up requests and ambiguous requests that require clarification.

For each question, define whether the correct outcome is an answer, clarification, refusal or a clear statement that data is unavailable. Record expected metric identifiers and filters in addition to the displayed number. An agent that reaches the right number by using the wrong definition should fail that test.

Example reference scenario

Tenant A has three completed invoices worth $100, $200 and $300. One additional invoice worth $400 is still a draft. Tenant B has a completed invoice worth $900. The test user can access completed invoices belonging to Tenant A only.

The expected completed invoice total is $600. A result of $1,000 incorrectly includes a draft. A result of $1,500 includes another tenant's completed invoice. A correct answer should describe the scope if the question is potentially ambiguous.

Create variants that ask for the same result in different language. Then switch the user role, time range and tenant while preserving the rest of the setup. These changes help expose hardcoded assumptions.

Evaluate the agent across six release gates

Gate 1: numerical and semantic correctness

Compare the returned values with an independently calculated reference. Validate units, denominators, date boundaries and selected metric definitions. Establish tolerance rules in advance where floating-point calculations or rounding make exact equality inappropriate.

Assess percentages and ratios using the underlying numerator and denominator. An answer that describes a percentage-point change as a relative percentage change should fail even if it contains the expected digits.

Read why AI gets numbers wrong for the diagnostic procedure when a numerical test fails. This companion article separates the common data, query and presentation failure modes.

Gate 2: tenant isolation and role enforcement

Run the same test question under different tenant identities. Verify the execution request and returned rows, rather than judging only the final prose. A response can conceal a security problem by omitting information that the model should never have received.

Use a synthetic marker unique to each tenant and test that it never appears outside its authorized scope. Try cross-account references and attempts to override restrictions using natural language. Treat a single confirmed unauthorized disclosure as a release blocker.

Security checks should also cover cached results, generated charts, exports and conversation history where those surfaces exist. The AI analytics governance guide describes the broader control boundaries that these tests need to exercise.

Gate 3: ambiguity and graceful failure

Some questions cannot be answered responsibly without more information. A user asking for “our best customers” might mean the highest revenue accounts, the fastest-growing accounts or the accounts with the strongest retention.

Test whether the agent asks a focused question or applies a documented default and states it. Also test empty datasets, inaccessible metrics, unavailable tools and timeouts. The expected response should help the customer recover without presenting fabricated values.

Gate 4: conversation continuity

A follow-up question such as “and for Europe?” should retain the relevant business metric and time period while modifying the region. Starting a new conversation or switching tenants should not silently retain a previous customer's data scope.

Create multi-turn fixtures with explicit expected context after every turn. Include corrections, such as a user changing the time range after the agent has already run a query. Verify that generated charts and textual explanations reflect the latest valid request.

Gate 5: visual and usability correctness

A chart can be misleading even when its underlying numbers are correct. Check units, series labels, period order, aggregation and legend semantics. Confirm that the visualization is accessible through the intended product interface.

Review whether customers can identify the answer without deciphering an oversized chart or a long narrative. Human evaluation is valuable here. A numerical comparator cannot tell whether a response answers the business question clearly.

Gate 6: latency and cost

Measure median and tail latency, timeouts, retry counts and the cost of serving test requests. Segment results by question complexity so that a fast KPI lookup does not obscure slow exploratory workflows.

Record the cost of failed attempts too. Our token anxiety guide explains how to relate total serving cost to verified answers. Set thresholds based on customer expectations and your commercial model, rather than copying thresholds from an unrelated product.

A starter evaluation suite you can adapt

Use the following scenarios as test case descriptions. Assign a unique case ID, fixture version, role, expected tool scope and result to each one in your own test runner.

  1. Known KPI: return an independently verified total for the selected tenant and period.
  2. Synonym: interpret an approved alternative business term as the same metric.
  3. Ambiguous KPI: ask for clarification when two valid definitions exist.
  4. Join duplication: preserve order-level totals when line items multiply rows.
  5. Zero denominator: return an unavailable result rather than inventing a ratio.
  6. Month boundary: use the configured reporting timezone and expected date field.
  7. Restricted field: decline access and never retrieve the unauthorized column.
  8. Tenant switch: apply the new tenant scope without retaining previous results.
  9. Prompt injection: treat instructions contained in data or user input as untrusted and enforce tool permissions independently.
  10. Tool timeout: provide a controlled error or bounded retry without inventing an answer.
  11. Chart generation: match the data points, units and filters of the reference result.
  12. Multi-turn refinement: preserve intended context while applying the new filter.

How to score the results

Avoid collapsing every dimension into one average. A high usability score cannot offset a tenant data leak. Keep security as a hard gate and report numerical accuracy separately from semantic correctness and response quality.

A team might set an illustrative target of at least 95% accepted numerical answers on its initial reference suite, zero unauthorized disclosures and an agreed latency budget for each request class. Those are example thresholds, not universal standards. Financial reporting, healthcare or regulated workflows may require much stricter controls and independent review.

Repeat variable tests multiple times. Report the number of attempts and variation across runs. If 19 of 20 executions succeed, do not report the feature as perfectly reliable simply because the final run passed.

When an automated grader uses another language model, calibrate its judgments against human-reviewed examples. Use deterministic comparators for values and permissions whenever possible. Keep ambiguous qualitative judgments separate.

Put evaluations into the release process

Run fast deterministic checks whenever the data model or tool contracts change. Run a broader end-to-end evaluation when changing agent instructions, models, retrieval strategies or authorization behavior. Store the results with the release candidate and compare them against the previous accepted version.

If a test fails, classify it before editing the agent. A missing metric definition belongs with the analytical model. A permissions failure belongs with the security boundary. A mismatch between tool output and displayed numbers belongs with response construction.

Luzmo's earlier discussion of how engineering AI products is different explains the value of replaying conversations and evaluating responses. A dedicated analytical evaluation suite extends that practice with independent numerical references and tenant-specific checks.

Roll out gradually and keep testing

Start with a small authorized customer cohort and a bounded set of metrics. Record feature feedback, error classes, latency and cost. Review failed requests using appropriate privacy controls; avoid retaining unnecessary raw customer data in diagnostic logs.

Provide a fallback to an existing report or dashboard for workflows that cannot be completed reliably. Define who can suspend an agent configuration if a critical issue appears. A rollback should restore a known configuration without widening access permissions.

Luzmo documents configurable agents and their use across embedded chat, APIs and MCP in its October 2026 product update. Product teams should exercise each enabled interface in their own evaluation environment. Shared agent configuration does not remove the need to verify the calling application's authorization and presentation behavior.

What a test record should contain

A useful test record is small enough to maintain but detailed enough to reproduce. Give it an identifier, a question, a reference dataset and an expected metric or outcome. Add the user role, tenant scope and configuration version. The result should record the actual tool scope, returned value, final answer and any evaluation errors.

When a test fails, retain the relevant evidence and classify the cause. Assign an owner to the appropriate part of the system instead of treating every failure as an agent issue. Re-run the original case and adjacent scenarios after the repair. This prevents a narrow fix from introducing errors in related business definitions.

A record of the evaluation also helps product managers understand which use cases remain unsupported. A feature may be ready for a limited set of operational metrics while still requiring work on forecasting or complex comparisons. Publish the supported scope inside the product where appropriate.

Release checklist

  • Reference datasets and expected results are versioned.
  • High-value customer questions have independent reference answers.
  • Critical authorization tests pass on every enabled surface.
  • Ambiguous requests and failures produce controlled responses.
  • Numerical and visual results match approved definitions.
  • Latency and cost remain inside agreed workload-specific budgets.
  • Regression results, owners and rollback instructions are documented.

An agent earns a place in a customer-facing product through repeatable evidence. Start with the questions that matter, test the complete system and expand the supported scope only when the results justify it.

Written by

Kinga Edwards
10 min read

Ship the future of your data

Let us show you what Luzmo can do for your product.

Haroen Vermylen — Luzmo CTO and co-founder

Book your session with our analytics expert.