Learn Agentic Patterns
CoursesInterviewSchoolVideosAI agent videosAI now
Learn Agentic Patterns

Learn agentic AI, then get interviewed on it. A free course, four job paths, a daily broken agent, and the interview.

learnagenticpatterns.com

Navigation

HomeThe courseThe interviewPatterns (developer track)PM trackBlogCareer GuideAboutSign Up

Connect

Cheat sheet (free PDF)Reskilling guideLinkedIn (Mousa Jawaheri)

© 2026 learnagenticpatterns.com

Privacy PolicyTerms of Service

Based on “Agentic Design Patterns” by Antonio Gullí

> All Patterns

[01]Prompt Chaining[02]Routing[03]Parallelization[04]Reflection[05]Tool Use[06]Planning[07]Multi-Agent Collaboration[08]Memory Management[09]Learning & Adaptation[10]State Management (MCP)[11]Goal Setting & Monitoring[12]Exception Handling & Recovery[13]Human-in-the-Loop[14]Knowledge Retrieval (RAG)[15]Inter-Agent Communication (A2A)[16]Resource-Aware Optimization[17]Reasoning Techniques[18]Guardrails & Safety[19]Evaluation & Monitoring[20]Prioritization[21]Exploration & Discovery[22]Boundary Translation
HomeCurriculumException Handling & Recovery
Pattern [12]

Exception Handling & Recovery

≈ Try-Catch Blocks / Circuit Breaker Pattern / Retry-Exponential Backoff

[12]

TL;DR

Strategies for agents to detect failures (e.g., API errors, hallucinations, logic loops) and self-correct or retry using alternative strategies. Allows the system to be resilient in the face of uncertainty.

SWE: Try-Catch / Circuit Breaker
Architecture Flow
agentgate
Primary API CallagentError DetectorgateFallback AgentagentCircuit Breakergate

> Agentic Definition

Strategies for agents to detect failures (e.g., API errors, hallucinations, logic loops) and self-correct or retry using alternative strategies. This allows the system to be resilient in the face of uncertainty.

Before: Deterministic Error Handling

Deterministic Error Handling
1try:
2 api.call()
3except TimeoutError:
4 time.sleep(2)
5 api.call() # Retry exact same logic

After: Agentic Recovery

Agentic Recovery
1response = tool.call()
2
3if "error" in response:
4 # Agent reflects on error and pivots strategy
5 plan_b = agent.think(
6 "Tool A failed with error. This path is blocked. "
7 "I should try searching Wikipedia instead to get the data."
8 )
9 plan_b.execute()

Traditional SWE

Try-Catch / Circuit Breaker

≈maps to

Agentic Pattern

Exception Handling & Recovery

≈How They're Similar

Preventing system crash upon encountering an error.

≠Key Divergence

Agentic recovery is semantic. If a tool fails (e.g., "API Error 500"), the agent can reason about why and try a different tool (e.g., "Google Search failed, I will try Wikipedia") or rephrase the query. It is dynamic problem solving, not just retrying the same operation.

> Production Considerations

01

Without this, agents are brittle toys. Real-world APIs fail; agents must navigate these failures autonomously.

02

Ensure error recovery doesn't spiral into an infinite retry loop of different failed strategies.

💡

Key Takeaway

Adapt: Error handling is now a creative problem-solving process. You don't just catch the error; you empower the agent to find a workaround.

BuildBuild a Resilient Data Pipeline. Create an agent pipeline that fetches data from an API, processes it, and can recover gracefully when the API fails — by trying alternative sources instead of just retrying.

Frequently Asked Questions

When should I use the Exception Handling & Recovery pattern?

Strategies for agents to detect failures (e.g., API errors, hallucinations, logic loops) and self-correct or retry using alternative strategies. This allows the system to be resilient in the face of uncertainty.

How does Exception Handling & Recovery relate to Try-Catch Blocks / Circuit Breaker Pattern / Retry-Exponential Backoff?

Preventing system crash upon encountering an error. However, there is a key divergence: Agentic recovery is semantic. If a tool fails (e.g., "API Error 500"), the agent can reason about why and try a different tool (e.g., "Google Search failed, I will try Wikipedia") or rephrase the query. It is dynamic problem solving, not just retrying the same operation.

What are the production trade-offs of Exception Handling & Recovery?

Without this, agents are brittle toys. Real-world APIs fail; agents must navigate these failures autonomously. Ensure error recovery doesn't spiral into an infinite retry loop of different failed strategies.

Next Pattern

[13] · Human-in-the-Loop