None of what follows is interesting on its own. Collectively it is most of the difference between an AI feature that survives contact with real users and one that gets quietly switched off after a bad week.
Schema first, always
Every model call that feeds a product surface returns structured output validated against a schema before anything downstream sees it. Free text does not get interpreted by application code; it gets parsed once, at the boundary, or rejected.
Retries have a ceiling and a fallback
A validation failure gets retried a fixed, small number of times with a tightened instruction, and then the feature falls back to a defined, non-generative behaviour — a cached answer, a simpler rule, or an honest "unavailable right now" — rather than surfacing a malformed response or hanging indefinitely.
Bound the input, not just the output
- Length limits on anything a user pastes into a prompt, disclosed in the interface rather than silently truncated.
- Rate limits per account, because a single enthusiastic user can otherwise generate a month's expected cost in an afternoon.
- A blocklist for the obvious abuse patterns, reviewed and updated, not treated as solved once written.
Every call is logged with enough to reconstruct it
Input, output, model version, latency and cost, retained long enough to investigate a complaint. When something goes wrong three weeks after a model update, "we don't have the logs" is the answer nobody wants to give a client.
Guardrails are not a tax on the feature. They are most of what makes the feature a product rather than a demo.
Human review stays in the loop where the stakes justify it
Anything touching money, a public-facing statement attributed to the client, or an irreversible action gets a review step before it goes live, even if the model's confidence is high. Confidence is not the same thing as correctness, and treating it as a proxy for correctness is where the expensive mistakes come from.
What this costs
Roughly a third of the engineering effort on a typical model-backed feature goes into this layer rather than the feature's headline behaviour. Clients occasionally ask why the "simple" AI feature took as long as the rest of the release. This is why, and it's the part of the estimate we no longer apologise for.
