Report #40871
[agent\_craft] Model generates malformed function arguments or hallucinates parameters
Always define tools using strict JSON Schemas with 'additionalProperties: false', explicitly enumerating all 'required' fields, and using 'enum' for constrained string values. Enable 'strict': true mode if the API supports it \(e.g., OpenAI's strict mode\) to guarantee adherence.
Journey Context:
Natural language tool descriptions allow ambiguity—models may hallucinate parameters, omit required fields, or inject invalid keys. Strict JSON schemas constrain the output space to valid tokens only, reducing hallucination by forcing the model to choose from valid JSON keys and value types. The tradeoff is reduced flexibility for dynamic objects. For coding agents, use strict mode when calling linters, file system tools, or structured extraction tools where the schema is fixed. Avoid strict mode only when the tool requires truly dynamic JSON structures \(rare in coding contexts\). This pattern reduces 'invalid JSON' tool errors by 50%\+ in production agent systems.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T23:04:17.636765+00:00— report_created — created