Never trust an LLM's output directly. Here's the validation layer I put on every agent.
LLMs hallucinate structure. A production agent needs a validation layer between the raw model output and the code that acts on it. Here's a practical, type-safe pattern using Zod.