OpenAI Agents SDK max_retry_attempts and Sume paid calls
The OpenAI Agents SDK can retry MCP list_tools and call_tool. A retried Sume create must repeat its idempotency_key or you pay twice; set max_spend_usd too.

Retries are a good default for a flaky network and a dangerous one for a billed call. The OpenAI Agents SDK MCP page says max_retry_attempts and retry_backoff_seconds_base apply to list_tools and call_tool, read 2026-10-03. If a call reaches Sume but the response is lost, the SDK may send the same call again.
Why the idempotency key decides the outcome
Sume's tools and gates page says idempotency_key is required on paid and write tools. A retry that carries the same key is the same request, not a second charge. A retry with a freshly generated key is a new one. The danger is a wrapper that builds a key inside the call path, so every attempt gets a different value.
The SDK's retry replays the arguments it was given, so a key chosen once in the model's arguments is reused by a transport retry. A model that decides to call again on its own can still pick a new key, so tell it in the instructions to reuse the first one, and do not let it create a second job for the same request.
| Retry | Key | Outcome |
|---|---|---|
| SDK retry of the same call arguments | Same idempotency_key | Same request |
| Agent decides to call the tool again | New key | New job and new charge |
Retry of jobs_wait | Not needed | Safe; reads the same ids |
| Retry of a read tool | Not needed | Safe |
Other settings on the page worth knowing
The page documents require_approval for confirming tool calls, failure_error_function for turning failures into model-visible text, and MCPServerManager, which has drop_failed_servers=True and strict=True defaults with lifecycle timeouts of 10 seconds. With drop_failed_servers, a server that fails to connect is dropped instead of failing the run, so check that the Sume tools are actually present before an agent plans around them.
A safe setup
- Require approval for create tools, or leave them off the agent.
- Choose one idempotency key per request, outside the retry loop.
- Send
max_spend_usdon creates; it is enforced only when provided. - Keep
max_retry_attemptssmall; a 429 carriesretry-afterand should be honored. - After any failure, call
jobs_resultfor the job id before creating again.
Sources
Related posts
More in Developers
- Move OpenAI GPT Image 2.5 calls to Sume: field-by-field mapping
Which OpenAI gpt-image-2.5 parameters carry over to Sume's POST /v1/images, which change name, and which return 400 unsupported_parameter.
- OpenAI transcription 25 MB limit: how many minutes of wav fit?
OpenAI caps transcription uploads at 25 MB. A 16 kHz mono wav fills that in about 13 minutes, so detach long videos to mp3 or ranges first.
- openapi-typescript on the Sume OpenAPI JSON: types only, one command
npx openapi-typescript takes a URL or file and writes a .d.ts. Generate Sume job and error types from the 3.0.3 spec with no runtime code in your bundle.
- Orval react-query client from the Sume OpenAPI JSON, tags-split
Point Orval at api.sume.com/reference/json with client react-query and mode tags-split for typed hooks per Sume tag. Config, caveats and polling tips.
Written by Sume