Try Bifrost Enterprise free for 14 days. Request access

Enterprise AI Guardrails for PII, Injection, and Toxicity

Enterprise AI Guardrails for PII, Injection, and Toxicity

TL;DR

  • AI guardrails are policy checks that validate LLM prompts and responses in real time and block, redact, or log content that violates a rule before it reaches a model or a user.
  • Bifrost Enterprise manages three guardrail providers itself (Custom Regex and Secrets Detection in-process, Prompt Guardrails through a judge model) and integrates ten external providers for semantic PII, prompt injection, and toxicity detection.
  • Every guardrail is a CEL rule linked to reusable profiles, applied to input, output, or both, with an action of detect_only, block, or redact.
  • Redaction runs in three modes: runtime, logs_only, and runtime_reversible, so teams can keep raw PII out of logs while still sending the original text to the model.
  • The same rules apply to MCP tool arguments and results, which extends AI guardrails to agent tool calls without separate tooling.

Prompt injection ranks first in the OWASP Top 10 for LLM Applications 2025, and sensitive information disclosure ranks second. Enterprise AI guardrails address both by validating prompts and responses against policy at the infrastructure layer instead of trusting every application team to implement the checks correctly. Bifrost, the open-source AI gateway built in Go by Maxim AI, is built for enterprises that need those checks applied uniformly across every model call rather than per service. This post covers how Bifrost Enterprise AI guardrails detect PII, prompt injection, toxicity, and credential leakage in real time, which checks run natively inside the gateway, and what each one costs in latency.

For the category definition and how guardrails differ from moderation APIs, the explainer on what AI guardrails are and how they work is the reference.

What Are Enterprise AI Guardrails?

Enterprise AI guardrails are policy checks that validate LLM inputs and outputs in real time, blocking, redacting, or modifying content that violates a defined rule before it reaches a model or a user. They cover the risk categories catalogued in the OWASP Top 10 for LLM Applications: harmful content, prompt injection, PII leakage, credential leakage, and organization-specific policy violations.

Guardrails differ from evaluation. Evaluation measures quality after the fact on sampled traffic. Guardrails are an enforcement control that sits on the request path and changes the outcome of the call. The guardrails system in Bifrost Enterprise is the second kind: it validates inputs before the provider call and outputs before the response returns to the client. A concrete example of an AI guardrail is a rule that scans every prompt for credit-card-like numbers and replaces each match with [CREDIT_CARD] before the request leaves the network.

Why AI Guardrails Belong at the Gateway

Implementing guardrails inside each application means every team writes its own PII regex, its own injection heuristic, and its own moderation call. Policies drift, coverage is uneven, and there is no single place to answer an auditor's question about what was enforced on which traffic. NIST's Artificial Intelligence Risk Management Framework: Generative AI Profile catalogs generative AI risks alongside suggested actions for managing them, and documenting which controls ran on which requests is difficult when enforcement is scattered across services.

The Bifrost platform applies guardrails at the layer every model call already passes through, which produces three properties that per-service implementations do not:

  • Uniform enforcement. One rule covers every application, provider, and model routed through the gateway.
  • Policy independent of application code. Rules change in the dashboard or API without a redeploy of the calling service.
  • A single audit surface. Violations, actions taken, and redactions are recorded in one place.

The gateway is the same control plane that carries virtual keys, budgets, and rate limits, so identity, AI governance, and content policy attach to the same request. The step-by-step guide to implementing AI guardrails at the gateway layer covers the rollout sequence. For regulated deployments, Bifrost Enterprise runs in-VPC, on-prem, and air-gapped, which keeps prompt content inside the network boundary while it is being inspected.

How Bifrost Enterprise Guardrails Work: Rules and Profiles

Guardrails in Bifrost are built from two objects: rules, which decide when a check runs and on which traffic, and profiles, which decide how content is evaluated and by which provider. A rule links one or more profiles, and a profile can serve many rules, so a PII profile written once can protect every application. Bifrost, the AI gateway built by Maxim AI, separates the two as follows:

  • Rules define when and what to evaluate. A rule is a CEL (Common Expression Language) expression with a target of llm or mcp, an apply_to setting of input, output, or both, an optional sampling_rate from 0 to 100, and a timeout.
  • Profiles define how content is evaluated. A profile is a configured guardrail provider, and profiles are reusable across rules.

One rule can link several profiles for layered protection, and one profile can serve many rules. When a check fires, the configured action applies: detect_only, block, or redact. Guardrails run in synchronous or asynchronous validation modes, and rules are testable against sample content before activation.

Note that guardrails are a Bifrost Enterprise capability, not part of the open-source distribution.

