Rules and checks placed around an AI model to stop unwanted or risky responses and actions.
Guardrails are a protective layer around the model. They can be rules in the system prompt, automated checks on user input before it reaches the model, checks on the output before it is shown, or limits on which tools an agent may use. The goal is to keep behavior within what you intend.
Any public-facing app needs them. Without guardrails, an assistant may reveal internal information, answer topics unrelated to your business or take a sensitive action because of a manipulative request. Agents with tools need stronger guardrails than assistants that only answer. Practical tip: do not rely on written instructions alone, since they can be bypassed. Enforce the important limits in code: scoped permissions, amount limits and human approval for irreversible actions.