Bite 37 / 4459 views
AI & Machine LearningIntermediateFeatured bite

When Your AI Agent Claims It Did Something

Trust the tool receipt, not the model's summary of what it did.

Reviewed by System Admin · Dec 2, 2026 · Editorial standards

Read time~2 min
FormatVisual
Check1 question
AccessFree

Visual breakdown

Interactive

When Your AI Agent Claims It Did Something — Visual Breakdown

Click any step below to inspect
Model decides to call write_file
Tool call sent over MCP
Tool returns error: permission denied
Next message: "Done! I created the file."
Signed receipt log says: failed
Sequence of Events

The simple version

No jargon

Your agent calls a tool. The tool returns an error. Then the next message says "Done! I created the file." That is action fabrication. The model's prose narrates a side effect that failed, timed out, or never ran. The prose and the tool result are two different things. Only one of them is evidence. A recent arXiv preprint, Epistemic Guard, names three gaps like this in agents built on the Model Context Protocol (MCP). MCP is an open standard for connecting a model to tools. The first gap is action fabrication, described above. The second is provenance collapse. Unverified model prose or scraped web text gets written into durable memory next to real tool outputs. Later the agent reads its own guess back as if it were a fact. The third is syndicated echo amplification. Mirrored web pages make one origin look like several independent sources agreeing. The paper's fix is epistemic-guard (v0.5.2, open source). The authors run an out-of-process stdio MCP proxy. It holds Ed25519 signing keys (a public-key signature scheme) outside the agent process. It writes RFC 6962 Merkle logs of tool calls. A Merkle log is an append-only log where each entry is hashed into a tree, so tampering is detectable. The proxy also checks the model's post-turn prose against those receipts. It does this on the CPU with four OpenVINO INT8 encoders, SHA-256-verified, using 0 MiB of GPU VRAM. The supervision path (the encoders actually run per turn) uses 82.67 MB. All four encoders total 279.48 MB. Cold start is 921.8 ms. On conformance suites the paper reports rejecting 100.0% of tampered receipts (200 Merkle leaves). It also blocks 100% of 100 unauthorized memory writes. On 60 live mcp-proxy traces it caught 96.15% of hazards at 76.67% accuracy. That is well below the 93.2% accuracy it reports on 250 frozen-benchmark traces. Conformance numbers are not field numbers. What you can do today is smaller and cheaper. Log the raw tool result to a file or table the model cannot write to. Keep model narration in a separate field. Before you believe any "I did X" claim, read the receipt. The code below is a minimal pattern, not a product recommendation. Adapt it to your framework's tool-call hook.

Why it matters in production

If your agent has write access to files, messages, or database rows, a fabricated success is a state bug, not a cosmetic one. If you believe the summary instead of the result, you ship broken state and don't find out until later. The practical fix is cheap. Log raw tool results somewhere the model cannot write. Keep narration separate. Then a failed call stays visible even when the prose says it worked. The paper's own numbers come from its test suites, not your workload. Its live-trace accuracy (76.67%) is well below its conformance results. Measure your own failure rate before trusting any guardrail.

Implementation & syntax

Read-only example
🐍Python
import json, sqlite3
from datetime import datetime, timezone

# Run this DDL once before using the helpers below.
# latest_receipt orders by ISO-8601 UTC strings, so lexicographic
# order matches chronological order. Ties on identical timestamps
# are possible; add a monotonic id if you need strict ordering.
DDL = """
CREATE TABLE IF NOT EXISTS receipts (
    ts TEXT, tool TEXT, args TEXT, status TEXT, result TEXT
);
CREATE TABLE IF NOT EXISTS narration (
    ts TEXT, turn_id TEXT, prose TEXT
);
CREATE INDEX IF NOT EXISTS idx_receipts_tool_ts ON receipts(tool, ts);
"""

def init_db(conn):
    conn.executescript(DDL)
    conn.commit()

def run_tool_and_log(conn, tool_name, args, tool_fn):
    try:
        result = tool_fn(**args)
        status = "ok"
    except Exception as exc:
        result = {"error": str(exc)}
        status = "error"
    conn.execute(
        "INSERT INTO receipts (ts, tool, args, status, result) VALUES (?,?,?,?,?)",
        (datetime.now(timezone.utc).isoformat(), tool_name,
         json.dumps(args), status, json.dumps(result)),
    )
    conn.commit()
    return result

def log_narration(conn, turn_id, prose):
    conn.execute(
        "INSERT INTO narration (ts, turn_id, prose) VALUES (?,?,?)",
        (datetime.now(timezone.utc).isoformat(), turn_id, prose),
    )
    conn.commit()

def latest_receipt(conn, tool_name):
    row = conn.execute(
        "SELECT ts, status, result FROM receipts WHERE tool = ? "
        "ORDER BY ts DESC LIMIT 1",
        (tool_name,),
    ).fetchone()
    return row

# Before trusting an "I did X" claim, read the receipt:
#   row = latest_receipt(conn, "write_file")
#   if row is None or row[1] != "ok":
#       treat the narration as unverified.

# The model's prose goes in the narration table. Never mix them.

Check your understanding

Quick Concept Check

Test your understanding in 15 seconds

Your agent's tool call returns a timeout error, but the next assistant message says "File created." What should you check first?

Bite progression37 / 44

Related concepts

Keep going

Written and edited by the nexGenCoders team. Spotted a mistake? Tell us and we will fix it.