Search the documentation
50 pages for retries.
Titles and paths first, then pages whose text carries it. Each row opens that page as this site last read it. Cut at 50, so a narrower query shows the rest.
PDF Processing
Claude Developer Platform · in the page
agents-and-tools/agent-skills/best-practices
…r timeout accounts for slow connections REQUEST_TIMEOUT = 30 # Three retries balances reliability vs speed # Most intermittent failures resolve by the second retry MAX_RETRIES = 3 ``` **Bad example:…
computer-use-tool
Claude Developer Platform · in the page
agents-and-tools/tool-use/computer-use-tool
…ut tokens than disabling thinking entirely (fewer mistakes mean fewer retries), making it a strong option for cost-sensitive loops. </Tip> ### Augmenting computer use with other tools To add other t…
handle-tool-calls
Claude Developer Platform · in the page
agents-and-tools/tool-use/handle-tool-calls
…"> Let the SDK manage the `tool_use` loop, result formatting, and retries for you. </Card> <Card title="Define tools" icon="hammer" href="https://platform.claude.com/docs/en/agents-and-tools/…
Process results programmatically
Claude Developer Platform · in the page
agents-and-tools/tool-use/programmatic-tool-calling
…laude's running code. Claude sees the error in `stderr` and typically retries the call: ```json { "type": "code_execution_tool_result", "tool_use_id": "srvtoolu_abc123", "content": { "type"…
Log at info level
Claude Developer Platform · in the page
agents-and-tools/tool-use/tool-runner
…the next request goes out with your state. The following example retries a truncated response with a larger `max_tokens` budget. ```typescript const runner = client.beta.messages.toolRun…
Events
Claude Developer Platform · in the page
api/beta/sessions/events
…` The model is currently overloaded. Emitted after automatic retries are exhausted. - `type: "model_overloaded_error"` - `message: string` Human-readable error de…
List Events
Claude Developer Platform · in the page
api/beta/sessions/events/list
…` The model is currently overloaded. Emitted after automatic retries are exhausted. - `type: "model_overloaded_error"` - `message: string` Human-readable error de…
Stream Events
Claude Developer Platform · in the page
api/beta/sessions/events/stream
…` The model is currently overloaded. Emitted after automatic retries are exhausted. - `type: "model_overloaded_error"` - `message: string` Human-readable error de…
Threads
Claude Developer Platform · in the page
api/beta/sessions/threads
…` The model is currently overloaded. Emitted after automatic retries are exhausted. - `type: "model_overloaded_error"` - `message: string` Human-readable error de…
Events
Claude Developer Platform · in the page
api/beta/sessions/threads/events
…` The model is currently overloaded. Emitted after automatic retries are exhausted. - `type: "model_overloaded_error"` - `message: string` Human-readable error de…
List Session Thread Events
Claude Developer Platform · in the page
api/beta/sessions/threads/events/list
…` The model is currently overloaded. Emitted after automatic retries are exhausted. - `type: "model_overloaded_error"` - `message: string` Human-readable error de…
Stream Session Thread Events
Claude Developer Platform · in the page
api/beta/sessions/threads/events/stream
…` The model is currently overloaded. Emitted after automatic retries are exhausted. - `type: "model_overloaded_error"` - `message: string` Human-readable error de…
routines-fire
Claude Developer Platform · in the page
api/claude-code/routines-fire
…eates a new session. There is no idempotency key. If a webhook caller retries, the endpoint creates multiple sessions. ## Rate limits Routine runs count against a per-account daily allowance that va…
errors
Claude Developer Platform · in the page
api/errors
…`retry-after` header when present. Each SDK client accepts a maximum-retries option to configure or disable this behavior. When receiving a [streaming](https://platform.claude.com/docs/en/build-with…
rate-limits
Claude Developer Platform · in the page
api/rate-limits
…has no `retry-after` header. Retrying, including the SDKs' automatic retries, fails until access resumes. * On the Messages API, `error.details.error_code` is `enforced_spend_limit_reached`. Use it t…
Message Batches API
Claude Developer Platform · in the page
build-with-claude/batch-processing
…stream the .jsonl results it # points to. For per-result handling (retries, validation errors), # use the SDK examples in the other tabs. RESULTS_URL=$(curl -s "https://api.anthropic.com/v1/mes…
fallback-credit
Claude Developer Platform · in the page
build-with-claude/fallback-credit
…ry model's cache was already warm. ## When a retry is rejected Most retries redeem on the first attempt. When one does not, the API returns a 400 error that tells you what to try next. <Steps> <S…
fast-mode
Claude Developer Platform · in the page
build-with-claude/fast-mode
…ttps://platform.claude.com/docs/en/manage-claude/usage-cost-api). ## Retries and fallback ### Automatic retries When fast mode rate limits are exceeded, the API returns a `429` error with a `retry-…
handling-stop-reasons
Claude Developer Platform · in the page
build-with-claude/handling-stop-reasons
…"> Let the SDK manage the `tool_use` loop, result formatting, and retries for you. </Card> <Card title="Streaming messages" icon="lightning" href="https://platform.claude.com/docs/en/build-wi…
preserved-thinking
Claude Developer Platform · in the page
build-with-claude/preserved-thinking
…**Don't hide the 400.** If your code catches it, strips thinking, and retries on the caller's behalf, log that it did: their history is still edited, and the model loses its earlier reasoning on every…
claude-prompting-best-practices
Claude Developer Platform · in the page
build-with-claude/prompt-engineering/claude-prompting-best-practices
…ly match complex schemas when told to, especially if implemented with retries. For classification tasks, use either tools with an enum field containing your valid labels or structured outputs. </Accor…
refusals-and-fallback
Claude Developer Platform · in the page
build-with-claude/refusals-and-fallback
…n beta on the Claude API: set `fallbacks` to `"default"`, and the API retries a declined request on the fallback model Anthropic recommends for its refusal category. For categories with no recommended…
skills-guide
Claude Developer Platform · in the page
build-with-claude/skills-guide
…er", "content": "Generate and process a large sample dataset"}] max_retries = 10 response = client.messages.create( model="claude-opus-5-5", max_tokens=4096, container={…
structured-outputs
Claude Developer Platform · in the page
build-with-claude/structured-outputs
…onsistent data types * Schema violations requiring error handling and retries Structured outputs guarantee schema-compliant responses through constrained decoding: * **Always valid:** No more `JSON.…
middleware
Claude Developer Platform · in the page
cli-sdks-libraries/middleware
…ed. Use middleware for cross-cutting concerns such as logging, custom retries, request annotation, and refusal fallback handling. ```mermaid sequenceDiagram autonumber participant App as Your…
overview
Claude Developer Platform · in the page
cli-sdks-libraries/overview
…diomatic interfaces, type safety, and built-in support for streaming, retries, and error handling. * **Libraries and integrations:** Packages and compatibility layers that expose Claude inside another…
csharp
Claude Developer Platform · in the page
cli-sdks-libraries/sdks/csharp
…response. * `AnthropicException`: Base class for all exceptions. ## Retries The SDK automatically retries 2 times by default, with a short exponential backoff between requests. Only the following…
go
Claude Developer Platform · in the page
cli-sdks-libraries/sdks/go
…rt fails, you might receive `*url.Error` wrapping `*net.OpError`. ## Retries Certain errors will be automatically retried 2 times by default, with a short exponential backoff. The SDK retries by def…
java
Claude Developer Platform · in the page
cli-sdks-libraries/sdks/java
…optionsBuilder.baseUrl("https://example.com"); optionsBuilder.maxRetries(42); }); ``` The `withOptions()` method does not affect the original client or service. ## Async usage The default clie…
php
Claude Developer Platform · in the page
cli-sdks-libraries/sdks/php
…| | Network error | `APIConnectionException` | ## Retries Certain errors are automatically retried two times by default, with a short exponential backoff. Connection errors (for…
For Amazon Bedrock support
Claude Developer Platform · in the page
cli-sdks-libraries/sdks/python
…`_` prefix properties, methods, and modules are private. </Note> ## Retries Certain errors are automatically retried 2 times by default, with a short exponential backoff. Connection errors (for exa…
Automatically handles tool execution loop
Claude Developer Platform · in the page
cli-sdks-libraries/sdks/ruby
…ror` | | Network error | `APIConnectionError` | ## Retries Certain errors will be automatically retried 2 times by default, with a short exponential backoff. Connection errors (fo…
typescript
Claude Developer Platform · in the page
cli-sdks-libraries/sdks/typescript
…ole.log(message._request_id); // req_018EeWyXxfu5pfWkrYcMdjWG ``` ## Retries Certain errors are automatically retried 2 times by default, with a short exponential backoff. Connection errors (for exa…
compliance-errors
Claude Developer Platform · in the page
manage-claude/compliance-errors
…is header automatically. If you use a generic HTTP retry library that retries on every 5xx, suppress retries when `x-should-retry` is `false`; retrying this error fails identically on every attempt.…
inference-hooks-endpoint
Claude Developer Platform · in the page
manage-claude/inference-hooks-endpoint
…xchange: connection, TLS handshake, request, and response. Anthropic retries exactly once, after a 100ms delay, and only when the connection attempt fails. The retry shares the same timeout budget an…
spawn.sh: called once per claimed work item
Claude Developer Platform · in the page
managed-agents/self-hosted-sandboxes
…the session's work is queued again and the next worker that claims it retries the mount. | ## Serve custom tools from your s…
webhooks
Claude Developer Platform · in the page
managed-agents/webhooks
…ject directly with a `GET` call. This avoids delivering stale data on retries and keeps every delivery small. ## Supported event types <Tabs> <Tab title="Session events"> Some of these events…
Or, for the Project Glasswing model with the same capabilities:
Claude Developer Platform · in the page
models/fable-5-1/migration-guide
…fault"` (beta, `server-side-fallback-2026-07-01` header). `"default"` retries a declined request on the model Anthropic recommends for that category. The permitted fallback targets for Claude Fable 5.…
whats-new-fable-5-1
Claude Developer Platform · in the page
models/fable-5-1/whats-new-fable-5-1
…ient-side-fallback), or your own retry. `fallbacks: "default"` (beta) retries a declined request on the model Anthropic recommends for that category. The permitted fallback targets for Claude Fable 5.…
handle-streaming-refusals
Claude Developer Platform · in the page
test-and-evaluate/strengthen-guardrails/handle-streaming-refusals
…surfacing a refusal to the user * **Redeem fallback credit on manual retries:** If you build the retry yourself, pass the refusal's [fallback credit](https://platform.claude.com/docs/en/build-with-cl…
How the agent loop works
Claude Code CLI · in the page
agent-sdk/agent-loop
…| No | | `error_max_structured_output_retries` | No valid structured output was produced within the configured retry limit: every attempt failed validation, or a model…
Agent SDK reference - Python
Claude Code CLI · in the page
agent-sdk/python
…env={ "API_TIMEOUT_MS": "120000", "CLAUDE_CODE_MAX_RETRIES": "2", "CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS": "120000", }, ) ``` * `API_TIMEOUT_MS`: per-request timeout on t…
Quickstart
Claude Code CLI · in the page
agent-sdk/quickstart
…DK handles the orchestration, tool execution, context management, and retries, so you consume the stream. The loop ends when Claude finishes the task or hits an error. The message handling inside the…
Persist sessions to external storage
Claude Code CLI · in the page
agent-sdk/session-storage
…n. ### Mirror writes are best-effort If `append()` rejects, the SDK retries the batch up to two more times with a short backoff, for at most three attempts in total. A call that times out isn't retr…
Get structured output from agents
Claude Code CLI · in the page
agent-sdk/structured-outputs
…yielding an error result, such as // error_max_structured_output_retries; see the Error handling section. console.error(`Session ended with an error: ${error}`); } ``` ```python Python…
Agent SDK reference - TypeScript
Claude Code CLI · in the page
agent-sdk/typescript
…...process.env, API_TIMEOUT_MS: "120000", CLAUDE_CODE_MAX_RETRIES: "2", CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS: "120000", }, }, }); ``` * `API_TIMEOUT_MS`: per-request timeout on…
Orchestrate teams of Claude Code sessions
Claude Code CLI · in the page
agent-teams
…process teammate that is waiting to retry a failed API request, so it retries immediately instead of waiting for the full retry delay. The lead can stop early too, deciding the team is finished befor…
Manage multiple agents with agent view
Claude Code CLI · in the page
agent-view
…ull request doesn't need to exist yet when Claude pushes: Claude Code retries the branch lookup after up to five later `git`, `gh`, `glab`, or `curl` commands run in the same directory, so a pull requ…
Claude Code on Amazon Bedrock
Claude Code CLI · in the page
amazon-bedrock
…d on their timestamp or when the API returns a credential error, then retries the request with refreshed credentials. * **`awsCredentialExport`**: runs at session start and on each credential reload,…
Authentication
Claude Code CLI · in the page
authentication
…208, helper failures surfaced as a generic 401 after about ten silent retries. `apiKeyHelper`, `ANTHROPIC_API_KEY`, and `ANTHROPIC_AUTH_TOKEN` apply to the CLI and the surfaces that wrap it, includin…