Skip to main content

Configuration Structure

Guardrails are configured in your Hub YAML configuration file. The configuration has three main sections:
  1. Providers - Define guardrail evaluation services
  2. Guards - Configure individual guardrail instances
  3. Pipelines - Attach guards to specific pipelines

Provider Configuration

Providers are the services that can execute guardrails. Define your providers first, then reference them in guard configurations.

Traceloop Provider

Guard Definition

Guards are configured instances of evaluators. Each guard defines what to check, when to check it, and how to respond to failures.

Complete Guard Configuration

Guard Fields Reference

Mode: Pre-call vs Post-call

pre_call - Executes on user input before the LLM call:
post_call - Executes on LLM output after the response:
Some evaluators work best in specific modes (e.g., prompt-injection in pre_call), while others are valuable in both modes (e.g., pii-detector). See the Evaluators Reference for recommendations.

On Failure: Block vs Warn

block - Return HTTP 403 when evaluation fails:
Response when blocked:
warn - Add warning header but continue:
Response includes header:

Required: Fail-Closed vs Fail-Open

The required flag controls behavior when the evaluator service is unavailable, times out, or errors. Default: false required: true (Fail-Closed) - Treat evaluator errors as failures:
If evaluator unavailable → HTTP 403 (same as evaluation failure) required: false (Fail-Open) - Continue when evaluator errors:
If evaluator unavailable → Add warning header, continue request

Parameters

Each evaluator accepts specific configuration parameters. Common parameters include:
See the Evaluators Reference for complete parameter documentation for each evaluator.

Pipeline Integration

Attach guards to pipelines to enable guardrails for specific endpoints. Each pipeline request will perform the attached guards.

Basic Pipeline Configuration

Multiple Pipelines with Different Guards

Runtime Guard Control

Add additional guards at runtime using the x-traceloop-guardrails header with a comma-separated list of guard names. This is additive only - you cannot remove pipeline guards via headers.
You can configure pipelines with no guards and rely entirely on the header to specify which guards to run. This provides maximum flexibility for dynamic guard selection per request.

Header Format

Next Steps

Evaluators Reference

Complete reference for all 12 evaluators with parameters