Skip to content

Lesson 6 of 9 · 6 min read

Rate Limits, Retries and Backoff Inside a Loop

Model calls fail in three families: rate limits and overloads (retry after waiting), transient network or server errors (retry with backoff and jitter) and client errors (do not retry; fix the request). A model call is safe to retry because it has no side effect, which is what makes it different from a tool call. The retry budget belongs to the run, not the call, because an agent that retries each of forty steps three times has multiplied a hiccup into a two-minute stall. Honour Retry-After, use full jitter so a fleet does not retry in step, keep a token bucket in front of the provider so you stop hitting the limit, open a circuit when a dependency is down, and when retries are exhausted end the step with a reason the harness records rather than a stack trace the model reads.

Premium lessonReviewed By the AIAgentInterviews editorial team
Get full Premium access · $25

All 19 topics with every worked answer, all lessons and courses, the full practice bank, and anything new that appears during your access.

6 months · One payment · No auto-renewal

Practise it as an interviewer asks it

Course lessons that teach this

Related lessons