Skip to main content

Overview

Prompt Guardrails is available in Bifrost v2.0.0 and above.
Prompt Guardrails is a Bifrost Enterprise guardrail provider that uses a configured model as a judge: an LLM, or a decision model. The judge evaluates text against a natural-language policy, and the result is one of two decisions:
  • ALLOW lets the request or response continue.
  • BLOCK returns a guardrail intervention with the judge’s reason (an LLM judge) or the profile name (a decision model judge).
Use Prompt Guardrails for semantic policies that are difficult to express as fixed patterns, such as organization-specific conduct rules, domain restrictions, or contextual content policies.
Prompt Guardrails is a blocking guardrail. It does not redact or transform content. For deterministic credential and pattern checks, use Secrets Detection or Custom Regex.

How It Works

At runtime:
  1. A guardrail rule matches an LLM request or MCP tool execution.
  2. Bifrost extracts text from the rule’s selected input, output, or both phase.
  3. Prompt Guardrails sends that text and the configured natural-language policy to the selected judge model.
  4. An LLM judge returns a JSON ALLOW or BLOCK decision with a short reason. A decision model judge returns the probability that the text violates the policy, and Bifrost blocks when it reaches the profile’s block_threshold.
  5. Bifrost continues processing or returns a guardrail intervention.
The evaluated content is sent separately from the judge’s system prompt and encoded as JSON. The internal judge request skips the guardrail plugin pipeline so it cannot recursively invoke Prompt Guardrails. Prompt Guardrails evaluates extracted text. It does not inspect image pixels or binary file contents. A phase containing no text is allowed without making a judge call.

When to Use Prompt Guardrails

Prompt Guardrails is a good fit when a policy depends on meaning or context:
  • Block requests asking the model to impersonate a company employee.
  • Prevent responses from making definitive medical diagnoses.
  • Restrict discussion of unreleased product information.
  • Enforce a customer-specific communication or content policy.
Prefer deterministic providers when the condition has an exact representation: You can attach multiple profiles to one rule for layered protection.

Judge Model Requirements

The selected judge provider must already be configured and enabled in Bifrost. An LLM judge model must support Chat Completions or the Responses API; a decision model judge has its own requirements, covered in Decision Model Judges. For an LLM judge, Bifrost prefers Chat Completions and switches to the Responses API when the provider requires it. An LLM judge request sends only the system prompt, the evaluated content, and the output-token limit. It does not send response_format or sampling parameters such as temperature, so models without structured-output support, including self-hosted models, can be used as judges. The system prompt instructs the judge to return the JSON decision, and Bifrost validates the reply strictly. Model-catalog metadata is not required. When the catalog describes the selected model, the UI shows its advertised capabilities as hints, but Verify is the authoritative check because it calls the model.
Reasoning models spend output tokens on reasoning before they write the decision. If verification reports that the judge returned no text decision, increase max_output_tokens.

Decision Model Judges

Set judge_type to decision to judge with a decision model instead of an LLM. Decision models answer a typed question with a calibrated probability rather than generated text, so they are typically faster and cheaper per evaluation than an LLM judge, and the blocking point is a number you tune instead of a prompt you rewrite. For each evaluation, Bifrost sends one predicate question on the /v1/decisions path: its instructions ask whether the text violates the policy, and its criteria define true as a violation and false as text that is unrelated to the policy or only breaks some other policy. How clear a violation must be is left to block_threshold. The extracted text is the input. Bifrost reads the answer’s probability and:
  • Blocks when the probability is at or above block_threshold (default 0.9).
  • Allows when it is below.
Only native decision models can judge. A chat model returns unsupported_operation, and the compat setting convert_decision_to_responses does not apply to judge requests, so a decision profile never falls back to emulating the decision through a chat model. Use an LLM judge for chat models. Creating or verifying a decision profile with prompt_template or max_output_tokens, or an LLM profile with block_threshold, is rejected. A profile without judge_type is an LLM judge, so existing profiles are unchanged. A refusal, a missing answer, or an answer without a probability is a judge error. Like every other judge error, it is logged and the guardrail fails open; see Decisions and Failure Behavior.

Configuration

