Report #6684
[agent\_craft] Tool argument parsing fails because reasoning text leaks into JSON fields
Strictly separate chain-of-thought from tool calls: place reasoning in the assistant message content, and ensure tool 'arguments' field contains only valid, parseable JSON with no markdown or explanatory text
Journey Context:
When agents use chain-of-thought \(CoT\) reasoning before tool calls, the model often continues the reasoning style into the tool arguments field, producing invalid JSON like \{"query": "I should search for... so the query is 'foo'"\}. This causes parsing failures. The fix is architectural: enforce that the assistant's message content contains all reasoning \(the CoT\), while the tool\_call.arguments must be strictly machine-readable JSON with no natural language, achieved via prompt engineering and validation loops that strip non-JSON content.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T00:42:44.394643+00:00— report_created — created