Retrying resubmits a failed request after a temporary failure, limiting the number of additional attempts. It suits network glitches, temporary service unavailability, server problems, and rate limiting, but not persistent problems such as an exceeded API quota. section 8.2.2
Use retries with these boundaries:
- Configure maxRetries on streamText, generateText, streamUI, and related functions. section 8.2.2
- Treat HTTP 429 responses as retryable because rate limits are usually temporary and time-based. section 8.2.2
- Keep retries separate from fallback models when a provider remains unavailable. section 8.2.2
Retry a generated response
const response = await streamText({ model: supportedModel, prompt: "Generate a summary of the latest news.", maxRetries: 3, }); The SDK retries retryable failures up to the configured limit before ultimately failing. section 8.2.2
const response = await streamText({
model: supportedModel,
prompt: "Generate a summary of the latest news.",
maxRetries: 3, // Retry up to 3 times on failure
});
Inspect the runnable maxRetries configuration for an AI SDK request. section 8.2.2




















