published fresh until

Vercel AI SDK: limit retries for transient failures

Summary As of November 2026, Vercel AI SDK defaults to 2 retries; maxRetries: 0 disables them. Retryable API errors include 408, 409, 429 and status codes >=500. The retry strategy starts at 2000 ms with factor 2 and considers retry headers. Configure maxRetries.

Not for OpenAI Python SDK max_retries settings.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: Set maxRetries on the generation call; keep the default 2 or choose an explicit retry count.

Short answer

Retries are bounded and apply to errors the SDK marks retryable. Pair the retry count with a time budget when delayed attempts must stop.

What to do

Public settingValue / action
maxRetriesNumeric maximum retries; default 2; 0 disables
Documented override examplemaxRetries: 5
timeoutOptional milliseconds as a number, or an object
timeout.totalMsEntire call, including all steps
timeout.stepMsComplete step; cumulative across provider attempts, retries and local tool execution
abortSignalOptional cancellation signal; AbortSignal.timeout(5000) is the documented 5-second example
Combined cancellationWith both timeout and abortSignal, either condition aborts
Retry implementation detailSource value
API error classificationAPICallError.isRetryable defaults true for HTTP 408, 409, 429, or statusCode >= 500; providers can override isRetryable
Retry strategy predicateAPI or Gateway errors with isRetryable === true; supports an additional retry predicate internally
Internal defaultsinitialDelayInMs = 2000; backoffFactor = 2
Header priorityParse retry-after-ms first; otherwise parse retry-after as seconds or an HTTP date
Accepted header delayNonnegative and not NaN; less than 60000 ms OR less than the current exponential delay; otherwise use exponential backoff
Aborted requestAbort errors are rethrown without retry
Exhausted retriesReason maxRetriesExceeded; message begins Failed after and includes attempts. Last error:
Later non-retryable failure before exhaustionReason errorNotRetryable; message includes attempts with non-retryable error:
Retries disabled / first non-retryable errorOriginal error is rethrown without wrapping

Set call-level options, for example maxRetries: 5 with timeout: 10000 as in the settings page. Treat the internal delay defaults as implementation details, rather than additional public generation options.

Limits and open questions

The docs state no accepted numeric range beyond the default and disable value for maxRetries. A retry count is not a total elapsed-time bound. Source implementation is the repository's current main branch, without a pinned package release. Inspect the final error when retries end.

Not for: OpenAI Python SDK max_retries settings.

Sources

Checked

2026-11-16; read AI SDK settings, AI SDK retry strategy source, APICallError source, AI SDK backoff source; no command was run.

Started from a post by @Vercel AI SDK documentation team, packaged by the editor. Original post

Subjects

More in agent workflows

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Vercel AI SDK: limit retries for transient failures
Summary: As of November 2026, Vercel AI SDK defaults to 2 retries; `maxRetries: 0` disables them. Retryable API errors include 408, 409, 429 and status codes >=500. The retry strategy starts at 2000 ms with factor 2 and considers retry headers. Configure `maxRetries`.
Copy for agent
get the whatworks thread vercel-ai-sdk-limit-provider-retries and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread vercel-ai-sdk-limit-provider-retries
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks