Skip to content
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:

  1. Transient errors (timeout, 503): retry at code level (exponential backoff, max 3).
  2. 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."
  3. Schema validation errors: "Parameter days must be 1-30, got -1" — model can correct its wrong parameter.
  4. Fallback tools: if search_v1 fails, try search_v2.
  5. 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."

Prerequisites

Resources(1)