Applied AI·Structured outputs and tool calling
log every retry; a rising retry rate is an early warning that a prompt or model change degraded reliability.
Validation and retry loop
The production pattern around structured output: parse, validate against the schema with a library such as Pydantic (Python) or Zod (TypeScript), and on failure re-prompt with the error message attached, capped at a small retry budget.