Report #85931
[agent\_craft] Chain-of-Thought reasoning leaks into final output or tool arguments, causing parsing failures
Isolate the reasoning in explicit XML tags \(e.g., ...\) or a dedicated 'reasoning' tool, and configure the parser to extract only the content outside these tags \(or from the final tool call\) as the final answer.
Journey Context:
When agents use CoT \('think step by step'\), the model often interleaves reasoning with the final answer or tool call, e.g., 'I should call the read\_file tool because... '. This breaks JSON/XML parsers expecting only the tool block. Isolating reasoning in XML delimiters \(Anthropic's recommended pattern\) or a separate 'thinking' tool creates a clean separation. The orchestrator can then strip the thinking blocks before passing to downstream tools, or log them separately. Tradeoff: consumes extra tokens for the tags and the reasoning text, but prevents fragile regex-based extraction of tool calls from freeform text.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T02:49:24.367882+00:00— report_created — created