Stop LLM JSON output from breaking your pipeline.
Agent Validator makes AI outputs reliable with schema checks, retries, and logging. No more glue code.
View on GitHub
pip install agent-validator
Why Agent Validator?
🔍
Schema Validation
Validate JSON outputs against Python dict schemas
🔄
Automatic Retries
Exponential backoff & timeouts
🌀
Type Coercion
Safe coercions (e.g., "42" → 42)
📝
Local Logging
JSONL + redaction
☁️
Cloud Monitoring
Optional, secure auth
🛠️
CLI Tools
Test, logs, dashboard
📏
Size Limits
Configurable caps
Quick Start
Installation
pip install agent-validator
Basic Usage
from agent_validator import validate, Schema, ValidationMode, ValidationError
schema = Schema({
"name": str,
"age": int,
"email": str,
"tags": [str]
})
try:
result = validate(
agent_output,
schema,
retry_fn=call_agent,
retries=2,
mode=ValidationMode.COERCE,
context={"correlation_id": "abc123"}
)
print("✅ Validation successful!", result)
except ValidationError as e:
print("❌ Validation failed:", e, "CID:", e.correlation_id)
Command Line Interface
agent-validator test schema.json input.json --mode COERCE
agent-validator logs -n 20
agent-validator id
Validation Modes
Mode | Description | Example |
---|---|---|
STRICT | Exact type/shape match | "30" fails for int |
COERCE | Safe coercions | "30" → 30, "true" → True |
Security & Logging
🔒 Security Features
- • Automatic redaction of sensitive data
- • Configurable size limits
- • Correlation IDs for tracing
- • Secure cloud authentication
📊 Logging & Monitoring
- • Local JSONL logging
- • Optional cloud monitoring
- • Structured error reporting
- • Performance metrics
Pricing + Features
-
✅
Full Python SDK (
validate()
,Schema
,ValidationMode
) -
✅
Local JSONL logging (
~/.agent_validator/logs/
) -
✅
CLI tools:
test
,logs
,id
- ✅ Strict + Coerce validation modes
- ✅ Schema features: primitives, lists, nested dicts, optionals
- ✅ Retry logic with exponential backoff + timeouts
- ✅ Built-in redaction for API keys, emails, JWTs
- ✅ Config via CLI/env/config.toml
- 🚫 No cloud logging/dashboard
Everything in Free, plus:
- ☁️ Cloud logging (send validation attempts to hosted API)
- 📊 Dashboard access (recent logs, success/failure rates, performance metrics)
- 🔑 License key management via CLI
- 🔐 Webhook secret generation + HMAC signatures for secure callbacks
- ⏱ 50k validations/month included
- 📧 Email support
Everything in Starter, plus:
- 📈 Advanced dashboard (filters by correlation ID, schema, time range)
- 🚨 Alerts/notifications (email/Slack on repeated validation failures)
- 🗂 Schema file upload + validation templates
- 🔄 Cloud config sync across team members
- 🔐 Secret redaction customization (add your own regex patterns)
- 🚦 Priority queueing on cloud logs (faster ingestion)
- ⏱ 250k validations/month included
- 📧 Priority support (48h response)
Everything in Pro, plus:
- 👥 Team accounts (multi-user dashboard, RBAC roles)
- 📊 Usage analytics (breakdowns by service, schema, error type)
- 🛡️ SOC2-ready log retention (90 days)
- 🗄 Log export to S3 / GCS for compliance
- 📦 Schema versioning + audit history
- 🚨 PagerDuty/Slack integration for alerts
- ⏱ 1M validations/month included
- 📞 Dedicated support channel (same-day response)