# Field note: what your OpenAI agent sees when a tool call fails

> Source: <https://dev.to/ravi07/field-note-what-your-openai-agent-sees-when-a-tool-call-fails-1fio>
> Published: 2026-12-05 20:31:32+00:00

**Recommendation:** Make tool side effects idempotent and pass a custom failure_error_function to the OpenAI Agents SDK, because its default error message gives the model no way to know whether a failed call committed.
More in the playbook "Designing agent systems": <https://wpnews.pro/playbooks/agent-architecture>

*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 framework does with that moment. I wired the OpenAI Agents SDK to the same testbench: a fake refund tool over MCP, a fault injected on purpose, and a local database that counts how many refunds really happened.

When an MCP tool call fails, for example because the client times out, the OpenAI Agents SDK (0.26.0) does **not** stop the run. By default it turns the failure into the tool's output, and the model reads this:

An error occurred while running the tool.

That's the whole message. It doesn't say whether the request reached the server, whether the refund was committed, or whether a retry is safe. That's deliberate: the SDK's default leaves the exception out, so internal details don't leak into the model's context. (I checked the SDK's source: `default_tool_error_function` returns exactly that sentence, and passing `failure_error_function=None` makes the error raise out of the run instead.)

So the model has to decide what to do with almost no information.

I ran the agent with a scripted model, so there was no API key and the result was the same every time. Its rule was simple: if the tool call fails, call it again. The fault let the refund commit, then held the reply until the client timed out.

`refund-<order_id>`, the same on every attempt, enforced by the refund service): one refund per order, every time.
The scripted model *chooses* to retry, so this shows what that choice leads to. It doesn't measure how often a real model makes it. But "an error occurred, so try again" is a very natural reading of that message.

Hiding exception details from the model is a sensible default, and the SDK can't know whether your tool's side effect happened. The point is where the safety has to live:

A status check before retrying helps, but it's weaker. It can run while the first request is still in flight, and a separate test showed it fails when the agent's own process restarts.

`failure_error_function`, decide what the model should see.
The example and the testbench are open source (MIT) and run locally, with no API key:

```
pip install "agent-crashtest[local]"
crashtest selftest
```

If you run it against your own agent, I'd like to hear what it did.
