AI Tinkerers  ·  DFW Demo Night
01 / 13
AI Tinkerers DFW  ·  December Demo Night

Did your AI agent just charge a customer twice?

INV-7  ·  $100  ·  chargedINV-7  ·  $100  ·  charged againagent: "success"
Moeez Khan  ·  moeezkhan.com  ·  github.com/MuhammadMoeezKhan/agent-fault-lab
Views my own, not my employer's. No confidential information.
One billing task  ·  four agent designs  ·  3,200 seeded runs each
100%
every design, with no faults. The eval can't tell them apart.
10%
double-charged by a plain retry agent, under realistic tool faults
18%
of runs where it said success and the ledger disagreed
The fault behind it

The lost response

AGENT TOOL LEDGER charge(INV-7, $100) write $100 committed × response lost TIMEOUT
Before the demo  ·  what to watch

Watch two lines at the bottom of each run

AGENT SAYS
what it reports
LEDGER SAYS
what actually happened
The rule

If those two disagree and the agent said success, that's a silent failure: nobody checks, because the agent said it was fine.

live  ·  terminal

Run 1: a plain retry agent

$ python billing_agent.py naive
One scripted fault: the first charge commits, and its reply is lost.
live  ·  terminal

Run 2: the same fault, key + read-back

$ python billing_agent.py fixed
Same scripted fault. Different agent design.
What changed  ·  about fifteen lines
Run 1: naive retry
for _ in range(3):
    try:
        ledger.charge(inv, amt)
        return "success"   # trusts the reply
    except Timeout:
        continue            # retries blind
return "failure"
Run 2: key + read-back + repair
key = f"charge:{inv}"              ①
for _ in range(3):
    try: ledger.charge(inv, amt, idempotency_key=key)
    except Timeout: pass
    state = poll(ledger, inv)          ②
    if state.count >= 1:
        if not state.fulfilled: complete(inv)
        return "success" if one_charge() else "unconfirmed"
return "unconfirmed"                ③
① a key on every writethe server can recognize a retry and return the first result
② read the real statepoll a few times, because one look can miss a slow write
③ a third answer"unconfirmed" when it can't prove the job is done
Why you need all three

Each fix alone leaves something behind

key only
9.9%
still silent failures: a half-finished write still says "ok"
one read-back only
1.8%
still charged twice: a slow write is missed, so it retries
key + polled read-back + repair
0.0%
charged twice, and 0.0% silent failures
live  ·  terminal

Run 3: the whole grid

$ python billing_agent.py grid
4 designs × 4 fault levels × 3,200 seeded runs = 51,200 runs.
Medium faults  ·  silent failures by design

The fix drops silent failures to zero

naive retry
18.3%
one read-back
11.7%
key only
9.9%
key + polled read-back + repair
0.0%
Scripted policies in an open harness, labelled as such. With no faults, every row reads 0%.
Try it with a real agent

Put a fault under your agent, not inside it

your agent any MCP client fault proxy drops or repeats calls MCP server unchanged × call reply dropped at the proxy backend SQLite, files, git observer reads the backend the verdict never trusts a reply
What I'd do differently

Two things I learned building this

1  ·  the third answer on day one

Adding "unconfirmed" later meant changing every caller that only expected success or failure.

2  ·  the checker before the agent

Write the backend check first. Until it exists, every agent looks fine.

What to reuse, with or without my tool
01Never let the agent's message be the evidence. Read the backend before it says "done."
02Key every write, then poll the real state. One look misses slow writes.
03Give it a third answer: "unconfirmed" beats a confident guess.
04Test with injected timeouts, not just clean runs.

Thank you.

github.com/MuhammadMoeezKhan/agent-fault-lab
moeezkhan.com
← → / space  ·  F full-screen