17 ways AI agents fail in production. Each one runnable. Each one fixed. Read the series: The Agent Autopsy
This is the open-source companion repo for The Agent Autopsy: 17 Production Disasters, Diagnosed, a written lesson series by Lawrence Jefferson II (Menoko OG).
Most agent courses teach you to build one. This one teaches you what breaks when you do.
If you've shipped an AI agent to production, you already know: the demo works, the prod doesn't. The 17 folders in this repo are the failures we've actually seen, runaway loops that burn tokens overnight, tools that lie silently, agents that fabricate results when they should fail loud.
Every failure here has two files:
broken.py: the bug, runnable, fails the way it does in real systemsfixed.py: the fix, with the lesson in the diff
Read the broken code. Run it. Watch it fail. Then read the fix.
- Runaway Loop: agent calls itself forever
- Stuck Agent: can't recognize it's done
- Confidence Collapse: second-guesses every step
- Tool Hallucination: invents tools that don't exist
- Silent Tool Failure: treats errors as success
- Wrong Tool Pick: search when it should calculate
- Context Collapse: forgets the original goal
- State Drift: state quietly corrupts between steps
- Amnesia Bug: re-does work it already finished
- Prompt Injection via Tool Output: web page hijacks the agent
- Confident Liar: fabricates results instead of failing
- No Human Brake: irreversible action, no checkpoint
- Reasoning-Action Mismatch: says one thing, does another
- Rubber-Stamp Verifier: the checker believes the worker
- Memory Poisoning: a planted fact pays out later
- Silent Degradation: the metric stays green while the model fails
- Limit in the Prompt: a cap that exists only as a sentence
git clone https://github.com/MenokoOG/agent-autopsy.git
cd agent-autopsy
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env # add your API key
# Watch failure #1 break
cd 01-runaway-loop
python broken.py
# See the fix
python fixed.py- Engineers who've built an agent that worked once and never again
- Veteran AI builders who want failure case studies, not framework tours
- Teams putting agents in front of real users and need to know what to harden
Not for total beginners. If you've never written an API call, start elsewhere first.
This repo follows the LAHA principle, Love All Humans Always. Every failure mode here is also a human-impact failure: wasted money, broken trust, decisions taken without consent. Building agents that fail safely isn't an engineering nicety. It's an ethical baseline.
Humans keep final authority over major decisions. Agents earn trust by being auditable, not by being autonomous.
MIT. Use it, fork it, teach from it. Attribution appreciated.
Full written walkthroughs of every failure, with the diagnosis and the diff, are published as The Agent Autopsy series.
Built by Lawrence Jefferson II (Menoko OG), driven by LAHA: Love All Humans Always.
