How to Stop an AI Agent From Inventing Data
A Relevance AI agent that returns wrong data confidently is worse than one that fails, because nobody checks a result that looks complete. The cause is almost always the same: a tool returned nothing, and the agent filled the gap.
This guide is about closing that gap. It assumes you already have a working agent and are now looking at outputs you do not trust.
Why do agents fill empty results with invented data?
The model’s job is to produce a complete answer. When a tool returns an empty object or a 404, the model has two options: report the gap, or produce something that satisfies the output format. Without instruction, it prefers the second.
You can see it in the step trace. The scrape tool returns nothing, and the next step writes “Industry: SaaS” anyway. The model inferred from the company name. That inference is a guess dressed as a fact.
The fix is not “tell it not to hallucinate” — that instruction is too vague to act on. It is making empty results a first-class case the agent must handle explicitly.
How do you make null a required output value?
Redefine what a valid answer looks like. Instead of “find the industry”, the instruction becomes:
Industry must be one of the values returned by the search tool, quoted with its source URL. If the tool returns no industry, output exactly NULL. Do not infer industry from the company name, domain extension or description.
“Output exactly NULL” is the operative phrase. It gives the model a permitted way to be incomplete, which removes the pressure to invent. Agents given a null option use it, and every NULL is a row you can send to a human.
How do you verify a tool result before the agent uses it?
Add a validation step between the tool call and the write. In Relevance AI this is a second small tool or a conditional edge that checks the result is non-empty and matches an expected shape.
Practical checks:
- Non-empty response body.
- Contains the field you asked for, not a generic page.
- Value inside a plausible range — employee count cannot be 0 or 4,000,000.
If validation fails, route to a fallback: write NULL, flag the row, notify a channel. The agent stops guessing because guessing is no longer on the path.
What do conflict rules change?
When two sources disagree, the default agent behaviour is to average them or pick the first. Both are wrong for facts. An explicit rule turns a silent error into a visible one.
If two sources report different employee counts, write both values as “A (n) / B (n)” and set confidence to LOW. Never reconcile them without a third source.
That single sentence removes the most common fabricated number in lead enrichment. The rule generalises: whenever a fact has more than one source, tell the agent what to do when they differ.
How do you find where the fabrication happens?
Run twenty real inputs and read every step trace, not just the outputs. Count three things per run: tool calls that returned empty, outputs written after an empty result, and outputs where the model inferred rather than retrieved.
That third count is your real error rate. A typical unpatched lead-enrichment agent infers on 15–30% of rows where the data was missing. After the NULL rule and validation step, it usually drops under 5%, and the remaining rows land in a review queue instead of a CRM.
Tune the step limit alongside this. Generous limits give the agent more chances to retry a failed tool and then guess when it keeps failing.
Who needs this discipline, and who can skip it?
Any agent writing to a system of record — CRM, billing, analytics — needs all five fixes. Errors there get compounded by everything downstream.
Agents that only draft text for a human to edit need less. The reviewer catches the invented number, so a NULL rule is usually enough. And if you are still prototyping with five test inputs, none of this applies yet — get the happy path working first.
Quick Summary
- Agents invent data because empty tool results give them no permitted way to be incomplete.
- Define NULL as a valid output value and forbid inference from names, domains or descriptions.
- Validate tool results before writing; route failures to a review queue, not to a guess.
- Require conflicting sources to be reported side by side rather than reconciled.
- Unpatched lead enrichment infers on 15–30% of missing rows; the NULL rule typically cuts that under 5%.
