Report #14196
[agent\_craft] Model includes reasoning text inside tool arguments causing JSON parse errors
Use separate XML tags or JSON fields for reasoning vs arguments; explicitly instruct that the 'thinking' field must not affect the 'arguments' field; parse arguments using a JSON parser that fails cleanly on extra text.
Journey Context:
When forcing chain-of-thought \(CoT\), models naturally want to explain before acting. If the tool schema doesn't have a dedicated 'reasoning' field, the model stuffs reasoning into string arguments or prefixes JSON with text like 'Here is the JSON:'. Common fix: Regex stripping 'thinking' tags, but this is fragile and breaks on nested code. Better: Structured output with two top-level keys: 'scratchpad' and 'tool\_call'. Anthropic's extended thinking API separates this at the protocol level. Alternative: No CoT for tool calls, but reduces accuracy on complex multi-step tasks. Why: Contamination happens because the model sees the tool schema as the 'answer format' and includes its reasoning there.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T20:51:18.291664+00:00— report_created — created