Return errors as tool results the model can read, not crashes or raw stack traces: say what failed, why, and what to try (valid ranges, missing fields, next step).
Separate protocol-level problems (unknown tool name, malformed request) from tool execution failures (rate limited, not found, no permission).
Distinguish retryable errors (timeouts, rate limits) from permanent ones (bad arguments, forbidden), cap retries, and classify before acting: retry, replan, stop or escalate.
Loading…