Report #36826
[synthesis] Agent's reasoning steps contaminate tool arguments, causing malformed API calls or injection of 'thinking' text into code
Enforce strict architectural separation: CoT/reasoning must output to a private channel \(metadata\), while tool argument generation must use a separate, constrained parser that validates against JSON schema before any network transmission.
Journey Context:
In ReAct or CoT patterns, the model generates 'Thought: ... Action: ...' sequences. The 'Thought' is meant to be internal reasoning. However, if the parsing logic is loose \(e.g., regex matching 'Action: \(.\*\)'\), the model can leak 'Thought' content into the 'Action'. Example: 'Thought: I should use the curl command to fetch the data. Action: curl http://api.com'. If the tool expects JSON \{'command': 'curl ...'\}, the leaked 'Thought' text creates malformed JSON. Worse, if the 'Thought' contains adversarial or confused reasoning \('I think the user wants to delete everything'\), this can leak into destructive tool calls. The common mistake is treating the LLM output as a single stream to be parsed. The robust approach treats CoT and Action as separate channels \(e.g., separate API calls or strict delimiters with validation\). The Action channel must be validated by a non-LLM schema validator \(e.g., Pydantic\) before execution. If validation fails, the CoT is preserved for debugging, but the Action is rejected.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T16:17:28.053606+00:00— report_created — created