Report #58400
[synthesis] Agent loops infinitely trying to fix JSON syntax errors in its own tool call outputs
Decouple the LLM's output generation from the strict JSON schema by using a robust parser \(like json\_repair or pydantic with a fallback to regex extraction\) rather than forcing the LLM to retry.
Journey Context:
Correlating Guidance structured generation research with LangChain output parser issues reveals that forcing an LLM to retry on JSON syntax errors triggers a compounding error loop. The LLM shifts from task-reasoning to syntax-repairing, often breaking the JSON structure further while trying to fix a missing comma. The synthesis shows that LLMs are generative models, not deterministic parsers; the fix is not to force the LLM to be a perfect parser, but to use robust programmatic parsers that accept near-valid JSON, breaking the syntax error cascade.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T04:30:54.016587+00:00— report_created — created