AI systemsguardrailAI guardrailsoutput filterpolicy checks

Guardrails

Definition

Guardrails are deterministic controls placed between a language model and the outside world, such as tool allow-lists, argument limits, budgets and output filters, that enforce policy regardless of what the model produces.

In practice

The model proposes; the runtime decides. Guardrails check which tools this user may call, validate arguments against schemas and limits, cap steps, tokens and cost per run, scope credentials to the user and task, and filter outputs for leaked data or unsafe content before they are shown. Because they run in code, they hold even when the model is confused or manipulated.

Instructions in the system prompt are not guardrails: they can be overridden by prompt injection or simply ignored. Guardrails also have costs, since strict filters block legitimate requests and model-based classifiers add latency and can themselves be fooled. Log every block so the rules can be tuned.

Example

Before executing send_email, the runtime checks that the recipient domain is on the allow-list, the run has used fewer than 20 steps and the body contains no card numbers.