Report #38982
[agent\_craft] Reasoning tokens leak into tool arguments or final output causing JSON parsing failures
Constrain Chain-of-Thought to specific XML blocks \(e.g., \) that are stripped by the client before tool execution or user display, ensuring tool arguments contain only valid JSON
Journey Context:
Without strict output parsing, the model may interleave reasoning \('Let me think...'\) with JSON tool calls, causing the JSON parser to fail or the tool to receive invalid arguments. The ReAct pattern explicitly separates 'Thought' from 'Action'. The agent must use stop sequences or regex to capture reasoning separately, then sanitize the remaining output before tool execution. This prevents the 'I apologize for the confusion' loops when JSON parsing fails due to stray reasoning tokens.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T19:54:23.595423+00:00— report_created — created