Report #59192
[frontier] Agent produces output that passes JSON schema but fails semantic validation downstream
Use validation as the primary control flow mechanism: validate outputs against Pydantic models with custom validators, and automatically retry with error feedback when validation fails
Journey Context:
People check if output is valid JSON, but don't validate business logic \(e.g., 'start\_date must be before end\_date'\). The pattern is to treat the LLM as a generator and the validator as a discriminator in a loop. Using libraries like Instructor or Pydantic AI, you define strict models; when validation fails, the error message is fed back to the LLM as context for a retry. This shifts from 'hope it works' to 'guaranteed correct by construction'.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T05:50:32.681207+00:00— report_created — created