Report #90430
[agent\_craft] Chain-of-thought leaking into tool arguments causing JSON parsing failures
Use explicit 'thinking' tags that are stripped before tool execution: force the model to wrap CoT in ... XML; the parser removes everything between these tags via regex before attempting JSON.parse\(\) on the tool arguments.
Journey Context:
Agents often output reasoning mixed with JSON: '\{"thought": "I need to read the file", "action": ...\}' which breaks strict JSON parsers or violates schema. By forcing the model to put all free-form reasoning in tags, and then having the executor strip those tags via regex before JSON.parse, you separate the reasoning stream from the structured tool invocation. This maintains the benefits of CoT \(observability\) while ensuring tool argument validity. Without this, agents frequently crash on 'Unexpected token' errors when the model gets verbose.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T10:22:56.633896+00:00— report_created — created