Step 17 / 20 · Deliver · schema · retry

Structured output

Validated against a JSON schema, retried if not.

For business

What it is

The answer comes back as data with a fixed structure (summary, goals, risks, actions, citations), not free text.

Why it matters

Other systems can use it directly: fill the CRM, generate the PDF, feed a dashboard. Nobody retypes anything.

Risk without it

Free text has to be copied into the right fields by hand, and the format drifts from run to run.

For engineers

How it works

The model is asked for JSON that matches a schema, using native structured-output or tool-call modes where available. The result is validated; on failure the validation errors are fed back for a bounded retry.

Typical stack

  • JSON Schema / Zod
  • structured-output modes
  • retry with error feedback

Pitfalls & trade-offs

  • Keep schemas small and explicit: optional fields get skipped.
  • Validate business rules, not just types.
  • Cap retries and surface failures.

In this example

In
draft text
Out
{ summary, goals,
  risks, actions,
  citations[5] }
schema: valid

Fictional sample · not a client system

Contact

Questions about this?

Book a call Write to hello@paxcode.it