The AI Agent Invented an Answer: A Hallucination Containment Playbook
Contain false AI agent outputs, trace them to data, memory, or unsupported judgments, then re-ground the agent and verify the fix.
- Time needed
- 45 min
- Steps
- 11
- Level
- Intermediate
The AI Agent Invented an Answer: A Hallucination Containment Playbook
BLUF: When an AI agent states something false with confidence, a product that doesn't exist, a fact from another customer's chat, a judgment it can't actually make, treat it as an incident, not a prompt tweak. Contain first (stop the bad output reaching users), find the source (bad data, blended memory, or a task the model can't do), then re-ground. Every fix we shipped came from one of those three causes.
When this applies
Trigger this playbook when the agent's output is present but wrong in a way that sounds authoritative:
- It names a product, price, policy, or feature that does not exist.
- It answers using details that belong to a different user or an unrelated earlier topic.
- It confidently makes a call it has no basis for (e.g. "your photo looks valid").
- It reveals internal information it should not (team structure, internal numbers, contact details).
If the agent returns nothing or an error, that is an outage, use the generation-outage runbook instead.
Severity & impact
| Signal | Severity | Blast radius |
|---|---|---|
| Invented commitment (price, refund, availability) to a customer | SEV1 | Legal/financial exposure per affected chat |
| Cross-customer data leak (memory blend) | SEV1 | Privacy incident; all users on shared memory |
| Confident wrong judgment routed to a human as "verified" | SEV2 | Bad escalations, wasted human time |
| Over-sharing internal info, no customer harm yet | SEV2 | Trust and disclosure risk |
Roles
- On-call engineer: reproduces the bad output, traces the source, ships the guard.
- Comms lead: for SEV1, coordinates any customer correction and the privacy notification if memory blended.
- Escalation: the agent/prompt owner and, for a data leak, whoever owns the privacy/incident process.
Triage steps
All read-only until you reach Mitigation.
1: Reproduce and freeze the evidence. Pull the exact conversation and the agent's raw output. Note whether the false claim is about data (a product/price), another conversation (memory), or a judgment (something it can't perceive).
2: Rule out bad or missing source data. The most common cause is underspecified data, not a "creative" model. We had a bot invent a non-existent product variant purely because the catalog data was thin; correcting the product data so it reported only the real items fixed it.
- Find the entity the agent invented (product / price / policy).
- Check the source of record: does the real value exist and is it complete?
- Gap or wrong value in the source -> data cause. Mitigation A.
3: Rule out memory blend. If the false detail belongs to another topic or user, per-customer memory is bleeding across contexts. We have seen per-customer memory blend unrelated topics; the fix was to scope memory and re-ask rather than assume.
- Does the wrong detail match an earlier/other conversation?
- Yes -> memory scope cause. Mitigation B.
4: Rule out an impossible task. Check whether the agent was asked to judge something it cannot perceive. We had a bot escalate a damaged-item claim the instant a customer typed "I sent it": the model cannot see whether media is real or relevant, so it should never rule on it.
- Is the claim a judgment about media/state the model can't observe?
- Yes -> capability cause. Mitigation C.
5: Check output discipline. Confirm the model is pinned for determinism and its output contract holds. We set temperature to 0 for consistent automation output, and enforce strict JSON with separate fields so downstream mapping can't invent structure. Drift here amplifies every other cause.
Decision points
- Invented entity that has a source of record → data cause (Mitigation A). Do not tune the prompt first; fix the data.
- Wrong detail traceable to another conversation → memory blend (Mitigation B). Treat as a privacy incident until proven otherwise.
- Confident judgment about unobservable state → capability cause (Mitigation C). No prompt wording makes the model able to see.
- Right facts, malformed/over-shared output → output-discipline cause (temperature, JSON contract, disclosure rules).
Mitigation menu
Ordered least → most invasive.
- A: Data: correct the source of record so only real entities exist; add a rule that the agent answers only from provided data and says it doesn't know otherwise. Re-test the exact flow.
- B: Memory: scope memory to the current topic/customer and have the agent re-ask instead of assuming; audit whether any real cross-customer leak occurred and, if so, open the privacy process.
- C (Capability: remove the impossible judgment from the flow) escalate on the claim and let a human verify out of band. Do not ask the model to assess media it can't perceive.
- D: Output discipline: set temperature to 0, enforce strict JSON with separate fields and safe defaults, and keep internal contact details and structure out of the customer-facing prompt.
- E: Guardrail pass: add an out-of-scope guard and regression-test the agent, using an LLM acting as a simulated customer to probe for the invented answer's return.
Escalate when
- The invented claim is a commitment a customer may act on (price, refund, availability) → SEV1, page the agent owner and loop in comms to correct it.
- A memory blend exposed another customer's data → SEV1 privacy incident; follow the privacy/notification process.
- The same invention reappears after the data/guard fix → escalate; the source of record or retrieval is deeper than one record.
Rollback criteria: if a recent prompt or data change introduced the invention, revert it and re-test before layering new guards.
Verification & recovery
- Re-run the exact conversation that produced the false claim, confirm the agent now answers from real data or declines.
- Run the full set of business flows in fresh chats (no carried context) with explicit pass criteria: correct branch, valid JSON, no banned words, no invented entities.
- For a memory fix, run two unrelated conversations back to back and confirm no detail crosses over.
- Confirm the agent no longer makes the impossible judgment and instead escalates on the claim.
Evidence & comms
Capture: the offending conversation, the raw model output, the source-of-record value, and (for memory) the earlier conversation the detail leaked from.
Comms template:
AI agent: {SEV}, hallucination contained. What: agent stated {false claim}. Cause: {thin data | memory blend | impossible judgment}. Fix: {mitigation}. Customer impact: {none | correction sent}. Guard added: {rule/test}.
Post-incident
Log which of the three causes it was (data, memory, capability) and add a regression case to the simulated-customer test suite so that exact invention is caught automatically. If it was a memory blend that touched real customer data, run the full privacy retro, not just the engineering one.
To harden the agent beyond this incident, work through The AI Security Playbook, which covers prompt injection, agent permissions, approvals and logging.
Keep going
More playbooks
Want it running on your stack?
We implement this playbook for clients, tailored to your stack, your data, and your team's workflow, and handed over documented.