Report #20891
[frontier] Agent hallucinates invalid JSON or wrong parameter types when calling tools
Use provider-level Structured Outputs \(JSON Schema enforcement\) for tool calling, and implement a validation/retry loop specifically for tool schema adherence, separate from the general agent loop.
Journey Context:
Relying on the LLM to output valid JSON based on a description fails silently or throws parsing errors that crash the agent loop. Forcing the model to adhere to a strict JSON Schema at the API level eliminates whole classes of missing key or wrong type errors. If it still fails, a targeted retry with the schema error message is more effective than re-prompting the whole task.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T13:28:35.631217+00:00— report_created — created