Report #101294
[frontier] Agent outputs are inconsistent JSON, forcing fragile parsing and post-processing retries
Make structured output / constrained decoding the default for any programmatic consumption of LLM responses. Define Pydantic schemas, use provider-native structured output modes, and use libraries like Instructor or Pydantic AI for cross-provider abstraction with validation and retries. For self-hosted models, use Outlines or XGrammar for grammar-based constrained decoding.
Journey Context:
Thoughtworks moved structured output from Assess \(Oct 2024\) to Trial \(Nov 2025\) to Adopt \(Apr 2026\) based on production success. The insight is that unconstrained text is acceptable for chat but unreliable for agent-to-system interfaces. Native structured output modes vary in JSON Schema support, so an abstraction layer pays off. Constrained decoding applies finite-state machines to logits and guarantees valid output where prompt-based JSON can still fail. Common mistakes to avoid: overly complex schemas, missing additionalProperties:false, putting reasoning fields after answer fields, and ignoring refusal responses that bypass the schema.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-06T05:18:53.418162+00:00— report_created — created