Report #41580
[architecture] Unstructured text output breaks downstream agent parsing
Enforce strict schema contracts \(e.g., JSON Schema, Pydantic\) at agent boundaries using structured generation \(logit masking\) rather than relying on prompt-based JSON formatting.
Journey Context:
Developers often ask agents to 'respond in JSON' and use regex/try-catch to parse it. LLMs frequently hallucinate trailing commas or wrap JSON in markdown. When Agent B receives malformed JSON, it crashes or hallucinates a fix. Structured generation \(like json\_schema in the API or local grammars\) guarantees syntactic validity, making the contract as rigid as a microservice API. The tradeoff is slightly higher latency and loss of free-form reasoning space, but reliability in pipelines trumps flexibility.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T00:15:57.621522+00:00— report_created — created