{
  "id": 23694685,
  "title": "Field note: what your OpenAI agent sees when a tool call fails",
  "url": "https://urgent.news/2026/12/05/field-note-what-your-openai-agent-sees-when-a-tool-call-fails",
  "topic": "ai",
  "section": "AI",
  "published": "2026-12-05T20:31:32.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/ravi07/field-note-what-your-openai-agent-sees-when-a-tool-call-fails-1fio"
  },
  "original_language": null,
  "account": "When a tool call fails during an OpenAI agent's operation, the OpenAI Agents SDK (version 0.26.0) does not immediately stop the run. Instead, it turns the failure into the tool's output, and the model receives a message stating, \"An error occurred while running the tool.\" This message does not indicate whether the request reached the server or if the refund was committed. The SDK's default behavior leaves the exception out of the model's context, preventing internal details from leaking into the model's decision-making process.\n\nTo illustrate this, the author set up a testbench with a fake refund tool over MCP, a fault injected on purpose, and a local database that tracks the actual number of refunds. When the OpenAI Agents SDK's default error handler is used, the agent retries the tool call even after a failure, leading to two refunds for every order in the author's test run. This occurs because the agent has limited information to decide whether to retry or not, as the error message is generic and does not reveal whether the refund was successfully completed.\n\nHowever, when an idempotency key specific to each refund and order is used, the agent only performs one refund per order, regardless of the number of retries. This demonstrates that the key factor in avoiding double refunds is the usage of an idempotency key, which must be derived from the intended operation, not the attempt number. Additionally, enforcing the key at the service level (payment provider, database, or system making the refund) is crucial, rather than relying on the agent's failure_error_function.\n\nThe author concludes by emphasizing that hiding exception details from the model is a sensible default, and the SDK cannot determine the truth from the error message. The agent's decision to retry, give up, or report \"done\" is an educated guess in every case, and the responsibility of ensuring safe retries should lie with the system enforcing the idempotency key.",
  "summary": "A refund tool times out after the refund went through. Here's what the OpenAI Agents SDK tells the model, and why that decides whether your customer is refunded twice. In my last field note I showed that when a tool call breaks, the agent often can't tell whether the action happened: the same error comes back whether the refund went through or not. This time I wanted to know what one popular…",
  "summary_source": "publisher",
  "key_points": [
    "OpenAI Agents SDK (v0.26.0) treats tool call failures as tool outputs",
    "Default error handler leads to repeated tool calls and double refunds",
    "Idempotency key prevents double refunds by ensuring one operation per order"
  ],
  "editors_take": null,
  "opinion": false,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "outlets_capped": false,
    "also_reported_by": []
  },
  "machine_translated": false,
  "ai_generated": true,
  "disclaimer": "Accounts, briefs, key points, the editor’s take and translations are written by software from other outlets’ reporting and may contain errors. A summary whose summary_source is \"publisher\" is the outlet’s own feed text. Always check the linked original."
}