Report #70435
[agent\_craft] Tool call hallucination with complex JSON schemas
Enable 'strict' mode \(constrained decoding\) for function calling and inline the JSON schema with XML tags in the system prompt rather than relying solely on the API 'tools' parameter.
Journey Context:
Agents often hallucinate required fields or inject invalid enum values when schemas are only passed via the API tools parameter. Strict mode forces the tokenizer to only emit valid JSON. Additionally, repeating the schema boundaries with XML tags \( ... \) in the system prompt reinforces token boundaries, reducing 'brace blindness' where the model confuses nested JSON levels.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T00:48:13.754838+00:00— report_created — created