/v1/chat/completions unchanged.
Each config step is role-gated. Authoring a guardrail needs Developer+;
changing retention or compliance residency needs workspace Admin.
Reading the Matches feed is open to any Member.
1. The pii safe logging pipeline in three moves
A PII-safe pipeline is three independent controls, each one a switch you flip once for the whole workspace:Mask at the edge
A
pii guardrail rule redacts emails, SSNs, cards and more to typed
tags before the upstream model ever sees the request.Log no raw content
The guardrail Log raw content toggle is off by default, so the
match feed records that a rule fired, never the matched substring.
Clamp retention
Request-log retention defaults to 30 days and is server-clamped to
a 180-day hard maximum — short-lived by design.
2. Mask PII before the model sees it
Create a guardrail with a singlepii rule on the input stage and the
mask action. On a mask action each match is replaced with a typed tag —
an email becomes [EMAIL], an SSN becomes [SSN] — so the upstream model
receives a sanitized request, not the original.
Draft a reply to [EMAIL] about her SSN [SSN]. The original
values never leave the gateway.
Input-stage masking is what a PII-safe pipeline relies on — it scrubs the
request before the upstream call. Output-stage masking works on both
non-streaming and streaming responses (streaming rewrites each chunk in
place), so you can also redact PII the model emits.
3. Keep raw content out of your logs
Every rule that fires records a match — its type, action, stage, and a detail string. Whether the match also stores the matched substring (the actual email address, the actual SSN) is gated by the guardrail’s Log raw content toggle, which is off by default — the privacy-conservative posture.With Log raw content off, the Matches feed shows
that a
pii rule masked an email at the input stage, but never the
address itself. That’s exactly what you want for a PII-safe pipeline: full
auditability of what fired, zero retained PII. Leave it off in production;
turn it on per-guardrail only for short-lived triage. The toggle is
non-retroactive.GET /api/guardrail/match,
Member). Group and filter by guardrail, rule type, and action to see your
masking rate without ever surfacing a real value. Marking a match a false
positive is an Admin action (POST /api/guardrail/match/:id/mark-fp).
4. Clamp how long request logs live
Request-log capture is an opt-in troubleshooting feature, and when it’s on, retention is bounded:| Setting | Value | Behavior |
|---|---|---|
| Default retention | 30 days | Applied when no per-workspace value is set. |
| Hard maximum | 180 days | Any longer value is server-clamped down. |
5. Right-to-erasure and residency
Two more controls round out a compliant pipeline:Erasure cascade (DSAR)
Erasure cascade (DSAR)
A user self-deletion enters a 30-day grace window, after which PII
is scrubbed and a cascade purge removes that user’s request logs,
guardrail matches, and firewall events together — so no
artifact outlives the erasure request.
Compliance report residency
Compliance report residency
Set the region your compliance report artifacts are pinned to
(
us, eu, uk, ap, cn, global) via
PUT /api/compliance/residency (Admin). Cross-region reads of a
report are withheld. This pins the report artifact region — it is not
inference-data geo-pinning.6. Verify before you ship
Prove the masking does what you expect before any traffic depends on it:Sandbox the rule
Open the Test tab in the guardrail editor, paste sample text with a
real-looking email and SSN, pick the
input stage, and run. The sandbox
returns the verdict and the rendered text ([EMAIL], [SSN]) without an
upstream call or any quota spend.Eval against a corpus
The Eval tab runs the policy over bundled or custom JSONL corpora so
you can measure catch rate and false positives before going live.
Related
Guardrails reference
The full PII entity set, custom entities, per-entity overrides, and the
Matches feed.
Secure a RAG pipeline
Grounding and PII controls for retrieval-augmented agents.
SOC 2 evidence
Turn guardrail and firewall activity into signed audit reports.
Data exfiltration
The threat model behind keeping PII off the wire and out of logs.
