The error was not a hallucination
The language model called the expected analytics tool and summarized the returned value correctly. The tool counted joined rows rather than distinct guests, inflating 1,320 to 5,121. Prompt changes would not have fixed the defect, because the model was accurately reporting faulty deterministic logic.
| Calculation | Guest count |
|---|---|
| Agent tool result | 5,121 |
| Distinct database result | 1,320 |
The distinction determines the repair. A hallucination may require grounding, better tool selection, or publication controls. A deterministic query defect requires corrected SQL, semantic definitions, and regression coverage. Calling both failures a lying model hides the layer that owns the fix and often sends a data bug to a prompt engineer.
The receipt has to travel with the number
Each displayed metric can carry the executed query identity, parameters, source timestamp, row count, and a hash of the result. The interface does not need to expose raw SQL to a restaurant operator, but the evidence must remain available to reviewers and support staff.
This turns provenance from documentation into product state. When a number is challenged, the system can show the query, parameters, and result hash that produced it, and verify the figure against the source. That check also shows whether the source changed, the query changed, or the presentation changed. Without that chain, the argument proceeds from screenshots.
Tolerance bands need a business consequence
A pre-release harness compared agent claims with database calculations across 118 assertions. Variance between three and five percent triggered review; variance above ten percent failed the run. Those bands are not universal. A labor-cost forecast and a bank balance deserve different tolerances, and pretending otherwise produces either noise or false confidence.
The general rule is to attach a consequence to each threshold. A warning should name the decision that may be affected. A failure should stop publication when the variance could change staffing, purchasing, pricing, or compliance. Precision without consequence becomes another impressive-looking metric.
Reproducible and wrong is still wrong
A query can be perfectly reproducible and still answer the wrong question. "Orders" may mean tickets, line items, fulfilled orders, or sales-qualified orders. Provenance proves how a result was produced. It does not prove that the metric definition matched the user's intent.
A trustworthy analytics flow therefore needs both a semantic contract and an execution receipt. The contract defines the business meaning. The receipt records the actual computation. Testing only one leaves either ambiguity or implementation drift unobserved. The 5,121 was the second kind. Plenty of production incidents are the first.