Skip to main content

What Are Validators in TruGuard?

In TruGuard, validators are the core building blocks used to inspect, assess, and enforce trust and safety rules on AI inputs and outputs. Conceptually, a validator is an automated check that evaluates AI interactions against a specific risk dimensionβ€”such as security, safety, privacy, or policy complianceβ€”and determines whether the content is acceptable or requires remediation. Validators do not generate or modify AI responses by themselves. Instead, they act as decision points in the AI request–response lifecycle, enabling TruGuard to:
  • Detect risks early
  • Apply consistent enforcement
  • Maintain observability and auditability across AI systems

Role of Validators in the TruGuard Pipeline

Validators operate as guardrails around AI systems. They can be applied to:
  • Input Guardrails – Applied before the model processes the request (validates user prompts and system instructions)
  • Output Guardrails – Applied before the response is returned to the user (validates model-generated responses)
Each validator evaluates content independently and produces a validation outcome. These outcomes can then trigger actions such as filtering, masking, encryption, or failure handling. This modular approach allows TruGuard to combine multiple validators into a layered protection system rather than relying on a single safety mechanism.

Input Guardrails

Input guardrails validate prompts and system instructions before they reach the model.

1. Secrets

Detects exposed secrets, credentials, and sensitive tokens using advanced pattern recognition and entropy analysis. Identifies API keys, authentication tokens, private keys, database credentials, OAuth tokens, and other sensitive material across various platforms and services (AWS, GitHub, GitLab, Slack, Stripe, SendGrid, Discord, Telegram, and more).

2. Bias

Detects biased or stereotyping language in prompts and responses. Configuration Parameters:
  • threshold – Confidence score required to flag biased content. Default: 0.35

3. Regex

Detects content by matching it against custom regular expression patterns. Ideal for enforcing strict formats and identifying structured data like tokens or IDs. Configuration Parameters:
  • pattern – Regular expression patterns to validate against
  • match_type – How matches are interpreted:
    • blacklist – Fails validation when pattern is matched (default)
    • whitelist – Passes validation only when pattern is matched
  • flags – Regex flags (case-sensitive by default)

4. Blocklist

Flags content containing specific words or phrases you define. Useful for blocking known or undesired language. Configuration Parameters:
  • blocklist – List of words or phrases to be flagged
  • case_sensitivity – Whether matching respects letter case. Default: false
  • enable_fuzziness – Enables approximate matching to detect obfuscated or misspelled terms. Default: false
  • fuzziness – Maximum Levenshtein distance when fuzzy matching is enabled. Default: 1

5. Content Safety

Uses AI to classify content across predefined safety categories based on meaning and intent rather than exact wording. Configuration Parameters:
  • threshold – Confidence score required to flag unsafe content. Default: 0
  • categories – Safety categories to validate against (violence, hate, self-harm, sexual content, etc.)

6. Prompt Injection

Identifies attempts to manipulate or override system instructions and alter AI behavior. Configuration Parameters:
  • threshold – Confidence score required to flag prompt injection attempts. Default: 0

7. PII

Detects personal and sensitive information in content and enables actions such as masking or redaction. Configuration Parameters:
  • entities – PII entity types to detect (names, phone numbers, email addresses, IDs, etc.)
  • threshold – Confidence score required to flag PII. Default: 0.5

8. Toxicity

Detects toxic, insulting, threatening, or obscene language. Configuration Parameters:
  • threshold – Confidence score required to flag toxic content. Default: 0.5
  • categories – One or more toxicity categories to detect:
    • Toxicity
    • Severe Toxicity
    • Obscene
    • Threat
    • Insult
    • Identity Attack
    • Sexual Explicit

9. Code Detection

Detects source code in prompts and responses so you can block or redact code leakage. Configuration Parameters:
  • threshold – Confidence score required to flag code. Default: 0.95

Output Guardrails

Output guardrails validate model-generated responses before returning to users.

1. Alignment Check

LLM judge that checks whether an agent’s selected action and plan/trace still align with the user’s goal. Requires an agent execution trace at runtime (fail-closed if missing). Required Input Format:
Note: trace array can be empty [] on the first step. Configuration Parameters:
  • prompt – The user query
  • response – The AI-generated response to validate
  • trace – Agent execution trace with roles and content. Can be empty on first turn
  • threshold – Confidence score for alignment detection. Default: 0.5

2. Blocklist

Flags content containing specific words or phrases you define. Useful for blocking known or undesired language. Configuration Parameters:
  • blocklist – List of words or phrases to be flagged
  • case_sensitivity – Whether matching respects letter case. Default: false
  • enable_fuzziness – Enables approximate matching. Default: false
  • fuzziness – Maximum Levenshtein distance when fuzzy matching is enabled. Default: 1

3. Regex

Detects content by matching it against custom regular expression patterns. Ideal for enforcing strict formats and identifying structured data like tokens or IDs. Configuration Parameters:
  • pattern – Regular expression patterns to validate against
  • match_type – How matches are interpreted:
    • blacklist – Fails when pattern is matched (default)
    • whitelist – Passes only when pattern is matched
  • flags – Regex flags (case-sensitive by default)

4. Content Safety

Uses AI to classify content across predefined safety categories based on meaning and intent rather than exact wording. Configuration Parameters:
  • threshold – Confidence score required to flag unsafe content. Default: 0
  • categories – Safety categories to validate against (violence, hate, self-harm, sexual content, etc.)

5. PII

Detects personal and sensitive information in content and enables actions such as masking or redaction. Configuration Parameters:
  • entities – PII entity types to detect (names, phone numbers, email addresses, IDs, etc.)
  • threshold – Confidence score required to flag PII. Default: 0.5

6. Bias

Detects biased or stereotyping language in prompts and responses. Configuration Parameters:
  • threshold – Confidence score required to flag biased content. Default: 0.35

7. Toxicity

Detects toxic, insulting, threatening, or obscene language. Configuration Parameters:
  • threshold – Confidence score required to flag toxic content. Default: 0.5
  • categories – One or more toxicity categories to detect:
    • Toxicity
    • Severe Toxicity
    • Obscene
    • Threat
    • Insult
    • Identity Attack
    • Sexual Explicit

8. Factual Consistency

Checks whether the model response is factually supported by the prompt context (for RAG or grounded flows). Required Input Format:
Configuration Parameters:
  • prompt – The user query
  • response – The AI-generated response to validate
  • context – Reference material the response should be grounded in
  • threshold – Confidence score required to flag code. Default: 0.95

9. Code Detection

Detects source code in prompts and responses so you can block or redact code leakage. Configuration Parameters:
  • threshold – Confidence score required to flag code. Default: 0.95

10. Secrets

Detects exposed secrets, credentials, and sensitive tokens using advanced pattern recognition and entropy analysis. Identifies API keys, authentication tokens, private keys, database credentials, OAuth tokens, and other sensitive material across various platforms and services (AWS, GitHub, GitLab, Slack, Stripe, SendGrid, Discord, Telegram, and more).