Error Handling in Tools

Build resilient AI agents through robust error handling and graceful degradation

Categorizing Errors: The First Step

Not all errors are equal. A network timeout should be retried. A 404 Not Found should not. The key to effective error handling is identifying what type of error occurred and responding appropriately.

Interactive: Error Category Explorer

Click categories to understand different error types and how to handle them

Temporary failures that may succeed if retried
Should Retry
Common Examples:
Network timeout
Service temporarily unavailable
Connection reset
Rate limit (temporary)
How to Handle:
Retry with exponential backoff

Quick Decision Tree

Ask these questions to categorize any error

Will retrying help?
✅ Yes:
Transient or Recoverable
❌ No:
Permanent or Validation
Is it a temporary issue?
✅ Yes:
Transient → Retry with backoff
❌ No:
Check if recoverable
Can you use an alternative?
✅ Yes:
Recoverable → Use fallback
❌ No:
Permanent → Return error

How to Recognize Each Category

Transient: HTTP 5xx, timeouts, "try again"
Look for: 503, 504, ETIMEDOUT, connection errors
Permanent: HTTP 4xx (except 429), "not found"
Look for: 400, 404, 410, authentication failures
Validation: "invalid", "required", "format"
Look for: missing fields, type errors, constraint violations
Recoverable: "degraded", "unavailable", "partial"
Look for: service degradation, fallback available signals