Skip to main content

Overview

Bifrost Enterprise supports Google Cloud Model Armor as a guardrail provider for LLM request and response traffic. Use it when your safety and data protection policies are managed in Google Cloud and you want Bifrost to enforce those policies inline before prompts reach an LLM and before model responses are returned. Google owns the Model Armor template. Bifrost owns the gateway enforcement path: it selects when to call Model Armor, sends the relevant text to the template, then blocks or rewrites the Bifrost request/response based on the sanitize result.
Streaming output: When this profile is used in an output or both rule, Bifrost accumulates the stream until the model response is complete, then checks the full response. It does not check individual stream chunks. See Streaming Output Guardrails for details.

When To Use It

Google Model Armor is useful for:
  • Blocking prompt injection and jailbreak attempts
  • Screening responses for unsafe generated content
  • Detecting responsible AI safety categories such as hate speech, harassment, sexually explicit content, and dangerous content
  • Detecting malicious URLs in prompts or responses
  • Blocking sensitive data with Sensitive Data Protection inspection
  • Redacting or replacing sensitive data with Sensitive Data Protection de-identification templates
  • Keeping policy configuration in Google Cloud while enforcing it at the Bifrost gateway
Bifrost follows the Model Armor template result. If Model Armor returns a non-mutable match, Bifrost returns GUARDRAIL_INTERVENED. If Model Armor returns SDP de-identified text, Bifrost applies the transformed text and allows the request or response to continue.

Prerequisites

  • Bifrost Enterprise with the guardrails plugin enabled
  • The Model Armor API enabled in your Google Cloud project
  • A Model Armor template in the project and location you want to use
  • Network egress from Bifrost to the Model Armor regional endpoint over HTTPS
  • A Google principal with roles/modelarmor.user or a higher Model Armor role on the project or template
If your Model Armor template uses advanced Sensitive Data Protection (SDP), create the SDP inspect and de-identify templates before you attach them to the Model Armor template. Keep those SDP templates in the same location required by your Model Armor template configuration.

Set Up Google Cloud

  1. In the Google Cloud console, open APIs & Services and enable Model Armor API.
  2. Open Security > Model Armor.
  3. Create a template.
  4. Note the template values Bifrost needs:
    • Project ID: for example my-gcp-project
    • Location: for example us, eu, or us-central1
    • Template ID: for example bifrost-prod
  5. Grant the Bifrost runtime identity roles/modelarmor.user or higher:
    • Go to IAM & Admin > IAM.
    • Click Grant access.
    • Add the service account or user identity Bifrost will use.
    • Select Model Armor User.
    • Save.
For direct Google Cloud API details, see Google’s sanitizeUserPrompt and sanitizeModelResponse references.

Authentication

Bifrost supports two OAuth-based Google authentication modes.

Google ADC

Application Default Credentials (ADC) lets Google client libraries find credentials from the environment. Bifrost uses ADC when auth_type is default_credential or omitted. Common ADC sources:
  • GOOGLE_APPLICATION_CREDENTIALS pointing to a service account key file
  • Local credentials from gcloud auth application-default login
  • An attached service account on Google Cloud compute runtimes
  • Workload Identity on GKE or other supported runtimes
Local development:
Service account file through ADC:
With ADC, no key JSON is stored in the Bifrost profile. Grant the identity that ADC resolves to the Model Armor User role or higher.

Service Account Key JSON

Use this mode when the Model Armor profile should authenticate with one specific service account key. To create a key in Google Cloud:
  1. Go to IAM & Admin > Service Accounts.
  2. Select or create the service account that Bifrost should use.
  3. Open Keys.
  4. Click Add key > Create new key.
  5. Choose JSON and download the file.
  6. Grant that service account Model Armor User or higher.
In Bifrost, either paste the full JSON into Service Account Key JSON or store it in an environment variable:
Then set:

How It Works

  1. Create a Bifrost guardrail provider with provider_name: "model-armor".
  2. Attach that provider configuration to one or more guardrail rules.
  3. When an input rule matches, Bifrost sends text to sanitizeUserPrompt.
  4. When an output rule matches, Bifrost sends text to sanitizeModelResponse.
  5. If Model Armor returns no match, Bifrost allows the content unchanged.
  6. If Model Armor returns a blocking match, Bifrost returns GUARDRAIL_INTERVENED.
  7. If Model Armor returns SDP de-identified text, Bifrost replaces the original text with the transformed text and continues.

API Calls

Bifrost sends text-only Model Armor requests:
For output checks, Bifrost sends:
The endpoint is built from the configured project, location, and template:
Bifrost currently sends text content to Model Armor. It does not send file bytes or per-request multi-language detection metadata.

Configuration Fields

Configuration

  1. Go to Guardrails > Providers.
  2. Select Google Model Armor.
  3. Click Add Configuration.
Google Model Armor configuration in Bifrost dashboard
  1. Enter a descriptive Name, such as model-armor-prod.
  2. Choose an authentication method:
    • Google ADC to use credentials available to the Bifrost runtime.
    • Service Account Key JSON to paste a key or reference an environment variable containing the full key JSON.
  3. Enter Project ID, Location, and Template ID.
  4. Leave Base URL blank unless you are routing through a proxy or custom endpoint.
  5. Set the timeout and save the configuration.
  6. Go to Guardrails > Configuration and attach the Google Model Armor profile to an input, output, or both-phase rule.

Policy Outcomes

Bifrost records Model Armor usage metadata for logs and spans:
  • Evaluated text count
  • Matched text count
  • Transformed text count
  • Blocking filter names
  • Invocation result values

Blocked Error Response

When Google Model Armor blocks content, Bifrost returns HTTP 400 with type: "guardrail_intervention". Trimmed example:
If Model Armor reports a match without a specific mapped filter name, the message is:
Model Armor output inspection and de-identification only apply to non-streaming response bodies today. Streaming output mutation is not supported; input guardrails can still run before a streaming request is sent to the LLM.

Troubleshooting

Google Cloud References

For general rule and profile concepts, see Guardrails. For direct config.json setup, see Guardrails in config.json.