In-Line Checks: PII, Prompt Injection, Toxicity, and Secrets

Three guardrail providers are managed by the Bifrost gateway itself: Custom Regex and Secrets Detection run in-process with no external account or credentials, and Prompt Guardrails uses a judge model from a provider already configured in Bifrost. The remaining ten are first-class integrations that call a guardrail vendor you configure. The distinction matters for latency, data residency, and detection quality.

Check Native option External provider options
PII Custom Regex PII Detection template Microsoft Presidio, Azure AI Language PII, AWS Bedrock Guardrails, Lakera Guard, Repello Argus
Prompt injection Prompt Guardrails (LLM judge, block only) AWS Bedrock Guardrails, Google Model Armor, CrowdStrike AIDR, Gray Swan Cygnal, Patronus AI, Lakera Guard, Repello Argus
Toxicity and content safety Prompt Guardrails (LLM judge, block only) Azure Content Safety, AWS Bedrock Guardrails, Patronus AI, Repello Argus
Credential leakage Secrets Detection Repello Argus

PII detection and redaction

Custom Regex is a native provider that evaluates text against RE2 patterns in-process, and it ships a PII Detection template covering email addresses, US phone numbers, US Social Security numbers, credit-card-like numbers, and IPv4 addresses. Custom Regex is fast and transparent because no network call leaves the gateway. Custom Regex is also pattern matching, not semantic classification, so expect false positives and false negatives on international formats and unformatted values.

For semantic PII entity recognition, configure Microsoft Presidio for analyzer-based detection with redaction, Azure AI Language PII for configurable entity categories, or AWS Bedrock Guardrails for managed PII detection. Regex for known formats and a semantic provider for everything else is a reasonable layering: one rule can link both profiles.

The AWS Bedrock Guardrails setup for PII detection walks through the external profile configuration, and the companion post on PII filtering and compliance at the gateway layer maps each check to HIPAA, SOC 2, and GDPR requirements.

Prompt injection and AI threat detection

Prompt injection detection has no deterministic native provider, because injection is a classification problem rather than a pattern-matching one. Prompt Guardrails, available in Bifrost v2.0.0 and above, is the native semantic option: it sends the extracted text and a natural-language policy to a configured judge model and returns ALLOW or BLOCK, which suits organization-specific conduct rules but is a blocking check with no redaction.

For dedicated injection classifiers, an external profile runs AWS Bedrock Guardrails for prompt attack prevention, Google Model Armor for prompt injection and malicious URL policy, CrowdStrike AIDR for in-line AI threat detection, Gray Swan Cygnal for natural language rule definitions, Patronus AI for LLM security evaluation, Lakera Guard for prompt attack and PII screening, or Repello Argus for policy-defined injection, jailbreak, and system prompt leakage detection. The accuracy of this check is a property of the provider you select, not of the gateway; the full provider list is on the guardrails overview.

Toxicity and content safety

Toxicity checks run through an external profile or through Prompt Guardrails with a content policy. Azure Content Safety provides multi-modal moderation with severity-based filtering, AWS Bedrock Guardrails provides content filtering, and Repello Argus enforces toxicity and banned-topic policies defined in an Argus asset. Toxicity rules are typically applied as output rules, since the risk is what the model returns.

Credential leakage

Secrets Detection is the deterministic native provider for credentials. Secrets Detection uses the 222 embedded default rules from Gitleaks v8.30.1 to scan for API keys, access tokens, private keys, and other credential-shaped values, and it runs entirely inside Bifrost. The action defaults to block, with redact available for teams that would rather rewrite the secret than reject the request. Developers pasting a config file into a prompt is a common source of credential leakage, and this check catches it without a moderation service in the path.

All three native providers evaluate text only. None of them inspects image pixels or binary file contents.

AI Guardrails for MCP Tool Calls and AI Agents

AI agent guardrails have to cover the tool-execution boundary, not only the prompt, because an agent's most damaging actions happen when a tool runs with the wrong arguments. Every guardrail rule in Bifrost has a target of llm or mcp. An mcp rule runs before a tool executes, where it can inspect or redact the tool's arguments, and after the tool returns, where it can inspect or redact the result, using the same profiles, sampling, and timeout settings as LLM rules.

MCP rules expose their own CEL variables, mcp_client, mcp_tool, and mcp_arguments, alongside the shared identity fields virtual_key, customer, team, and user, so a rule can block a delete_file call from one client while allowing it from another. All supported guardrail providers can be linked to MCP rules without separate setup. The explainer on MCP guardrails and tool-level policy enforcement covers the tool-execution path in detail, and Bifrost's MCP tool filtering provides the allow-list layer beneath it.

