AI Engineering · 2026-08-02 · 10 min read
Structured outputs & evals: shipping AI features that don't break in production
Constrain the output before you trust it
Every AI feature we ship has a schema contract. The model does not return prose that downstream code parses with hope: it returns validated JSON against a Zod schema, and anything that fails validation is retried or routed to human review. This single decision eliminates an entire class of midnight pages.
Citations work the same way. If a generated claim cannot point at a retrieved span, the UI refuses to render it. Absence of evidence renders as absence, never as invention.
const TriageDraft = z.object({
summary: z.string().max(280),
citations: z.array(z.object({
recordId: z.string(),
span: z.string(),
})).min(1),
confidence: z.enum(['high', 'review']),
});Evals are CI, not vibes
For Kora we keep 400 golden-case tickets replayed on every prompt or model change. Precision and citation accuracy are CI gates: the build fails if they regress. New failure modes become new golden cases the same week they are found.
Start with 50 cases covering your happiest paths and your scariest edge cases. That is enough to catch most regressions, and it compounds: after three months you own a behavioral specification no documentation could replace.
Measure cost and latency like uptime
Token spend per ticket and p95 completion latency are dashboarded next to error rates. Caching, model routing, and prompt compression are optimization levers you pull with data, not arguments. Production AI is an operations discipline first and a modeling discipline second.