Getting Started with ADRI
Stop AI agents from breaking on bad data in under 5 minutes
Step 1 β Install & Bootstrapβ
pip install adri
# Create ADRI project folders and sample data
adri setup --guide
The guided setup creates ADRI/dev
and ADRI/prod
folders plus a sample invoice dataset so you can see ADRI working before wiring it into your own data.
Step 2 β Generate a Standard from Good Dataβ
adri generate-standard examples/data/invoice_data.csv \
--output examples/standards/invoice_data_ADRI_standard.yaml --guide
This command profiles your clean dataset and writes a YAML standard that encodes required fields, value ranges, and freshness expectations. The --guide
flag explains what ADRI is doing at each step.
Step 3 β Validate New Data with the Standardβ
adri assess examples/data/test_invoice_data.csv \
--standard examples/standards/invoice_data_ADRI_standard.yaml --guide
What you should see:
- Allowed β when data complies with the generated standard
- Blocked β with a summary of failed checks when the test data violates the standard
π‘οΈ ADRI Protection: BLOCKED β
π Quality Score: 62.4/100 (Required: 80.0/100)
β οΈ Issues: amount must be > 0, status must be lowercase paid/pending/...
When the score is above the threshold ADRI prints ALLOWED β
so you know the data is safe for your agent.
Step 4 β Protect a Functionβ
from adri import adri_protected
@adri_protected(standard="invoice_data_standard", data_param="invoice_rows")
def process_invoices(invoice_rows):
# Your existing agent logic
return ai_agent(invoice_rows)
Key parameters:
standard
β Name of the YAML standard (without.yaml
) you generated or stored inADRI/**/standards
data_param
β The function argument that contains the data you want ADRI to validatemin_score
(optional) β Override the required score (default comes from config)on_failure
(optional) β Choose how to respond:"raise"
,"warn"
, or"continue"
See Core Concepts for protection modes and the five dimensions.
Change Failure Handlingβ
# Warn-only: log issues but keep running (great for pilots)
@adri_protected(standard="invoice_data_standard", data_param="invoice_rows", on_failure="warn")
# Selective mode: continue but mark the run
@adri_protected(standard="invoice_data_standard", data_param="invoice_rows", on_failure="continue")
# Strict mode: raise ProtectionError when data fails validation (default)
@adri_protected(standard="invoice_data_standard", data_param="invoice_rows")
Common Framework Patternsβ
# LangChain
@adri_protected(standard="invoice_data_standard", data_param="invoice_rows")
def langchain_support_agent(invoice_rows):
chain = prompt | model | parser
return chain.invoke(invoice_rows)
# CrewAI
@adri_protected(standard="invoice_data_standard", data_param="invoice_rows")
def crewai_market_analysis(invoice_rows):
crew = Crew(agents=[analyst], tasks=[analysis_task])
return crew.kickoff(inputs=invoice_rows)
# Generic Python function
@adri_protected(standard="invoice_data_standard", data_param="invoice_rows")
def your_agent_function(invoice_rows):
return your_ai_framework(invoice_rows)
Configure ADRI (Optional)β
Create ADRI/config.yaml
(or edit the generated one) to customise defaults:
adri:
project_name: "invoice-agents"
default_environment: "development"
protection:
default_min_score: 80
default_failure_mode: "raise" # raise | warn | continue
cache_duration_hours: 1
auto_generate_standards: true
verbose_protection: false
environments:
development:
paths:
standards: "./ADRI/dev/standards"
assessments: "./ADRI/dev/assessments"
training_data: "./ADRI/dev/training-data"
protection:
default_min_score: 75
default_failure_mode: "warn"
production:
paths:
standards: "./ADRI/prod/standards"
assessments: "./ADRI/prod/assessments"
training_data: "./ADRI/prod/training-data"
protection:
default_min_score: 90
default_failure_mode: "raise"
What ADRI Validatesβ
ADRI automatically checks five dimensions:
- Validity β Correct formats (emails, dates, enumerations)
- Completeness β Required fields populated
- Consistency β Data types and formats aligned
- Plausibility β Realistic value ranges
- Freshness β Data recency and relevance
Logs & Audit Trailβ
Every assessment captures:
- Console summary (success/failure + score)
- JSON reports in
ADRI/**/assessments
- Optional CSV audit trail when enabled
- Enterprise mode streaming to Verodat MCP (see Adoption Journey)
Troubleshootingβ
ValueError: Could not find data parameter
β Make sure data_param
matches the name of the argument in your protected function.
Standard file not found
β Confirm the path you pass to --standard
exists. Use adri list-standards
to see registered files.
Validation too strict? β Lower the threshold temporarily:
@adri_protected(standard="your_data_standard", data_param="invoice_rows", min_score=60)
See what ADRI is checking β Inspect the YAML:
adri show-standard invoice_data_standard
Next Stepsβ
- Work through a framework playbook β Copy/paste solutions for LangChain, CrewAI, LlamaIndex, and more.
- Review the FAQ β Understand logging, standards, and roadmap.
- Explore real examples β Business scenarios and walkthroughs.
- Follow the Adoption Journey β Know when to turn on Verodat-managed supply.
Need help? Open an issue on GitHub or join the discussion.
Next stepsβ
Framework PlaybooksCore ConceptsAPI ReferenceAdoption Journey