Guardrails are software filters around a large language model (LLM) that check the incoming request and the outgoing response for an attack, a forbidden topic, personal data or toxic text. For a chatbot this is often enough. For an agent built on artificial intelligence (AI) it is not, because an agent writes text and also calls tools, and the danger lies in the action rather than the word. Actions are checked by a different mechanism, an action control layer.
Guardrails check the input and output of the model with rules, classifiers or a second model. A second, supervising model errs probabilistically just like the first, because it reads the same text and can be fooled by the same trick. An action control layer checks the tool call, a finite set of parameters, against a rule, deterministically and without a language model. The control layer does not judge text and does not know whether a response is polite or true; it answers one question only, whether the action is admissible, so both mechanisms are needed: guardrails for the conversation and a control layer for actions.
What guardrails are
Guardrails are a layer of checks around a language model, and their tasks are typical.
- On input they detect prompt injection, attempts to “remove restrictions”, requests on forbidden topics and personal data in the request.
- On output they block toxic text, leaks of secrets or personal data, answers outside the permitted topics and the wrong format.
They are implemented in different ways: with regular expressions and lists, with classifiers, with a separate moderator model such as Llama Guard by Meta, or with programmable dialogue flows such as NeMo Guardrails (NVIDIA). The Russian regulator sets the same tasks. Paragraph 61 of Order No. 117 of the Federal Service for Technical and Export Control of Russia (FSTEC of Russia), now in force, requires AI services in state information systems to define templates or permitted topics for requests and responses and to monitor compliance with them (see the page about Order No. 117, in Russian).
Why a second, supervising neural network errs just like the first
It solves the same problem in the same way, probabilistically and from text, and this has four consequences.
- The same material: the filter model reads the same request as the main model, and an instruction hidden in a document may be addressed to it as well.
- A probabilistic answer: a classifier gives a score with some error, and rephrasing, switching the language or changing the encoding changes the score.
- No guarantee of completeness: in its description of the prompt injection risk (LLM01, 2025 edition), the Open Worldwide Application Security Project (OWASP) states directly that “it is unclear if there are fool-proof methods of prevention for prompt injection.”
- A shared weak spot: a supervising model is usually smaller than the main one and inherits its class of errors, so a trick that fools one often fools the other.
Guardrails are therefore useful for conversation, because they reduce the share of bad answers. They cannot serve as a guarantee for an action, and the attacks themselves are covered on the page about prompt injection.
What an action control layer checks and what it does not
An action control layer sits between the agent and its tools. It intercepts a call, such as “delete the directory /data/backup” or “transfer 1.2 million rubles to recipient X”, and compares its parameters with a rule a human has approved.
Before a tool call runs, the deterministic control layer verifies the following parameters:
- Whether the tool is admissible for this task.
- Whether the parameters are within the permitted limits of path, amount, recipient and export volume.
- Whether all the facts the rule needs are known: if a required fact has not been observed, admissibility is not proven, and the result is a refusal rather than a pass.
The control layer does not check the following.
- The truth or tone of the response of the model.
- The intentions of the model, or whether it “noticed” the trick.
- Actions performed bypassing the control layer, which is why the control layer is placed in the path: the agent must have no route to the systems that avoids it.
| Guardrails | Action control layer | |
|---|---|---|
| What it checks | Request and response text | A tool call with its parameters |
| How | Rules, classifiers, a second model | A rule-contract, deterministic check |
| Answer | A probabilistic score | Admissible or inadmissible, with a reason; the decision is repeatable |
| Against injection | Catches known techniques | An action the rule forbids does not pass, whatever the wording, where enforce mode is on |
| What it lets through | New attack wordings | Everything the rule allows; errors in the rule itself |
| Where it is needed | Chatbots, assistants, moderation | Agents with access to data, money, code |
What this looks like in practice
MITR built by the institute checks the admissibility of a call with a satisfiability modulo theories (SMT) solver against a rule-contract written as data, and a language model takes no part in the decision. On 24 October 2026, with 20 contracts, a decision under a rule takes 1.08 milliseconds at the median and a call with an explanation 5.22 milliseconds; on 14 October 2026, with 19 contracts, the figures were 0.95 and 4.26 milliseconds. Since 24 October 2026 all 20 contracts have run in enforce mode, while on 14 October 2026 only one class, file deletion, ran in it.
The basis of this approach is formal verification, covered on the page about formal verification of agent actions. How the control layer fits into the overall architecture of information security of the third generation (IS 3.0) is described on its own page.
How guardrails and a control layer are combined
They should be combined, because they work at different levels.
- Input guardrails cut off known attacks and junk before the model starts planning.
- Output guardrails watch the text a person sees: tone, leaks, format.
- The action control layer checks every tool call before execution, regardless of what the filters let through.
- The decision log of the control layer makes it possible, after an incident, to reconstruct which action was admitted and under which rule.
In such a scheme, a filter error costs an inaccurate answer, not a deleted database.
Frequently asked questions
What are guardrails for language models?
They are software barriers around a language model: checks of incoming requests and outgoing responses for attacks, forbidden topics, data leaks and the wrong format. They are implemented with rules, classifiers or a separate moderator model.
Do guardrails protect against prompt injection?
Text guardrails mitigate the risk only in part: they catch known attack patterns, but they operate on the same natural-language input as the model and make mistakes with some probability, and OWASP writes that it is unclear whether fool-proof prevention methods exist. For agents, it is more reliable to check the action itself as well.
How does an action control layer differ from guardrails?
Guardrails assess the text of the request and the response, usually probabilistically. An action control layer checks a specific tool call with its parameters against an approved rule, deterministically and without a language model, and its decision is repeatable and explainable.
What is an AI security gateway?
It is a gateway that sits between an application or an agent and external systems and checks the requests and actions passing through it. What matters is what exactly it checks: if only text, it is a kind of guardrail, and if tool calls with parameters, it is an action control layer.
Are guardrails needed if there is an action control layer?
Both layers are needed together: the action gate does not evaluate conversational tone, factual accuracy or data leaks inside prose replies to a user. Guardrails cover the conversation and the control layer covers actions, so together they protect both levels.
Sources
- OWASP Gen AI Security Project, “LLM01:2025 Prompt Injection”: https://genai.owasp.org/llmrisk/llm01-prompt-injection/
- Order No. 117 of FSTEC of Russia of 11 April 2025, as amended on 8 May 2026, paragraph 61: http://publication.pravo.gov.ru/document/0001202506170011
- Measurements of MITR taken by the institute on 14 and 24 October 2026.
Checked: 16 October 2026; MITR measurements of 24 October 2026.