Book a demo
Guide

AI guardrails: what they are and how to enforce them

AI guardrails are runtime controls that check what goes into an AI system, what comes out and what an AI agent may do. Each guardrail turns a written rule into a decision: allow, block, redact, send for human approval or alert. A guardrail counts as a control only when it runs in the request path and logs every decision.

Guardrails check four points in every AI request

A single request to an AI system passes several points where something can go wrong. Guardrails (sometimes written "guard rails") are most useful when you map them to those points instead of buying a filter and hoping it covers everything. The OWASP Top 10 for LLM applications is a practical checklist for what each point must catch. For the full list, see theOWASP Top 10 for LLM guide. To decide which rules to write, start with your AI policy.

Prompt checks, before the model

The request is inspected before it reaches a model. Typical checks: personal data and secrets in the prompt, instructions that try to override the system prompt, and requests the use case was never approved for. OWASP lists prompt injection and sensitive information disclosure as the top two entries (LLM01 and LLM02) in its 2026 list for LLM applications, and both are cheapest to stop here.

Output checks, before a person or system

The answer is inspected before anyone or anything acts on it: ungrounded claims, leaked secrets or code, harmful content, or commitments made on the company's behalf. OWASP calls the failure to validate model output before passing it downstream improper output handling (LLM10:2026).

Action checks, before a tool runs

For agents, the riskiest moment is the tool call. An action guardrail checks the agent's identity, whether the tool is on its allow list, and whether the action needs a person to approve it. OWASP names the root causes of excessive agency: too much functionality, too many permissions and too much autonomy.

Spend and rate limits

Caps on requests, tokens and money per system or per person. OWASP's unbounded consumption entry recommends rate limits, quotas and monitoring of consumption patterns. A cap that only sends a warning email after the money is spent works as a report, so decide in advance whether the limit blocks or asks for approval.

Six AI guardrail examples written as rules

Personal data stays inside approved boundaries

If a prompt to an external model contains a customer account number or a national ID, mask it before it leaves. If the data is classed as restricted, block the request.

Approved model providers only

If a request targets a model provider that is not on the approved list, block it at the gateway and tell the caller which providers are allowed.

No secrets in prompts on developer machines

If a coding assistant prompt contains a private key, a cloud access key or a production password, block it on the laptop before anything is sent.

Agents call only allow-listed tools

If an agent asks for a tool it has not been granted, refuse the call and record the attempt against that agent's identity.

Human approval above a payment limit

If an accounts payable agent proposes a payment above a set amount, pause the run and route the proposal to a named approver with the invoice attached.

Monthly spend cap per system

If a system reaches 80% of its monthly budget, alert the owner. Above the cap, require approval before more requests go through.

Where a guardrail runs decides what it can stop

The same rule behaves differently depending on where it is enforced. A rule in a policy document stops nothing. A rule in one team's code covers one application. A rule at a shared enforcement point covers every request that passes it. Most organisations need guardrails at more than one of these layers, because agents, coding assistants and browser tools do not all send traffic through the same place. TheAI gateway guide covers the request-path layer in depth, and the guides to AI agent governance and MCP governance cover the agent and tool layers.

Inside the model

Model providers train refusal behaviour into their models. That helps, and it is outside your control: you cannot set the rule, see the decision or prove it happened. MITRE ATLAS lists LLM jailbreak (AML.T0054) as a technique for getting a model to ignore exactly these safety behaviours.

In application code

Each team writes its own checks. Coverage depends on which teams remembered, the rules drift apart between applications, and a change to policy means a change to every codebase.

At a gateway in the request path

Every model and tool call passes one enforcement point, so one rule applies to every use case and every decision lands in one log. This is where most prompt, output, data and spend guardrails belong. See the guide to what an AI gateway does.

In the agent runtime

Some decisions need context only the runtime has: which business record the agent is acting on, the amount, how many steps it has taken. Approval thresholds and stop switches sit here.

On laptops, browsers and the network

Coding assistants and browser AI tools run outside your servers. A guardrail on the laptop or in a managed browser covers what a server-side gateway never sees, such as a developer pasting secrets into a local assistant.

Every guardrail decision needs a record

A guardrail that blocks a request and leaves no trace protects you once and proves nothing. Auditors, regulators and your own incident team will ask the same question later: what rule was in force, and did it work? The NIST AI Risk Management Framework asks for post-deployment monitoring plans that include incident response and change management (MANAGE 4.1), and the decision log is the raw material for that. Each record should answer four questions.

Who asked

A named person or a named agent identity. A shared API key tells an auditor nothing about who did what.

Which rule decided, and which version

Policies change. If the log does not record the policy version, you cannot show which rule was in force on the day of an incident.

What happened

Allowed, blocked, redacted, sent for approval or alerted. For approvals, who approved and when.

Where it ran

