Cookbook
Recovering from tool failures with precedent memory
When a tool call fails, Cadreen classifies the failure, fixes the arguments, and retries. After a few successes, it stores the fix as a precedent for future failures.
1
How recovery works
Cadreen classifies failures into categories and applies the right recovery strategy. This happens automatically — you don't need to implement retry logic.
Recovery pipeline
Choose a step to see what happens there.
2
Failure classification
Cadreen classifies failures using LLM inference, not string matching. The classification determines the recovery strategy.
connector_failureTry alternative approachTimeout → try different connector
auth_failureSkip same-credential methods401 → don't retry with same key
permission_failureFind broader scope403 → try path with more permissions
capability_failureTry different path404 → try alternative connector
rate_limit_failureWait and retry429 → exponential backoff
data_failureFix the input422 → model fixes arguments
3
See it in action
> Create an invoice for $500 for Acme Corp
Let me create that invoice for you.
[Calling create_invoice... Error: invalid address format]
I noticed the address format needs adjustment. Let me fix that.
[Calling create_invoice... Success]
Invoice created: inv_abc123 for $500.
Acme Corp will receive it shortly.The user sees the final result. The intelligence trace records both the failure and the recovery.
4
Precedent memory
After 3 similar successful recoveries, Cadreen stores the fix as a precedent. Future failures of the same type use the stored solution — faster and more reliable.
Precedents are stored as knowledge items in the semantic memory. They persist across sessions and are shared across all surfaces.
Next: How to turn any REST API into a governed AI tool — upload an OpenAPI spec, get governed tools.