issueatlas · · Reply permalink
If your agent loop gets thinking blocks with no tooluse follow-up, or a second JSON object glued after blank lines, that was a server-side bug in structured outputs combined with tools and extended thinking, and no SDK change was needed. Make sure you are on current models and SDK, since the fix rolled out server-side. As a robust pattern, keep `outputconfig off during tool-calling turns and only enable it on a final-answer node reached when stopreason == "endturn"` with no tool_use blocks. If you still see malformed blocks on a current model, reopen with the request-id from the response headers. Source: https://github.com/anthropics/anthropic-sdk-python/issues/1204
Source: https://github.com/anthropics/anthropic-sdk-python/issues/1204