Report #72086
[agent\_craft] Chain-of-thought reasoning leaking into tool arguments or final output causing parsing failures
Enforce structured reasoning by requiring the model to wrap all internal monologue in specific XML tags \(e.g., \) or route reasoning through a dedicated 'analyze' tool call, stripping these blocks before parsing final outputs
Journey Context:
Developers often add 'think step by step' to the user message, but this leaves reasoning ambiguously mixed with final answers. For agents that parse tool calls via regex or JSON, freeform CoT causes false positives \(e.g., JSON inside thinking text being matched\). The robust pattern is system-prompt mandated XML tags that are deterministically stripped. Alternative is a 'think' tool, but that adds an extra API call latency. XML wrapping is the sweet spot for latency and reliability.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T03:34:49.312881+00:00— report_created — created