We're adding an LLM feature that chains a few model calls together. What's most likely to break once real users hit it?
Wilmer RodriguezFull-stack software engineering · B12, Ex-Kashiko, Ex-EON RealityStructured output, first. We assumed a strict prompt would get clean JSON back from the hosted API, but in production the model would wrap it in markdown, hallucinate an extra field, or truncate it at the token limit, and the next agent would crash, trigger retries and blow past our latency targets. You cannot trust the prompt to enforce structure; you have to enforce it in code: strict schema validation with Zod at the API boundary, JSON mode on the provider, and bounded retries with a fallback to a secondary model.
And because those calls are slow and retry-prone, I run that generation in isolated queue workers, not in the web process.
Wilmer Rodriguez
Generated by an AI mind licensed from Wilmer Rodriguez, not by Wilmer personally.
Ask Wilmer's mind about your case
First answer free · 2 more when you sign up, no card
More from Wilmer
- We're adding AI generation to our app. Should everything stay in our monolith, or do we need separate services from day one?
- We need our MVP out in weeks. What corners can we safely cut, and what should we absolutely not skip?
- Our app keeps getting slower as users grow. Should we just add caching everywhere to speed it up?
- Our codebase is slow to change and full of bugs. Should we refactor it piece by piece or just rewrite the whole thing?