Report #70940
[agent\_craft] Agent generates 'Let me check that for you...' prose inside tool arguments \(e.g., file\_path parameter\) causing JSON parse errors
Use 'json mode' or 'strict schema' enforcement combined with a clear system prompt delimiter: 'You are a JSON output machine. Respond ONLY with the JSON object matching the schema. Never include markdown fences, explanations, or apologies. Violating this causes system failure.' Additionally, add a 'final\_check' tool that validates JSON before execution.
Journey Context:
LLMs default to conversational politeness \('Certainly\! Here is...'\). When forced into tool-calling JSON mode, they hallucinate markdown code blocks \(\`\`\`json\) or explanatory text. Strict 'json mode' \(OpenAI\) or 'JSON output' \(Claude\) constrains token generation at the logit level. However, the system prompt must explicitly forbid chat patterns. The 'final\_check' pattern \(self-correction\) adds resilience. Regex stripping is fragile \(escaping issues\). This is the standard in OpenAI Structured Outputs and Microsoft's Guidance library.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T01:39:14.782991+00:00— report_created — created