Prompt Guardrail Configuration panel with judge provider, judge model, and natural-language rule fields
  1. Go to Guardrails > Providers.
  2. Select Prompt Guardrails.
  3. Click Add Configuration.
  4. Enter a descriptive Name.
  5. Choose the Judge Type: LLM or Decision Model.
  6. Select the Judge Provider and Judge Model. With Decision Model, only providers that serve decision models are listed.
  7. Enter the natural-language policy in Rule.
  8. For a decision model, set the Block Threshold.
  9. Optionally expand Additional Configuration to change the timeout and, for an LLM judge, the system prompt or output-token limit.
  10. Turn on Enabled if the profile should run as soon as it is attached.
  11. Click Verify and Save. Bifrost runs a live judge request first and saves the profile only if it passes.
  12. Go to Guardrails > Configuration and attach the profile to a guardrail rule.
When you edit an existing profile, Re-verify runs the live check without saving, and Verify and Save saves your changes after they pass verification. A change you already checked with Re-verify is saved without a second check. Each judge type keeps its own provider and model, so switching the judge type and back restores them.

Configuration Fields

The default system prompt treats the configured rule as the complete policy. It blocks only clear rule violations and allows unrelated, ambiguous, or uncertain content. If you customize the prompt, preserve {{rule}}; Bifrost always sends the evaluated content separately and appends the required JSON output format to every system prompt, so a custom template does not need to describe the response shape.

Prompt Policy vs. Guardrail Rule

Prompt Guardrails uses two different kinds of rules: The guardrail rule also owns input, output, or both, sampling, execution timeout, maximum turns, streaming replay settings, and the linked profile IDs.
Guardrail rule editor showing target, input and output phases, linked profiles, sampling, and timeout

What Verify Checks

Verify performs a real internal judge request with the selected provider and model. It checks:
  • Configuration-field validation.
  • Provider configuration and model reachability.
  • Chat Completions or Responses API support for an LLM judge, or decisions support for a decision model judge.
  • The judge model’s ability to return a valid JSON ALLOW or BLOCK decision, or a violation probability. For a decision model, the result names the probability and whether it would block at the configured threshold.
Verification evaluates a dummy text value, "test". It does not test whether your policy makes the correct decision on real application content.
A successful verification proves configuration and connectivity, not policy quality. Test representative allowed, blocked, ambiguous, and adversarial inputs before enabling the profile in production.

Decisions and Failure Behavior

An LLM judge returns:
For BLOCK, Bifrost returns a guardrail intervention containing the judge’s short reason. For ALLOW, processing continues normally. A decision model judge has no reason to return, so its intervention names the profile, and the violation probability and threshold are recorded in the guardrail log. If the judge request times out, the provider rejects it, the response cannot be parsed, or a decision model refuses or returns no probability, Bifrost logs the provider failure and continues the application request or response. Prompt Guardrails therefore fails open on judge/runtime errors. Monitor guardrail logs and alerts if the policy protects a security-critical boundary.

Streaming and MCP

Prompt Guardrails can be attached to LLM and MCP guardrail rules:
  • For LLM input rules, it evaluates extracted request text before the model call.
  • For LLM output rules, it evaluates extracted response text.
  • For MCP input rules, it evaluates text extracted from tool arguments before execution.
  • For MCP output rules, it evaluates text extracted from a successful tool result before it is returned.
Because Prompt Guardrails can block output, matched streaming-output rules hold the completed stream until the judge allows or blocks it. See Streaming Output Guardrails for replay pacing and delivery behavior.

Cost, Latency, and Logs

Each evaluated input or output phase makes an additional request to the judge: a chat or Responses request for an LLM judge, a decisions request for a decision model judge. Multiple matching rules or Prompt Guardrails profiles can produce multiple judge calls for one application request. Judge calls add:
  • Provider latency, bounded by the configured timeout.
  • Prompt and completion token usage.
  • Judge-model cost when pricing is available in the model catalog.
In LLM Logs, open a request and review Guardrail Details to see the rule, phase, action, guardrail profile, judge provider and model, token usage, and block reason. Judge-model cost is included in the request cost calculation when Bifrost has pricing for the selected model.

Writing Effective Policies

Write one narrow, testable policy per profile. For example:
Recommended practice:
  • State exactly what must be blocked and what closely related content is allowed.
  • Test clear allow, clear block, ambiguous, and prompt-injection examples.
  • Keep deterministic checks in Secrets Detection or Custom Regex.
  • Use rule sampling when full coverage is not required and judge cost is significant.
  • Use descriptive profile names so logs identify the policy without opening its configuration.
  • Review judge reasons and false positives before expanding traffic coverage.

Troubleshooting

For shared rule configuration, CEL variables, and provider management, see the Guardrails overview.