Back to full roadmap
topiccore
Tool Error Handling
Tools fail — retry, fallback, graceful degradation, teach the model from errors.
3 hours1 resources1 prereqs
Layered strategy:
- Transient errors (timeout, 503): retry at code level (exponential backoff, max 3).
- Permanent errors (404, 403): return a clear error to the model — "City 'XYZ' not found in DB. Try a valid city name or use search_city first."
- Schema validation errors: "Parameter
daysmust be 1-30, got -1" — model can correct its wrong parameter. - Fallback tools: if
search_v1fails, trysearch_v2. - Capability degradation: if a critical tool is down, send a graceful user message ("I can't search right now — could you check X manually?").
Pro tip: make error messages educational so the model learns from them. Replace "Error 500" with "Tool internal error. Retry in 30 seconds or use alternative tool X."