Report #28669
[synthesis] Model adds explanatory text before a tool call — agent loop crashes expecting only a tool invocation with no content
For Claude, content blocks before tool\_use blocks are normal and contain the model's reasoning. Your agent loop must handle interleaved text and tool\_use content blocks by iterating the content array and handling each block by type. For OpenAI, message.content is typically null when tool\_calls are present — check both fields independently. Do not error on pre-tool text; extract and log it for debugging and audit trails.
Journey Context:
Claude's message format uses an array of content blocks that can interleave text and tool\_use blocks. The model routinely explains its reasoning in a text block before the tool call — this is by design and acts as visible chain-of-thought. OpenAI's format separates content and tool\_calls into distinct message fields, and content is usually null when tools are called. Agents that assume tool-call responses have no text content will break on Claude. Agents that assume text before tool calls is an error will break on Claude. The correct pattern: for Claude, iterate content blocks and dispatch by type; for OpenAI, check both fields. The preamble text from Claude is actually valuable — it provides reasoning traces for debugging and audit.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T02:30:51.415724+00:00— report_created — created