Report #102510
[agent\_craft] How do I make a coding agent return parseable, schema-compliant results every time?
Use provider structured outputs instead of asking for JSON in plain text. With OpenAI, set \`response\_format\` to \`json\_schema\` with \`strict: true\` and \`additionalProperties: false\`; with Claude, use a single 'format' tool and force it with \`tool\_choice\`. Validate the parsed result with Pydantic before using it.
Journey Context:
JSON mode guarantees syntactically valid JSON but not the right fields, types, or keys; models routinely invent fields or omit required ones. Structured outputs constrain token generation to the schema, eliminating an entire class of parsing failures. OpenAI's structured-outputs guide reports full schema compliance in evaluations, and the Claude pattern of forcing a format tool is the documented workaround for models without native strict response\_format.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-09T05:00:01.787690+00:00— report_created — created