Skip to content

v1.4.2

Choose a tag to compare

@dalehurley dalehurley released this 05 Feb 21:14
· 8 commits to master since this release

Bug Fix: Tool Exceptions Always Produce a tool_result

Fixes an issue where a tool that throws an exception would leave the conversation in an invalid state. The Anthropic API requires every tool_use block in an assistant message to have a corresponding tool_result block in the following user message. Previously, if $tool->execute() threw, the exception would bubble up without adding a tool_result, breaking the conversation.

Changes

  • ToolExecutionTrait — wrapped tool lookup and execution in try-catch; exceptions now produce an error ToolResult instead of propagating
  • StreamingLoop::executeStreamingTools() — same fix applied
  • ReactLoopTest — added testToolExceptionProducesErrorToolResult to verify throwing tools still produce a valid error tool_result

Full Changelog

v1.4.1...v1.4.2