agentleFS
albertoclementealbertoclemente/agentic-design-patterns-skills/skills/agentic-exception-handling/SKILL.md

agentic-exception-handling

Skill4 starsChanged 5 months agoMITView on GitHub

Makes agents robust to the failures real environments throw at them — tool errors, API failures, network issues, invalid data, timeouts. Combines proactive detection with reactive handling (retry, fallback, graceful degradation) and recovery (revert to a stable state, self-correct, or escalate). Use for any agent deployed where failures are possible and reliability matters.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    No diagnostics/logging to learn from

    line 29

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Exception Handling and Recovery

Agentic Design Pattern 12 of 21 — distilled from Antonio Gulli, Agentic Design Patterns: A Hands-On Guide to Building Intelligent Systems (Ch. 12).

What it is. Anticipate failure points and respond systematically: detect (validate tool outputs, check error codes, use timeouts), handle (log, retry, fall back, degrade gracefully, notify), and recover (diagnose, self-correct the plan, or escalate to a human).

Reach for this when

  • An agent runs in a dynamic, real-world environment
  • It calls fallible tools, APIs, or networks
  • Operational reliability is a key requirement
  • Graceful degradation or controlled failure is needed

Don't reach for this when

  • A prototype/demo where failure is acceptable
  • A failure better surfaced to a human immediately rather than auto-handled

Shape of the solution

Detect failures proactively (validate outputs, check API error codes, set timeouts). Handle them with logging, retries on transient errors, fallbacks, and graceful degradation. For severe cases, recover by reverting to a stable state, self-correcting the plan, or escalating to a human. Often pairs with reflection for retry-after-critique.

Common failure modes

  • Silent failures
  • Infinite retries
  • Swallowing errors with no escalation path
  • No diagnostics/logging to learn from

Composes with

  • agentic-tool-use — the main source of failures
  • agentic-reflection — self-correct before retrying
  • agentic-human-in-the-loop — escalation target
  • agentic-evaluation-monitoring — detect failures and drift

Selection signals live in this skill's description (used for auto-triggering). To choose among all 21 patterns, see agentic-pattern-selector. Conceptual source: Antonio Gulli, Agentic Design Patterns: A Hands-On Guide to Building Intelligent Systems, Ch. 12 — original distillation from the text, not reproduced prose, code, or figures.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.