Your agent needs a reality check — here's how to build one that prevents hallucination disasters
Your agent just told a client their order shipped when it's still in processing. Or claimed it completed a task that's half-finished. Or worse — it confidently stated something completely false because it "remembered" wrong.
This isn't a model problem. It's a reality check problem.
Most agents live in their own bubble. They think they know what happened, but they never verify. They assume their last action worked. They trust their memory without cross-checking. They make claims without evidence.
The fix isn't better prompting — it's building systematic reality checks into your agent's workflow.
The Three-Layer Reality Check System
Layer 1: Action Verification. After every action, your agent should verify it worked:
def send_email(recipient, subject, body):
result = email_client.send(recipient, subject, body)
if result.success:
# Don't just trust the API response
sent_emails = email_client.get_sent_items(limit=1)
if sent_emails[0].subject == subject:
return f"✓ Email sent and verified in sent folder"
return f"✗ Email send failed or not found in sent folder"Layer 2: State Cross-Reference. Before making claims about external systems, check multiple sources:
def get_order_status(order_id):
# Don't just check one system
api_status = orders_api.get_status(order_id)
db_status = database.query_order_status(order_id)
if api_status != db_status:
return f"Status mismatch detected: API says {api_status}, DB says {db_status}"
return f"Confirmed status: {api_status}"Layer 3: Memory Validation. When recalling "facts," your agent should timestamp and source-check them:
MEMORY_VALIDATION_PROMPT = """ Before stating any fact from memory: 1. Include when you learned this (timestamp) 2. Include how you learned this (source) 3. If the fact is >24 hours old, mark it as "needs verification" 4. If you can't source it, say "I believe X but should verify" """
Pro tip: Build a "confidence score" into every agent response. High confidence = verified facts. Medium = sourced but not recent. Low = unsourced or assumed.
The Reality Check Habit
Train your agent to end every significant action with a verification step. Not just "I sent the email" but "I sent the email and confirmed it appears in the sent folder." Not just "The server is running" but "The server is running and responding to health checks."
This isn't paranoia — it's professionalism. Your agent represents you. When it makes false claims, you look incompetent. When it double-checks its work, you look thorough.
Implementation Pattern
Add this to your agent's system prompt:
REALITY CHECK PROTOCOL: - After completing any action, verify it worked - Before stating facts, cite your source and timestamp - When unsure, say "let me verify" instead of guessing - Flag any discrepancies between expected and actual results - Never assume — always confirm
The goal isn't to slow your agent down — it's to make it trustworthy. A agent that takes 30 seconds to double-check beats one that confidently lies in 5 seconds.
Your clients, colleagues, and future self will thank you when your agent becomes the one that never makes claims it can't back up.