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)
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 againstmatch_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 flaggedcase_sensitivityβ Whether matching respects letter case. Default: falseenable_fuzzinessβ Enables approximate matching to detect obfuscated or misspelled terms. Default: falsefuzzinessβ 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: 0categoriesβ 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.5categoriesβ 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:trace array can be empty [] on the first step.
Configuration Parameters:
promptβ The user queryresponseβ The AI-generated response to validatetraceβ Agent execution trace with roles and content. Can be empty on first turnthresholdβ 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 flaggedcase_sensitivityβ Whether matching respects letter case. Default: falseenable_fuzzinessβ Enables approximate matching. Default: falsefuzzinessβ 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 againstmatch_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: 0categoriesβ 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.5categoriesβ 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:promptβ The user queryresponseβ The AI-generated response to validatecontextβ Reference material the response should be grounded inthresholdβ 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