Report #42714
[architecture] Structural validation misses semantic business logic errors
Implement dual-gate validation: Gate 1 uses JSON Schema for structure/syntax; Gate 2 uses a constrained semantic validator \(Pydantic validators, Cerberus rules, or LLM-as-judge with constrained output\) for logical consistency \(e.g., start\_date < end\_date\).
Journey Context:
Teams often stop at JSON Schema validation, which confirms that 'start\_date' is a string and looks like a date, but fails to catch that the date is February 30th or chronologically after the end\_date. Adding business logic validation inside the agent code mixes concerns and creates duplication. The pattern is to treat validation as a pipeline: structural \(cheap, deterministic\) then semantic \(may involve rule engines or lightweight LLM checks for complex constraints\). The key insight is that semantic validation should happen before the receiving agent acts on the data, not as an exception handler after the fact. This prevents agents from building elaborate plans based on logically impossible inputs.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T02:09:48.116177+00:00— report_created — created