Guardrail
A rule constraining what a model may do, enforced by prompt, schema, or surrounding code.
A guardrail is a constraint on model behaviour: a category of action it must refuse, a confirmation it must obtain, a shape its output must take. Guardrails live at three different strengths, and conflating them is the usual source of trouble.
Prompt-level rules are advisory. They shape behaviour reliably enough to be useful and are not enforcement — a rule stated in prose is followed most of the time.
Schema-level rules are enforced by Constrained Decoding: the model cannot emit what the grammar disallows. This is the strongest lever and the reason "make it required" beats "ask nicely".
Code-level rules are enforced by the host: a permission check, a scope restriction, an approval gate. This is the only level that holds against Prompt Injection, because it does not depend on the model cooperating.
Two failure modes are worth naming. A guardrail can be too strong for its context — a policy against unsupported claims will cause a model to decline a task that merely resembles the prohibited one, which turns an evaluation into a coin flip. And an asymmetric permission (writes constrained to one target, reads unconstrained) leaves a gap where the model aims a write at something it read; closing it may come down to wording an error message so it names the likely mistake rather than offering a bare list of valid choices.
See also6
Hand-picked in the note itself — the neighbours worth reading next.
Human in the Loop
Requiring a person's judgement at chosen points in an otherwise automated process.
Agents & Language Models9 connections
Least Privilege
Granting only the permissions actually required, so a compromise has a small ceiling.
Systems & Tooling9 connections
Prompt Engineering
Shaping a model's input to make the desired behaviour reliable rather than occasional.
Agents & Language Models18 connections
Evaluation Harness
A repeatable test suite for model behaviour, since prompts and tool descriptions cannot be type-checked.
Agents & Language Models11 connections
System Prompt
The standing instructions that frame every turn of a conversation with a model.
Agents & Language Models14 connections
Agentic Loop
The cycle of model turn, tool call, observation, repeat — the basic mechanism of an AI agent.
Agents & Language Models12 connections
Related2
Nearby in the graph rather than deliberately chosen. Looser, sometimes surprising.
Linked from12
Notes elsewhere in the wiki that reach for this one.
- Agentic LoopAgents & Language Models
The cycle of model turn, tool call, observation, repeat — the basic mechanism of an AI agent.
- Constrained DecodingAgents & Language Models
Restricting a model's next-token choices to those a formal grammar permits.
- Evaluation HarnessAgents & Language Models
A repeatable test suite for model behaviour, since prompts and tool descriptions cannot be type-checked.
- HallucinationAgents & Language Models
Fluent, confident output that is not grounded in anything real.
- Human in the LoopAgents & Language Models
Requiring a person's judgement at chosen points in an otherwise automated process.
- Large Language ModelAgents & Language Models
A neural network trained to predict text, used as a general-purpose instruction-following system.
- Least PrivilegeSystems & Tooling
Granting only the permissions actually required, so a compromise has a small ceiling.
- Model Context ProtocolAgents & Language Models
An open protocol for exposing tools, data, and prompts to AI applications through a uniform interface.
- PromptAgents & Language Models
The text supplied to a language model to elicit a response.
- Prompt InjectionAgents & Language Models
Untrusted content that reaches a model's context and is treated as instruction.
- System PromptAgents & Language Models
The standing instructions that frame every turn of a conversation with a model.
- Tool UseAgents & Language Models
Giving a model a set of callable functions so it can act on the world rather than only describe it.