Last updated: November 30, 2026
Langfuse AI Gateway guardrails, released November 27, 2026, let organizations block, redact or log PII, secrets, prompt injection and custom patterns in model requests and responses. On November 30, Langfuse added OpenAI Moderation, Lakera Guard and decision-model checks as guardrail options. The gateway is still in public beta.
Contents
- What changed in November 2026
- Actions: block, redact or log
- Evaluation scopes and streaming
- Built-in rules
- External providers and decision models
- How to set up a guardrail
- Monitoring flagged requests
- Plans and availability
- Before and after the guardrails release
- Limitations and failure behavior
- Frequently asked questions
What changed in November 2026
The Langfuse AI Gateway sits between your apps and the model provider and traces each call. Organization owners and admins manage them under AI Gateway → Guardrails; other members with gateway access get a read-only view (guardrails docs).
| Date (2026) | Release | What it adds |
|---|---|---|
| November 27 | Guardrails | Built-in PII, secrets, prompt injection and custom pattern rules; Amazon Bedrock guardrail connection; Block, Redact and Log actions; targeting by user and API key (changelog) |
| November 30 | OpenAI Moderation and Lakera Guard | External providers for harmful content, prompt attacks, PII and malicious links (changelog) |
| November 30 | Decision-model guardrails | Yes/no questions with per-question probability thresholds, backed by a decision model on an OpenAI or Vercel AI Gateway connection, with a test panel for sample prompts (changelog) |
Actions: block, redact or log
Every guardrail has an On match action (guardrails docs):
- Block rejects the request or response with HTTP
400and the codeguardrail_blocked. Blocked requests never reach the provider. - Redact replaces matched text with a replacement label,
[REDACTED]by default, before forwarding the request or returning the output. - Log lets traffic pass unchanged and records the match on the generation.
When several guardrails apply, all run and Block wins. In FULL ingestion mode, redaction happens before the trace is captured, so scrubbed values are not stored in Langfuse.
Evaluation scopes and streaming
The Runs on setting decides what each guardrail reads. The options are Last turn (the default), Entire input, Output, Last turn & output, and Entire input & output (guardrails docs).
Use Last turn for Block rules, since earlier turns already passed, and Entire input for Redact rules so earlier turns are not resent unredacted. Any Output check makes the gateway buffer the full response, including SSE streams, before returning it, so streaming stops for those requests.
Built-in rules
| Built-in rule | What it matches |
|---|---|
| PII | Emails, US SSNs and ITINs, UK NINOs, EU VAT and German tax IDs, phone numbers, cards, IBANs and IP addresses |
| Secrets and API keys | Provider API keys, tokens, database connection URLs, JWTs, PEM private keys, plus up to 20 custom prefixes |
| Prompt injection (heuristic) | Instruction overrides, system prompt extraction, jailbreak phrases and hidden Unicode; defaults to Log |
| Keyword list | Up to 500 ASCII words or phrases, 100 characters each, whole-word and case-insensitive |
| Custom regex | Rust regular expressions in ASCII mode, up to 500 characters |
The prompt injection rule catches common phrases, not novel attacks, so it starts in Log mode (guardrails docs).
External providers and decision models
External guardrails are added under Add guardrail → Integrations (guardrails docs):
- Amazon Bedrock Guardrails (Enforce or Log): uses a Bedrock API key or an IAM role with
bedrock:ApplyGuardrail. Bedrock bills per text unit, so use Last turn. - OpenAI Moderation (Block or Log): the free Moderation API with
omni-moderation-latest, text only, US or EU region. - Lakera Guard (Block or Log): EU, US or Singapore region. The Lakera project must be in Enforce mode, because Detect mode never flags.
- Decision model (Block or Log): up to 20 yes/no questions on an enabled OpenAI or Vercel AI Gateway connection, with no separate API key.
Decision models are the most flexible option. Each question gets its own probability threshold, and you can test sample prompts before saving (decision-model changelog).
How to set up a guardrail
- Sign in as an organization owner or admin and open AI Gateway → Guardrails (guardrails docs).
- Select Add guardrail and pick a built-in rule, or open Integrations for Bedrock, OpenAI Moderation, Lakera Guard or a decision model.
- Choose the On match action. Start on Log to measure false positives.
- Set Runs on to match the action.
- Under Applies to, choose Everyone or up to 100 specific users and gateway API keys.
- Save and send a test request; a blocked call returns
400guardrail_blocked. - Review the Flagged 7d traces, then tighten the action.
Monitoring flagged requests
The Flagged requests chart plots matches over time, and each guardrail’s Flagged 7d count opens its traces. Both need USAGE or FULL ingestion mode (guardrails docs).
Redacted or logged generations get level WARNING and blocked calls get ERROR, with the result in the langfuse.gateway.guardrails.outcome metadata key.
Plans and availability
The Langfuse pricing page lists the AI Gateway on all four cloud plans (pricing):
| Plan | Price | Included usage |
|---|---|---|
| Hobby | Free | 50k units per month |
| Core | $29 per month | 100k units, then $8 per 100k units |
| Pro | $199 per month | 100k units, then $8 per 100k units |
| Enterprise | $2,499 per month | 100k units, then $8 per 100k units |
Units are tracing data points; model tokens are billed by your provider.
Before and after the guardrails release
| Area | Before November 27 | After November 30 |
|---|---|---|
| Content policy at the gateway | No guardrails feature | Block, Redact or Log on requests and responses |
| PII and secret handling | No built-in detection or redaction | Built-in detection and redaction before tracing |
| External screening | Not available | Bedrock, OpenAI Moderation, Lakera Guard |
| Custom policy checks | Not available | Keyword lists, regex and decision-model questions |
Based on the November 2026 changelog entries (guardrails changelog). Related: our LiteLLM 1.111 proxy guide, OpenRouter management keys guide, OpenAI Agents SDK 0.26 guardrails guide, LangGraph CLI 0.4.44 guide and CrewAI 1.15.46 guide.
Limitations and failure behavior
- Enforcing guardrails fail closed. Provider errors or timeouts (3 seconds by default) return
429or503(guardrails docs). - Built-in rules scan up to 1 MiB per scope; response buffers stop at 8 MiB (JSON) and 32 MiB (SSE).
- Response guardrails run only on
/openai/v1/responses,/openai/v1/chat/completionsand/anthropic/v1/messages. Embeddings, Decisions andcount_tokensskip them. - The gateway is in public beta, so behavior can still change.
Frequently asked questions
What are Langfuse AI Gateway guardrails?
They are rules that inspect model requests and responses passing through the Langfuse AI Gateway. Each rule can block, redact or log PII, secrets, prompt injection phrases, keywords, custom patterns or content flagged by an external provider. The feature launched on November 27, 2026, and is in public beta.
Which external guardrail providers does Langfuse support?
As of November 30, 2026, the documentation lists Amazon Bedrock Guardrails, OpenAI Moderation, Lakera Guard and decision models on an existing OpenAI or Vercel AI Gateway connection. Bedrock supports Enforce and Log; the others support Block and Log.
What happens when a guardrail blocks a request?
The gateway rejects the call with HTTP 400 and the error code guardrail_blocked, naming the guardrail. Blocked requests never reach the model provider. When several guardrails apply, all of them run, and Block takes precedence over Redact and Log.
Is the Langfuse AI Gateway free?
The pricing page lists the AI Gateway on every plan, including the free Hobby plan with 50k units a month. Paid plans start at $29 a month for Core and $199 a month for Pro. Model usage itself is billed by your provider.
Sources
- Guardrails (Langfuse AI Gateway docs)
- Block and redact PII and secrets with AI Gateway guardrails (Langfuse changelog)
- Screen AI Gateway traffic with OpenAI Moderation and Lakera Guard (Langfuse changelog)
- Use decision models as AI Gateway guardrails (Langfuse changelog)
- Langfuse pricing
Featured image: Langfuse by ClickHouse wordmark, official brand asset from the Langfuse Brand Assets page, used for editorial purposes. Langfuse is a trademark of its owner. FreeAnswers is not affiliated with Langfuse or ClickHouse.
Related guide: Dify 1.20.0 guide: Human Input approvals, OpenTelemetry traces and malware scanning.
1 thought on “Langfuse AI Gateway Guardrails: Power-User Guide to PII Redaction, Lakera and Decision Models”