tools / tool_failure.py

Failure classification taxonomy. Decides whether a failed tool should retry, replan, or self-correct.

Classes

ClassPatterns (regex)Agent action
RETRYABLEtimeout · rate-limit · connection reset · 502/503/504Retry with exponential backoff up to MAX_RETRIES = 3.
FATALpermission denied · access denied · tool not found · MANDATORY · invalid param · auth error · 401/403Mark FAILED; trigger replan; do not retry.
DIAGNOSTICAssertionError · RuntimeError · SyntaxError · Traceback · FileNotFoundError · ImportError · EXIT CODE: [1-9]Inject the full error into context for LLM self-correction.
UNKNOWNnone of the aboveInject a short error notice.

Retry delay

delay = min(base · 2^attempt, 30s)
delay += 0.25 · delay · random()   # jitter

Per-tool hints

_FALLBACK_HINTS attaches a tool-specific suggestion when a known signature fires: