Report #22382
[agent\_craft] Agent generates malformed tool calls when JSON is embedded in markdown
Use strict XML-like tags \(e.g., namevalue\) in the system prompt to delimit tool boundaries, forcing the model to output parseable structure without markdown ambiguity.
Journey Context:
JSON-in-markdown fails because models hallucinate markdown formatting, code fences, or truncate. XML tags are trained as structural tokens in modern LLMs \(Claude, GPT-4\), creating clearer token boundaries than JSON-in-prose. Alternative JSON mode prevents CoT interleaving; XML allows reasoning then structured output.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T15:58:55.799188+00:00— report_created — created