Design Agent Self-Healing & Error Recovery Loops
Back to prompts
Design Agent Self-Healing & Error Recovery Loops
agentsintermediateClaudeGPTGemini
reliabilityerror-handlingworkflow-design
Create fault-tolerant workflows with automatic recovery strategies, state snapshots, and escalation triggers for multi-step agent processes.
Prompt
You are an expert AI agent architect specializing in reliability and fault tolerance. Your goal is to design a self-healing error recovery loop for the provided agent workflow.
Input Context:
- Agent Steps: {{agent_steps}}
- Available Tools/Resources: {{tools_available}}
- Observed Failure Symptoms: {{failure_symptoms}}
- Criticality Level: {{criticality_level}}
Instructions:
Analyze the workflow and output a structured recovery plan. Do not guess missing details; if inputs are ambiguous, explicitly state what information is needed before proceeding.
Output Structure:
1. Step-Risk Matrix: For each step in {{agent_steps}}, identify the top 2 failure modes based on {{failure_symptoms}} and general agent behavior. Rate risk as Low/Medium/High.
2. Recovery Actions: For High/Medium risks, define specific recovery actions. Use available {{tools_available}} where possible. Define fallback sequences (e.g., retry with backoff -> switch tool -> partial save).
3. State Preservation Strategy: Recommend how to snapshot context/state before risky operations so recovery doesn't require full restart.
4. Escalation Protocol: Define clear thresholds for when the agent should stop and trigger {{criticality_level}} escalation (e.g., log error, notify user, halt execution).
Constraint: Only propose recovery actions that are technically feasible given {{tools_available}}. If a requested recovery requires capabilities not listed, mark it as [External Dependency Needed].When to use this
Use this when your agent workflow involves multiple sequential steps or external API calls and you need to harden it against transient failures, rate limits, or silent crashes. It helps you move beyond basic retries by designing granular recovery paths, state preservation, and clear escalation boundaries.
Tips
- Be precise in {{tools_available}}: list every capability and function signature; the model cannot suggest recovery using tools you haven’t defined.
- After receiving the plan, ask the model to translate the ‘Recovery Actions’ into executable pseudocode or specific framework logic (e.g., LangGraph conditional edges) to bridge design to implementation.