Guardrail Mesh

Collect every verdict, fuse on a quorum, redact-and-continue, with a verdict cache

Overview

The serial guardrail chain blocks on the first detector that flags. The mesh runs the input detectors together, collects every verdict, and fuses them into one decision under a rule you set. It can block on a quorum rather than any single flag, mask a flagged prompt and let it through, run the cheap detectors first under a latency budget, and cache verdicts so a repeated prompt skips the work. It is off by default; with no mesh block the serial block-on-any behavior is unchanged.

Configuration

guardrails:
  input:
    - type: injection
    - type: pii
      patterns: [email]
    - type: regex_guard
      action: block
      config:
        deny: [forbidden-term]
  mesh:
    block_threshold: 2     # block only when >= 2 detectors flag (1 = block-on-any)
    redact_on_flag: true   # below the threshold, mask the prompt and continue
    cache: true            # reuse a verdict for a repeated prompt
    latency_budget_ms: 50  # stop launching expensive detectors past the budget

Fusion

block_threshold is the quorum: the request is blocked when flagged_count >= block_threshold. 1 reproduces the serial behavior; 0 never blocks on the count. With redact_on_flag, a request flagged below the threshold is masked by the PII redactor and continues. The full label set is published to the policy plane's ai.guardrails.* namespace, so a CEL rule can fuse the verdicts further.

Cascade and cache

Detectors run cheap-first. With latency_budget_ms set, expensive classifiers are skipped once the budget is spent, so the mesh degrades gracefully under load. With cache on, a verdict is cached by a combined hash of the prompt and the guardrail set, so a repeated prompt skips re-running the detectors.