Gateway, agent runtime, deploy gate, laptop or browser. This shows auditors that a rule is enforced everywhere it claims to be.

Guardrails lower risk and leave some behind

Filters miss new attacks

Injection and jailbreak filters are trained on known patterns. Attackers rephrase, encode text in Base64, switch languages or hide instructions in images, all of which OWASP lists as live techniques. Treat a filter as one layer. The prompt injection guide covers the attack in detail.

Permissions limit the damage

If an injected instruction gets through, the agent can only do what its permissions allow. Short-lived credentials, a tool allow list and read-only access by default shrink what a successful attack can reach.

Approvals catch what filters cannot judge

Some actions are fine in one context and harmful in another: a payment to a supplier whose bank details changed yesterday, for example. A person with the record in front of them can judge that; a text filter cannot.

Testing shows whether the guardrails hold

Run attacks against your own guardrails before release and on a schedule afterwards. The AI red teaming guide covers how to plan a campaign and record the results as evidence.

How Moring AI enforces guardrails

Written rules become runtime policies

In Moring AI, a policy is an if/then rule with an owner, a version and an enforcement point: the gateway, the agent runtime, the deploy gate, developer laptops, managed browsers or the network. Each policy blocks, redacts, sends for approval, alerts or runs in monitor-only mode while you tune it.

Prompt, output and data checks at the gateway

Filters run on every request: prompt injection, jailbreak attempts, ungrounded answers, secrets in output and commitments on the company's behalf. Personal, financial and health data is masked, tokenised, blocked or allowed by data class before it reaches a model.

Agent permissions and approvals

Every agent acts with its own identity and only the tools it has been granted. The gateway checks each tool call against those permissions, and actions above a policy limit pause for a named approver.

Every decision is evidence

Each decision is logged with the policy version that made it and feeds the controls it maps to, so the same log answers an auditor's question under several frameworks. See policy enforcement.

Frequently asked questions

What are AI guardrails and how are they enforced?

AI guardrails are controls that run while an AI system is in use. They check prompts before they reach a model, check answers before they reach a person or system, and check agent actions before a tool runs. Each check ends in a decision (allow, block, redact, send for approval or alert), and a well-built guardrail logs that decision with the rule that made it.

What are some common AI guardrails examples?

Common examples: mask personal data before a prompt reaches an external model; allow only approved model providers; block secrets in prompts from developer laptops; let agents call only the tools they have been granted; pause agent payments above a set amount for human approval; and cap monthly spend per AI system. Each can be written as an if/then rule with a named owner.

What is the difference between LLM guardrails and AI agent guardrails?

LLM guardrails mostly check text: the prompt going in and the answer coming out. AI agent guardrails also check actions. An agent can call tools, write to systems and move money, so its guardrails cover identity, tool permissions, approval thresholds and a way to stop the agent. An agent needs both kinds, because a prompt injection in a document can turn into a harmful tool call.

Can guardrails stop prompt injection?

They reduce it. Input filters catch many known injection patterns, but NIST's adversarial machine learning report (AI 100-2 E2025) says current models remain highly vulnerable to direct prompt injection and recommends designing systems on the assumption that a model can produce malicious output. In practice that means pairing injection filters with least-privilege tool access, approval for high-impact actions and regular red teaming.

How are AI guardrails different from an AI policy?

An AI policy is the written rule: what people and systems may and may not do with AI. A guardrail is the mechanism that enforces part of that policy at runtime. Some policy clauses (training, accountability, review cadence) cannot be enforced by a guardrail. The ones that can, such as data handling, approved providers and spend, should be, because auditors treat a written rule with no enforcement as a gap.

Sources

  • OWASP Top 10 for LLM Applications 2026: The ten risk entries, including LLM01 Prompt Injection, LLM02 Sensitive Information Disclosure, LLM03 Excessive Agency, LLM06 Unbounded Consumption and LLM10 Improper Output Handling. genai.owasp.org. Checked 25 November 2026.
  • OWASP LLM06:2025 Excessive Agency: Root causes (excessive functionality, permissions and autonomy) and mitigations including least privilege and human approval. genai.owasp.org. Checked 25 November 2026.
  • OWASP LLM10:2025 Unbounded Consumption: Mitigations including rate limiting, user quotas and monitoring of consumption. genai.owasp.org. Checked 25 November 2026.
  • NIST AI 100-2 E2025, Adversarial Machine Learning: A Taxonomy and Terminology of Attacks and Mitigations: Section 3.3 on direct prompting attacks and system-level mitigations. csrc.nist.gov. Checked 25 November 2026.
  • MITRE ATLAS AML.T0054 LLM Jailbreak: Technique entry for inducing a model to ignore its safety behaviours and guardrails. atlas.mitre.org. Checked 25 November 2026.

Turning written AI rules into enforced ones?

See how Moring AI takes a written policy to a runtime guardrail with a logged decision for every request.

Talk to Moring AI