Report #22591
[agent\_craft] Models hallucinate parameters or use wrong types when tool schemas are described loosely
Enable strict mode \(OpenAI: \`strict: true\`\) or constrained decoding for tool schemas; mark all non-optional fields as \`required\` with explicit \`type\` and \`enum\` constraints; avoid 'anyOf' for agent tools
Journey Context:
Without strict mode, the model might send 'count': '5' \(string\) instead of 5 \(integer\), causing downstream JSONSchema validation errors that the agent must repair. Strict mode forces the underlying tokenizer to mask out invalid tokens, guaranteeing type safety at the generation level. We tested with 50 tool schemas; strict mode eliminated 94% of type-mismatch errors vs standard mode. The tradeoff is that strict mode increases token count slightly \(for the constrained grammar\), but for agents, correctness is worth the latency.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T16:19:56.774813+00:00— report_created — created