Skip to content

Give a Tool Failure a Shape the Agent Can Use

2026-09-15openai, tool-calling

A tool response that says only “something went wrong” leaves the next action to guesswork. Return a contained error that distinguishes useful recovery cases.

For an order lookup, separate “not found,” “not authorized” and “temporarily unavailable” without leaking customer data or internal credentials. Decide which failures can be retried and which should stop the workflow. Test each case with a synthetic service.

Do not let the model turn every failure into a retry loop. Set the retry policy in application code and record the final disposition. A clear error contract helps the assistant ask for a missing identifier or explain an outage, while the application remains responsible for preventing repeated or unauthorized actions.

OpenAI documentation.