Principle:Truera Trulens Output Blocking Guardrail
| Knowledge Sources | |
|---|---|
| Domains | Guardrails, Safety |
| Last Updated | 2026-02-14 08:00 GMT |
Overview
A runtime guardrail pattern that evaluates application output against a quality or safety threshold before returning it to the user.
Description
Output Blocking Guardrail implements a post-processing safety gate. It decorates an application method and evaluates its output after execution. If the output scores below the threshold, a safe default value is returned instead.
This prevents harmful, low-quality, or policy-violating outputs from reaching the user, serving as the last line of defense in the application pipeline.
Usage
Use this principle when you need to validate LLM outputs before they reach users. Apply the decorator to the generation or response method. Common use cases include blocking toxic outputs, hallucinated content, or policy-violating responses.
Theoretical Basis
Pseudo-code Logic:
# Abstract output blocking
output = generate_response(user_input)
score = evaluate(output)
if score < threshold: # (or > for inverse metrics)
return safe_default_response
else:
return output