cd /news/ai-agents/field-note-what-your-openai-agent-se… · home › topics › ai-agents › article
[ARTICLE · art-182576] src=dev.to ↗ pub= topic=ai-agents verified=true sentiment=· neutral

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

A developer testing the OpenAI Agents SDK (0.26.0) found that when an MCP tool call fails, the SDK by default does not halt the run but instead feeds the model the generic message "An error occurred while running the tool." Using a fault-injected refund tool over MCP and a scripted model that retries on failure, the testbench showed the model has no way to know whether the side effect committed, so safety must come from idempotent tool design (one refund per order) rather than from the error message. The testbench and example are released as open source under MIT and run locally without an API key.

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 playbook: Designing agent systems
by read2 min views6 publishedDec 5, 2026

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.

── more in #ai-agents 4 stories · sorted by recency
── more on @openai 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/field-note-what-your…] indexed:0 read:2min 2026-12-05 · —