Report #80140
[agent\_craft] Agent generates invalid JSON for tool calls when schema is nested
Use "strict": true with structured outputs and include 2-3 examples of correct tool call formatting in the system prompt, specifically showing how to handle nested objects.
Journey Context:
Many agents fail on nested schemas because the model doesn't understand the difference between parameters object and actual arguments. Zero-shot often produces flat JSON when nesting is needed. Few-shot with 2 examples of correct nested structure reduces errors by ~40% based on OpenAI's evals. The "strict" mode is crucial but not well-documented that it requires explicit examples for complex nesting.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T17:06:56.219622+00:00— report_created — created