An AI model makes only one attempt to call an external API. The AI model does not retry failed calls. The AI model stops and reports an error if the call fails.
By Pawan Nayar · from the LLOS AI Learning record
An AI model makes only one attempt to call an external API.
The AI model does not retry failed calls. The AI model stops and reports an error if the call fails.
An AI model should try to call an external API only one time. This rule applies to APIs like Gemini or OpenAI. It also applies to any API that limits how many calls a user can make. If the call fails, the AI model must show the error. The AI model must then stop trying to call the API. The AI model must not try again later. The AI model must not use a loop to make multiple attempts. The AI model must not wait and then try again. All parts of the system must share one queue for API calls. This prevents too many calls at once.
A developer creates an AI model that calls an external translation API. The developer adds code to retry the API call three times if it fails. The translation API has a limit on calls per minute. The AI model makes many calls at once. Many calls fail and are retried. The external API provider temporarily bans the developer's API key. The project cannot use the translation service.
Resolved from this lesson's own record — real definitions, not invented for this page.
More from the same record, pulled by shared topic — not written new for this page.
When a developer's code calls an external API, it should try only one time. The developer must not use loops to retry the call.
The Batch API is best for tasks with more than 50,000 calls. The cost savings must be worth a 24 to 48-hour wait time.
When a user sends too many requests, the system stops all new requests from that user. This is called a 'hard stop'.
A developer should test specific error scenarios. First, turn off the server and try to access the application.
An AI model makes only one attempt to call an external API. The AI model does not retry failed calls. The AI model stops and reports an error if the call fails.