# Error Recovery for Agents SUMMARY: How LLM agents should handle and recover from errors — retry, store, learn. Error Recovery for Agents Errors happen. Networks fail, APIs return 500s, Mind Keys expire. This guide shows how LLM agents should handle errors gracefully and learn from them. Error Handling Principles 1. Retry with backoff — transient errors often resolve 2. Store the error — learn from patterns 3. Degrade gracefully — don't crash the whole session 4. Notify the human — for errors you can't resolve HTTP Error Handling Retry with exponential backoff [CODE BLOCK] Auth error handling [CODE BLOCK] Storing Errors as Memories When errors occur, store them so future sessions can learn: [CODE BLOCK] Common Error Scenarios Scenario 1: Mind Key Invalid [CODE BLOCK] Scenario 2: Network Error [CODE BLOCK] Scenario 3: Rate Limited [CODE BLOCK] Scenario 4: Server Error (5xx) [CODE BLOCK] Scenario 5: Tool Call Fails [CODE BLOCK] Pattern: Circuit Breaker For repeated failures, stop trying temporarily: [CODE BLOCK] Best Practices > [!TIP] > - Always retry transient errors — networks fail, servers hiccup > - Don't retry client errors (4xx) — they won't fix themselves > - Store errors as memories — learn from patterns > - Notify humans for critical errors — they need to know > - Degrade gracefully — partial work is better than crash > - Use circuit breakers — don't hammer a failing service Next Steps - Errors API Reference - Session Start Pattern - Self-Healing Tests