guardrail (AI)
A check that runs before or after a model call, in code or with another model, to block, rewrite or flag unsafe input or output.
In more detail
Typical guardrails detect prompt injection, redact personal data, enforce topics and validate output before it is shown or acted on. Each one lowers the odds rather than removing them, so layer them and keep the decisive controls, such as permissions, outside the model.
Related terms
- PII redaction — Finding personal data such as names, emails, card numbers and phone numbers in text and replacing it before it is stored, logged or sent to a model.
- prompt injection — An attack in which text a model reads overrides or redirects the instructions it was given, because instructions and data share one channel.
- agent policy engine — Code outside the model that decides, for every proposed tool call, whether to allow it, deny it or ask a person, based on rules written as data.
- guardrail — A control that blocks a dangerous action whatever else is allowed, such as an explicit deny or a block on public access.
Taught in
- Zero-Shot And Few-Shot — AI Engineering: LLM Apps, RAG & Agents
- Prompts As Code — AI Engineering: LLM Apps, RAG & Agents
- Measuring Retrieval — AI Engineering: LLM Apps, RAG & Agents
- The Agent Loop — AI Engineering: LLM Apps, RAG & Agents
- Workflows Before Agents — AI Engineering: LLM Apps, RAG & Agents
- Planning, Memory And Many Agents — AI Engineering: LLM Apps, RAG & Agents
- Agent SDKs And Human Approval — AI Engineering: LLM Apps, RAG & Agents
- Threat-Model An LLM App — AI Engineering: LLM Apps, RAG & Agents
- Prompt Injection — AI Engineering: LLM Apps, RAG & Agents
- Excessive Agency — AI Engineering: LLM Apps, RAG & Agents
- Guardrails, Privacy And Governance — AI Engineering: LLM Apps, RAG & Agents
- Images, Audio And Speech — AI Engineering: LLM Apps, RAG & Agents
- Working With AI Coding Assistants — AI Engineering: LLM Apps, RAG & Agents
- Capstone: The Tasks Assistant — AI Engineering: LLM Apps, RAG & Agents
References
- OWASP GenAI Security Project: Top 10 for LLM Applications 2026
- OpenAI Agents SDK: Running agents (the agent loop, max_turns)