ADR 004: Implementation of Pre/Post-Execution Guardrails and Verification Layer
- Status: Accepted
- Date: 2026-08-06
- Deciders: Software Architecture Team
Context and Problem Statement
LLMs can produce non-deterministic outputs, hallucinations, or security vulnerabilities (Prompt Injection, PII leakage). In a production multi-agent system, passing raw unvalidated outputs directly from one agent to another poses severe operational and security risks.
Decision Drivers
- Security & Compliance: Prevent PII/GDPR data leakage and mitigate prompt injection attacks.
- Data Integrity: Guarantee that agent outputs strictly conform to required JSON schemas before proceeding to downstream workflow nodes.
- Deterministic Confidence: Verification must be an explicit platform layer, not assumed.
Decision Outcome
Chosen Option: Implement a dedicated Guardrails & Verification Pipeline between workflow node executions.
Pipeline Stages
- Pre-Execution Stage:
- Prompt Sanitization: Detect and block prompt injection patterns.
- PII Masking: Mask sensitive user data (emails, credit cards, SSNs) before sending prompts to external LLM providers.
- Post-Execution Stage:
- Schema Validation: Verify output matches target JSON schema.
- Hallucination & Toxicity Check: Evaluate confidence score; trigger retries or fallback nodes if confidence falls below threshold.
Positives
- Enterprise Security: Complies with strict security standards.
- Reliable Workflows: Downstream agents receive clean, verified data.