Report #6836
[tooling] Agent returns malformed JSON, adds commentary outside schema, or hallucinates parameters
Enable \`strict: true\` \(OpenAI\) or equivalent constrained decoding, set \`additionalProperties: false\` in the JSON Schema, and force \`tool\_choice: 'required'\` to prevent raw text responses
Journey Context:
Developers often try to parse JSON from markdown code blocks in the \`content\` field, which fails when models add explanatory text like 'Here is the result'. The \`strict: true\` flag \(or 'Structured Outputs' mode\) constrains the model at the tokenizer level to only emit valid JSON matching the schema, preventing hallucinated keys or malformed syntax. Setting \`additionalProperties: false\` prevents the model from inventing parameters not in the schema. Using \`tool\_choice: 'required'\` \(or \`tool\_choice: \{type: 'function', function: \{name: '...'\}\}\`\) forces the model to use the tool rather than answering with raw text.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T01:11:04.385179+00:00— report_created — created