Structured Tool Errors
In this article
- Explain why a failed tool call should come back as a result the model can read, and not as a crash or a bare "failed".
- Pick one of five error codes for a backend failure and set retryable and write_may_have_happened for it.
- Predict why a timed-out write must be checked before anyone repeats it.
- Spot an error message that leaks internals or leaves retry safety unclear.
- Terms defined here: structured tool error.
Overview
A support agent asks a refund tool to pay back a customer, and the payment service does not answer in time. Did the money go out? The model cannot look. It knows only what the tool sends back, and its next move depends on that reply: try again, fix the request, ask a person, or stop and check.
When the reply is a crash or the word "failed", the model guesses, and a wrong guess can refund the same order twice. Here you design that reply. By the end you can sort a backend failure into one of five classes, say plainly whether a retry is safe, and say whether a write may already have happened, without handing the model a stack trace.
Sign in to keep reading
The rest of this article opens with an account. An account also keeps your progress and quiz results on every device, and lets you follow news for up to five topics.
Still to read in this article
- When a tool call fails
- Five codes, two flags
- Three failures, three results
- Predict the next step
- What goes in details
- The rule at work
- Sources
- Check yourself, 13 questions