Python for AIAdvanced26 July 2026
A Python AI application calls an external model API that occasionally fails with temporary server errors. What is the most reliable handling strategy?
Pick an answer to see the explanation.
Answer
Use limited retries with exponential backoff, timeouts, logging, and a clear fallback
Temporary API failures should be handled with controlled retries, exponential backoff, request timeouts, logging, and a fallback or user-friendly error. Unlimited retries can overload the service and make failures worse.
Learn more: Explore AI automation with Python →