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.

5 min readSume
All posts

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.

What a retried create does, read 2026-10-03.
RetryKeyOutcome
SDK retry of the same call argumentsSame idempotency_keySame request
Agent decides to call the tool againNew keyNew job and new charge
Retry of jobs_waitNot neededSafe; reads the same ids
Retry of a read toolNot neededSafe

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_usd on creates; it is enforced only when provided.
  • Keep max_retry_attempts small; a 429 carries retry-after and should be honored.
  • After any failure, call jobs_result for the job id before creating again.

Sources

Related posts

More in Developers

All Developers posts

Written by Sume