mirror of
https://github.com/hanzoai/python-sdk.git
synced 2026-10-23 20:23:00 +00:00
Fixes critical issue where tool_use blocks could be orphaned without corresponding tool_result blocks, causing Claude API 400 errors: "tool_use ids were found without tool_result blocks immediately after" Changes: - Collect tool results atomically before adding to messages - Add error recovery to append tool_result for any orphaned tool_use blocks - Ensures 1:1 pairing of tool_use and tool_result even on exceptions Location: hanzo_mcp/tools/agent/agent_tool_v1_deprecated.py:449-603