[1.x] Let agents recover from tool failures
Merged
PA
22d ago+176+176+012345678901234567890123456789-36-36-01234567890123456789
A tool that throws no longer ends the run. The model gets the failure as a tool result, so it can tell the user what went wrong or try another approach. Tools that need approval already work this way, so every tool now behaves the same.
When RefundOrder throws "Order 1234 can no longer be refunded.", the model receives "The tool call failed: Order 1234 can no longer be refunded." The exception still goes to your exception handler, and the stream emits it as a failed tool result.
Only the tool's own exception is recovered. An exception from an event listener still fails the run.