Guardrails
Checks around a model that block, fix or flag inputs and outputs that break the rules.
Guardrails are checks around a model that block, fix or flag inputs and outputs that break the rules: input filters, output validation, allow-lists for tools, limits on spend and rate, and approval steps. The strongest guardrails are in code and permissions, not in the prompt, because a prompt can be argued with.
They work in layers. Input checks catch off-topic requests, personal data and known attack phrasings before or while the main model runs; OpenAI’s Agents SDK, for example, has input, output and tool guardrails whose “tripwire” stops the run. Output checks validate the format with structured outputs, scan for leaked data and compare claims with sources. Around tools, the guardrail is permission: what the agent can call, with which arguments, how often, and what needs a person’s approval (human in the loop). An AI cost cap is a guardrail on money. Classifier checks have both false alarms and misses, so tune them on real traffic.
Guardrails are the technical side of rules a company sets in its AI governance and AI acceptable use policy. The common mistake is relying on a system prompt line such as “never reveal customer data”: it lowers the odds and guarantees nothing. The risk they exist to bound is excessive agency.
Sources
- OpenAI Agents SDK: Guardrails openai.github.io
Related terms
- Prompt injection: Instructions hidden in data (a web page, an email, a file) that the model follows as if they came from you.
- Human in the loop: A person approves, edits or rejects the agent’s action before it takes effect.
- Cost cap: A hard spending limit enforced by your code, per user, per day or per month.
- Excessive agency: An AI agent with more tools, permissions or autonomy than its task needs, so a mistake or an injected instruction can do real damage.
- AI governance: The rules and roles that decide which AI a company uses, on what data, with what checks: policy, inventory, risk tiers, approvals and monitoring.
- AI acceptable use policy: A short company rulebook for staff: which AI tools are approved, what data may go into them, how output is checked and when AI use must be disclosed.
- Structured outputs: The model’s answer is constrained to match a JSON schema you provide.
