PyCon JP 2026

Retry Is Not a Strategy: Classifying and Recovering from AI Agent Failures in Python

Building an agent pipeline for a client, things kept breaking in ways I couldn't explain, wrong tools called, silent loops, results contradicting the agent's own output. Every framework I tried responded the same: retry from scratch or give up. No concept of why it failed.

That gap is what triage solves. It classifies agent failures by inspecting the recorded trajectory and returns one of 9 typed causes, WRONG_TOOL_CALLED, LOOP_DETECTED, SCHEMA_MISMATCH, EXTERNAL_FAULT, and more, then routes each to the right recovery: retry, replan, rollback to a checkpoint, or escalate to a human.

Attendees leave with a failure taxonomy they can apply immediately and a library they can drop into any async Python agent with a single wrapper.

Tell us about your own experience with this topic

I'm the author of triage, a framework-agnostic Python library for classifying and recovering from AI agent failures. I built it after hitting unexplainable agent failures across multiple client projects working with LangChain, CrewAI, and raw OpenAI loops. The failure taxonomy came from patterns I kept encountering firsthand, not from a spec. The library ships with adapters for LangGraph and LangChain, a benchmark harness, and a feedback module for tracking misclassifications.

What discussions can you have with attendees through this talk?

How are they currently handling agent failures, custom retry logic, swallowed exceptions, or just restarting? I want to hear whether the 9-type taxonomy matches failures others have hit in production, or if there are modes I've missed. For those building agents seriously, I'd love to debate where the classification line should sit, rules-based vs. LLM-based, and what "good enough" recovery actually looks like in real projects.

The speaker's profile picture
Cyrus Mante

Cyrus Mante is an AI Software Developer at Cambridge University Press & Assessment, where he designs and builds Generative AI solutions to streamline workflows, automate repetitive processes, and improve operational efficiency at scale. He works as part of the AI Centre of Excellence, collaborating with cross-functional teams to deliver secure, production-ready AI systems.

Outside of his day-to-day work, Cyrus enjoys supporting the tech ecosystem through volunteering, community leadership, and speaking engagements, regularly sharing practical insights on AI and modern software development at local and international events.