Redaction Modes and What Guardrails Cost

Redaction replaces a detected value with a placeholder such as [EMAIL] instead of rejecting the whole request, using a replace, mask, or hash strategy, and the mode decides whether the rewrite applies to the live payload, to Bifrost logs, or to both. Redaction is where enterprise requirements usually land, because blocking a request is disruptive while redacting one is not. Bifrost-managed redaction supports three modes:

  • runtime rewrites the live request or response and stores the redacted value in logs.
  • logs_only leaves runtime content intact but redacts Bifrost logs and trace-export connector content.
  • runtime_reversible redacts both runtime content and logs using reversible placeholders.

The logs_only mode is the one teams tend to miss. Logs-only redaction lets the model receive the original text while keeping raw PII or secrets out of stored logs and exported traces, which is often the actual compliance requirement, and the guide to PII redaction at the gateway before data reaches providers covers choosing between the three modes.

Guardrails are not free, and the cost is worth stating plainly. Bifrost itself adds 11 microseconds of overhead per request at 5,000 requests per second in sustained benchmarks, but a guardrail profile that calls an external provider adds that provider's round trip to the request. Native regex and secrets checks stay in-process and avoid it.

Streaming has a specific behavior worth planning around. Detect-only and logs-only output rules observe a stream without delaying delivery. When any matched output rule can block, Bifrost holds the complete stream until generation and guardrail evaluation finish, then delivers it (optionally paced with stream_replay_event_interval_ms) or returns the intervention. The perceived time to first token increases by the model's generation time plus guardrail evaluation. Where that tradeoff is unacceptable, sampling_rate applies a rule to a percentage of traffic, and input-only rules avoid the streaming penalty entirely.

Frequently Asked Questions

Are Bifrost guardrails built into the gateway?

The guardrails engine is built into Bifrost Enterprise, including the rules engine, profile system, redaction, and audit logging. Three detection providers run natively: Custom Regex and Secrets Detection in-process, and Prompt Guardrails through a configured judge model. Semantic PII, dedicated prompt injection classifiers, and toxicity moderation run through external provider integrations that you configure.

Can guardrails check both prompts and responses?

Yes. Every rule has an apply_to setting of input, output, or both. Input rules run before the provider call, so a blocked prompt costs nothing in tokens. Output rules run before the response returns to the client.

What happens when a guardrail fires?

The rule's configured action applies: detect_only records the violation and allows the request, block returns a guardrail intervention, and redact rewrites the content using a replace, mask, or hash strategy.

Do guardrails work with agentic and tool-calling traffic?

Yes, because enforcement is on the request path rather than in the agent framework. Any call routed through the gateway is subject to the same rules regardless of which SDK, agent, or coding tool issued it, and rules with the mcp target additionally inspect tool arguments before execution and tool results after it.

What is a guardrail in AI?

A guardrail in AI is a policy control that checks model inputs or outputs against a defined rule and changes the outcome when the rule matches, by blocking, redacting, or flagging the content. Guardrails run at inference time on live traffic, which separates them from evaluation, testing, and model alignment work that happens before deployment.

What is an example of an AI guardrail?

A representative AI guardrail is a Secrets Detection rule applied to input: when a developer pastes a configuration file containing an AWS access key into a coding assistant, the gateway matches the Gitleaks pattern and blocks the request before it reaches the provider. A second common example is a PII rule that redacts email addresses to [EMAIL] in the request and in stored logs.

Are AI guardrails the same as LLM guardrails?

In practice the terms overlap. LLM guardrails refer specifically to checks on prompts and completions. AI guardrails is the broader term and, in an agentic system, also covers tool calls, retrieved documents, and MCP server responses. Bifrost applies one rule system across both, with llm and mcp targets sharing the same profiles.

Getting Started with Enterprise AI Guardrails

Enterprise AI guardrails are most effective when they are enforced once at the gateway and inherited by every application, rather than reimplemented per service. Bifrost combines native regex, secrets, and judge-model layers with integrations to the PII, prompt injection, and content safety providers already approved in most enterprise stacks, and it applies all of them through one CEL rule system with redaction and audit trails, across both model calls and MCP tool executions. For guardrails that encode company policy rather than security categories, the post on enterprise AI guardrails for company policy and compliance covers the pattern. Start with input rules for secrets and PII, add an external profile for injection and toxicity, and use sampling to tune the latency budget. The governance resources hub covers how these controls combine with virtual keys, budgets, and access policy.

To see how Bifrost Enterprise AI fit your compliance and latency requirements, book a demo with the Bifrost team.