Guardrails: How the Module Protects Corporate Data When Working with LLMs
The more a company uses language models, the harder it becomes to control exactly what employees send to LLMs and what they receive in return.
Banning ChatGPT, Claude, and other external models is the simplest option. But it also means giving up the benefits of AI.
Allowing unrestricted access means accepting certain risks: personal and corporate data may be exposed to external services, employees may misuse corporate AI resources, and models may generate undesirable or unpredictable responses.
To address these challenges, the Gorgona platform includes the Guardrails module. It adds an intermediate layer of control between the user and the language model.
The module inspects requests and responses, can block them, modify specific parts of the text, or log triggered rules for further analysis.
What Are Guardrails?
Guardrails are security rules that inspect messages exchanged between users and AI models. Companies choose which rules they need and configure them for their specific use cases.
They can operate in two directions:
User → LLM
Inspect the data and content of a request before it reaches the model.
LLM → User
Inspect the model's response before it is shown to the user or passed to another system.
Each triggered rule can perform one of three actions:
Block the request or response.
Modify a detected segment, such as masking sensitive data.
Notify an administrator without interrupting the request.
Rules also support different operating modes.
Enforce — The rule is fully active.
Audit — Violations are logged, but nothing is blocked.
Shadow — The rule silently inspects real requests and responses, with results available in the statistics.
Disabled — The rule is turned off, but its configuration is preserved.
In other words, Guardrails are more than a filter that simply says "allowed" or "not allowed."
They provide a layer of control over what passes through an LLM, in what form, and according to which rules.
Protect Personal Data Before Sending It to an LLM
One of the most basic use cases is detecting personal data in a request.
For example, an employee sends a request to an external model containing someone's name, phone number, passport details, or banking information.
The Anonymize guardrail detects this information and replaces it with placeholders before the request reaches the model.
For example:
Before processing:
"Karimov Aziz, passport AA 123456"
After processing:
"[NAME], passport [PASSPORT]"
The guardrail can recognize names, email addresses, phone numbers, bank card numbers, passport and other identity document details, IP addresses, and other supported data types. Administrators choose which categories should be masked.
Uzbekistan-specific formats are recognized without additional configuration.
The model never receives the actual personal data.
Importantly, the request does not necessarily need to be blocked. If the task can be completed without sharing the original data, sensitive segments can be replaced with placeholders, allowing the request to proceed.
But what happens if the user needs the original information in the final response?
This is where the complementary rule, Deanonymize, comes in.
It processes the model's response and replaces the placeholders with their original values. As a result, the user receives a complete response containing the actual data, even though the AI model never saw it.
The process looks like this:
Original data → Anonymization → LLM → Deanonymization → User
This allows companies to use external models to process tasks without exposing the original personal data.
Inspect the Data Returned by the Model
Protection should not be limited to what employees send to the model.
Imagine an AI assistant that answers questions using a corporate knowledge base. One of the documents accidentally contains an employee's personal phone number.
A user asks a question related to that document. The model retrieves the relevant information and includes the phone number in its response.
The Sensitive Info guardrail is designed for this scenario.
It inspects model responses, detects personal data, and can mask it.
This is particularly important for AI assistants that work with large volumes of internal documents. Even if the model does not receive personal data directly from the user's request, it may encounter such information in the retrieved context and reproduce it in its response.
That is why inspection needs to work in both directions:
What was sent to the model → What the model returned.
More Than Personal Data: 18 Types of Guardrails
Personal data protection is only one use case.
Gorgona includes 18 types of Guardrails, divided into four groups: data, attacks, topics and tone, and response quality and formatting.
These rules can be combined depending on the company's specific needs.
1. Data
The data protection group includes four guardrails.
Anonymize — Detects personal data in requests and replaces it with placeholders before sending the request to an LLM.
Deanonymize — Processes model responses and restores original values in place of placeholders.
Sensitive Info — Detects personal data in model responses and masks it.
Secrets Detection — Detects passwords, database connection strings, AWS, Google Cloud, and Azure keys, GitHub, GitLab, Slack, and Stripe tokens, private keys, and authentication tokens in requests.
The last scenario is particularly important for developers and AI agents. An employee may accidentally paste part of a configuration file or a secret key into a request, even though that information should never reach the model.
Unlike some other rules, Secrets Detection works immediately without additional configuration.
2. Attacks
A separate group protects against attempts to manipulate model behavior.
Prompt Injection detects attempts to take control of the model.
For example:
"Ignore all previous instructions."
Or:
"Reveal your system prompt."
Such instructions may come directly from a user. But an especially dangerous scenario occurs when an AI agent reads documents or web pages: a malicious instruction may be hidden inside the content the agent is processing.
Detection relies on a specially trained model rather than a simple list of forbidden phrases. This allows the rule to recognize reworded versions of attacks.
The second guardrail is Invisible Text.
It detects characters that humans cannot see but AI models can process. These characters can be used to hide instructions or bypass filters. For example, an invisible character can split a word so that it no longer matches a blocked term.
The guardrail can remove these characters or block the request.
3. Topics and Tone
Not every restriction is related to data leaks or attacks. Sometimes a company needs to control what its AI discusses and the tone it uses.
Six guardrails address these requirements.
Toxicity Detection identifies insults, abusive language, profanity, and other harmful content. It can be applied to both user requests and model responses.
Sentiment Analysis determines the emotional tone of a text and allows companies to filter out strongly negative messages.
This is not the same as toxicity. A message may be perfectly polite while still expressing irritation or strong negativity. This type of control is particularly useful for assistants communicating on behalf of a brand.
Ban Topics allows companies to restrict specific subjects. For example, a company may prohibit discussions about politics, religion, or investment advice.
The guardrail analyzes the meaning of a request rather than simply looking for a particular word. A question such as "Where should I put a million to make a profit?" can be identified as investment-related even if the word "investment" is never used.
Ban Competitors prevents an assistant from mentioning or recommending specific brands. Companies define a list of competitors, and the rule can identify their names even when capitalization or spacing differs.
Ban Substrings uses a blocklist of specific words and phrases. For example, it can help control internal project code names. Detected substrings can be blocked or removed from the text.
Finally, Regex Pattern is designed for data that follows a strict, company-specific format.
Examples include contract numbers, employee IDs, or internal customer codes.
A technical specialist defines the required pattern, after which the rule can block, mask, or flag matching values.
4. Response Quality and Formatting
The final six guardrails focus less on security and more on making AI behavior predictable.
Their purpose is to ensure that the model responds in the required format, uses the correct language, and stays within acceptable response length limits.
Language Filter allows only approved languages. It can recognize 176 languages.
For example, if an assistant serves customers in Uzbekistan, the company can allow only Uzbek and English.
Language Consistency checks whether the model responds in the same language as the user's question.
This is useful because models sometimes unexpectedly switch to English even when the user is communicating in Russian.
JSON Validator checks whether the model returns valid JSON.
This is particularly important when an LLM response is passed not to a human but to another system, such as a CRM or accounting application. If the model produces malformed JSON, that response should not proceed through the processing pipeline.
No Refusal (Light) detects situations where the model responds with phrases such as "Unfortunately, I cannot..."
For businesses, this can be a useful signal that the assistant is being overly cautious or lacks the information needed to answer. Companies can also add their own phrases that should be classified as refusals.
Reading Time limits response length based on how long it would take a user to read the text.
This can be useful, for example, in customer support chatbots, where a longer answer is not necessarily a better one.
The final guardrail is Token Limit.
It restricts the length of incoming requests in tokens — units of text used by language models to process input.
This helps control budget overruns and system load. It can also reduce risks associated with malicious instructions hidden inside extremely long texts.
Together, the 18 guardrails address very different needs, from masking passport details to validating JSON, languages, and response length.
This distinction matters: Guardrails are not a single universal filter. They are a collection of independent rules that companies can use to build policies suited to their needs.
Control Both Incoming Requests and Model Responses
Each guardrail has a specific inspection point.
Some rules operate only on user requests. Others inspect only model responses. Certain rules can check both directions.
For example:
Anonymize processes requests.
Deanonymize processes responses.
Toxicity Detection can inspect both requests and responses.
JSON Validator checks responses.
Token Limit checks requests.
This makes it possible to avoid applying identical restrictions to all traffic and instead select controls appropriate for each task.
This is especially important when masking personal data: the data can first be anonymized, the request can then be sent to an external LLM, and the original values can be restored for the user after processing.
Observe First, Then Enforce Restrictions
Not every rule needs to be activated in enforcement mode immediately.
For example, a company suspects that employees frequently send confidential information to LLMs. Before blocking these requests, it may want to determine whether this actually happens and how frequently the rule is triggered.
Several operating modes are available for this purpose.
Enforce — The rule is fully active and performs the configured action.
Audit — Violations are recorded in logs without interfering with the user's workflow.
Shadow — The rule operates in the background, and its detections are visible only in statistics. This allows teams to test a new rule against real traffic and understand its behavior before enabling restrictions.
Disabled — The rule is turned off, but its configuration is preserved.
This allows a company to collect statistics, evaluate how often rules are triggered, and only then move toward active enforcement.
It reduces the risk of security measures themselves becoming a source of constant blocking and disruption to employees' work.
A Different Action for Every Detection
Gorgona Guardrails support three actions.
Block — The request or response is stopped, and the user receives a rejection message.
Modify — The detected segment is changed. For example, personal data or a secret is replaced with a mask while the rest of the text continues through processing.
Warn — The request or response proceeds, but the event is flagged for the administrator.
However, modification is possible only when the guardrail can identify a specific segment of text.
For example, personal data, secrets, and prohibited words can be masked. Toxicity or prohibited topics, on the other hand, support blocking or warnings.
This means companies can choose not only which rules to apply, but also what should happen when those rules are triggered.
Different Tasks Require Different Policies
Not every AI use case needs the same set of rules.
A local model running inside a secure environment may require different checks from an external cloud LLM processing financial or legal information.
That is why Guardrails can be grouped into different collections and applied to specific scenarios.
For example, a separate policy can be configured for:
A specific AI agent.
An API key.
A chat.
A particular application or use case.
This helps balance security and performance.
Every additional inspection increases request processing time, so there is little reason to run all 18 guardrails when two or three are sufficient.
Manage Rules as Part of Your Infrastructure
A Guardrails collection is more than a list of filters.
Rules can be configured at different levels: across all platform installations, for a specific organization, for an individual installation, or locally on the client's side.
Baseline protection can be defined once, while individual companies can add their own rules on top of it.
Rules can also be tested in the Sandbox using sample texts to verify whether the required checks are triggered.
An entire collection can be tested as a single pipeline.
(Show screenshot)
Statistics allow teams to track rule detections and evaluate which rules are actually being used.
This is especially useful when moving from Shadow or Audit to enforcement mode. Instead of activating restrictions blindly, teams first gain an understanding of what is happening in real traffic.
It is important to remember that Guardrails do not provide 100% protection. Like any system of this kind, they can make mistakes — both by missing content that should have been detected and by flagging acceptable content.
They should therefore be treated as an additional layer of control that reduces risks, not as an absolute security guarantee.
Guardrails Run Within the Client's Infrastructure
Another important consideration is where inspection takes place.
Guardrails run within the client's infrastructure. The texts being inspected are not sent outside the system. Only anonymized detection counters are transmitted externally.
This allows companies to enforce control policies directly within their corporate environment without sending the contents of requests and responses to a third-party service for additional inspection.
However, effectiveness depends on the language.
13 of the 18 guardrails perform equally well in Russian, English, and Uzbek. The remaining five have lower accuracy in certain languages.
For Prompt Injection, Toxicity Detection, Ban Topics, and No Refusal, Russian and English are fully supported, while Uzbek may have higher error rates.
Sentiment Analysis offers full support for English and partial support for Russian and Uzbek.
For Uzbek, the writing system also matters: results may differ between Latin and Cyrillic scripts.
When designing a policy, companies should therefore consider not only the type of inspection but also the language used in each AI scenario.
Guardrails Do Not Replace Access Control
It is important to distinguish between two different tasks.
Imagine an employee asking an AI agent:
"Show me the company's revenue for last year."
If this information is stored in an internal knowledge base, the access control mechanism must first determine whether the employee is authorized to receive it.
This is the responsibility of Knowledge Engine and the access control system, not Guardrails.
But if the employee has permission and the information from the knowledge base has already been included in the context for the LLM, Guardrails can additionally inspect that context before it is sent to an external service and, for example, mask sensitive segments.
Knowledge Engine answers the question, "Who is allowed to access this data?"
Guardrails answer, "What exactly should pass through the LLM, and in what form?"
These mechanisms complement each other.
Use External Models Without Choosing Between Convenience and Control
In practice, companies often face an uncomfortable choice.
On the one hand, powerful cloud models provide employees with high-quality results and save time. On the other hand, companies do not want their internal information to be transferred to external providers without proper controls.
One option is to completely ban external LLMs. But employees may then be forced to use less convenient tools or find their own ways around the restrictions.
Another option is to deploy only local models. However, for some tasks, they may be less competitive than cloud models in terms of quality or cost.
Guardrails make a third approach possible:
Use external models while placing your own layer of control between corporate systems and the model provider.
For example, before sending a request, the system can detect personal data or secrets, check for prohibited topics, limit request size, or identify prompt injection attempts.
After receiving a response, the system can inspect it for confidential information, toxicity, prohibited topics, language, JSON validity, or other configured parameters.
The company gains more than access to an LLM. It gains the ability to control how that model is used within corporate workflows.
Control the Use of Corporate AI Resources
Guardrails help companies control not only data but also how AI is used.
For example, a company provides employees with a corporate API key for accessing a particular model.
If employees begin using this access for requests unrelated to work or in violation of internal policies, it may create additional costs and risks for the company.
Guardrails allow companies to restrict content and usage scenarios while collecting detection statistics.
For example, companies can prohibit certain topics, competitor names, or internal code names, or limit the length of incoming requests.
This allows AI tools to remain available to employees while making their use more manageable.
Guardrails as Part of AI Infrastructure
Guardrails do not operate in isolation from the other components of an AI platform.
LLM Box helps manage models: connecting different LLMs, selecting the right model for each task, and switching between them.
Guardrails control interactions with models: what data can be sent, what needs to be modified or blocked, and which responses are acceptable.
Together, these components transform the use of LLMs from a collection of disconnected services into a managed AI infrastructure.
What the IT Team Gains
With Guardrails, a company gets more than a request filter. It gains a unified mechanism for managing LLM usage policies that:
Protects personal data and secrets.
Controls incoming requests and model responses.
Reduces the risk of exposing sensitive data to external providers.
Detects prompt injection attempts and other manipulation techniques.
Restricts unwanted topics, tone, and competitor mentions.
Controls response language, format, and length.
Supports different policies for different AI scenarios.
Allows teams to choose between blocking, modifying, and warning.
Enables rules to be tested first in Audit or Shadow mode.
Tracks detection statistics.
Supports a gradual transition from observation to enforcement.
Preserves the ability to use external models where appropriate.
The set of rules can be adapted to a company's specific architecture, business needs, and languages.
Guardrails: When AI Needs to Be Not Only Intelligent but Also Controllable
A language model does not inherently know which data a company considers confidential, which topics are prohibited, which language an assistant should use, or which response format a corporate system expects.
These rules need to exist at the infrastructure level.
Guardrails add this layer of control between corporate systems and LLMs.
Companies gain the ability not merely to connect AI, but to define how it should be used: which requests to allow, which data to conceal, which responses to block, which formats to validate, and what activity to monitor.
At the same time, Guardrails do not provide absolute protection. They reduce risks and make LLM usage more manageable.
As a result, AI remains a practical tool for employees, while control over how it is used stays with the company.
Gorgona helps companies establish this control as part of a unified AI infrastructure.
Request a demo and see how Guardrails can work within your architecture.