Report #58662
[synthesis] Agent generates invalid tool parameters when schema uses anyOf/oneOf \(union types\) because it cannot disambiguate between object variants
Replace union types with explicit discriminator fields \(tagged unions\) or separate tool definitions; never use raw anyOf for complex objects in agent-facing schemas.
Journey Context:
Schema defines input as anyOf\[ObjectA, ObjectB\]. Agent sees fields from both, mixes them, generates invalid JSON that validates against neither. Common in OpenAI function calling with complex inputs. Wrong fix: 'better description'. Alternative: strict oneOf with discriminator field 'type': 'A' vs 'B', or separate tools entirely. Why right: LLMs struggle with exclusive disjunction in structured generation. They tend to hedge by including fields from both options. Discriminators force explicit choice early in generation, constraining subsequent tokens.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T04:57:12.556509+00:00— report_created — created