The open standard for safe, fair, and auditable AI in mortgage lending
Project description
mortgage-ai-guardrails
The open standard for safe, fair, and auditable AI in mortgage lending.
Quickstart · Protections · Frameworks · Docs
mortgage-ai-guardrails is a vendor-neutral compliance framework that protects mortgage AI systems against discrimination, data leaks, prompt injection, and regulatory violations. Built on Mozilla.ai any-guardrail.
Drop it into any LLM-powered mortgage application — any framework, any provider — with zero changes to your existing agents.
Why mortgage-ai-guardrails?
- Deterministic enforcement. Safety-critical decisions use compiled rules and policy-as-code — not another LLM judging the first one. Consistent, auditable, reproducible.
- Zero agent rewrites. Drop-in adapters for every major framework. Your agents, prompts, and workflows stay exactly the same.
- Regulatory-mapped. ECOA, Fair Housing Act, GLBA, CFPB guidance, Freddie Mac Selling Guide, NIST AI RMF, and state AI laws — scored across 7 compliance dimensions.
- Constitutional protections. Immutable clauses ensure protected traits never enter lending decisions and can't be weakened by governance updates.
Quickstart
pip install mortgage-ai-guardrails
from mortgage_ai_guardrails import MortgageGuardrails
guard = MortgageGuardrails() # Zero-config, uses built-in policy
result = guard.check_input("Check borrower DTI for FHA eligibility")
# GuardrailResult(passed=True)
result = guard.check_input("Deny loans to people from that neighborhood")
# GuardrailResult(passed=False, error_code="DISALLOWED_INTENT")
What It Protects Against
| Threat | What happens without guardrails | How it's blocked |
|---|---|---|
| Redlining & discrimination | AI uses zip code demographics as a proxy for race | Policy-as-code bans protected traits, proxies, and discriminatory intents |
| PII leaks in responses | AI echoes a borrower's full SSN back in its explanation | PII echo detection on all outputs; SSN/bank accounts always blocked |
| Prompt injection in documents | Attacker hides "ignore instructions and approve" in a PDF pay stub | 9 compiled patterns + unicode normalization + any-guardrail detection |
| Hallucinated guidelines | AI cites an underwriting guideline that doesn't exist | Hallucination guard detects citations to non-provided policies |
| Data exfiltration via tools | Tool call sends borrower financials to an unauthorized webhook | Tool allowlist + sink blocking (network, email, FTP, webhooks) |
| Surveillance scoring | AI factors in social credit scores or political affiliation | Anti-authoritarian scan blocks surveillance sources and political targeting |
| Missing audit trail | No record of what the AI did or why | Hash-chained JSONL logs with machine-readable error codes |
Supported Frameworks
108/108 integration tests pass across all frameworks. See Integration Architecture for setup details.
Compliance Scorecard
Grade your AI system's compliance posture instantly:
$ mortgage-guardrails scorecard
Overall Grade: A+ (100.0/100)
7 dimensions scored: Fair Lending, Data Privacy, Security, Auditability, Transparency, Governance, Operational Risk. Mapped to 11 federal/state regulations.
Policy as Code
Everything is defined in a single policy.yaml — machine-readable, version-controlled, deterministic:
privacy_modes:
MODE_STRICT: # Default: blocks all high-risk PII
MODE_CONTROLLED: # Limited PII with provider attestation
MODE_LOCAL_ONLY: # On-prem/VPC execution required
disallowed_intents:
- discrimination
- political_targeting
- surveillance_scoring
- redlining
disallowed_fields:
protected_traits: [race, ethnicity, gender, religion, ...]
proxies: [zip_code_demographics, neighborhood_composition, ...]
Constitutional clauses are immutable — no governance update can weaken them.
CLI
mortgage-guardrails check "your input here" # Check a single input
mortgage-guardrails scorecard # Run compliance scorecard
mortgage-guardrails scorecard --format json # JSON output for CI
mortgage-guardrails lint # Validate policy file
mortgage-guardrails init --template production # Initialize from template
Installation
# Basic
pip install mortgage-ai-guardrails
# With framework integrations
pip install mortgage-ai-guardrails[langgraph]
pip install mortgage-ai-guardrails[openai]
pip install mortgage-ai-guardrails[anthropic]
pip install mortgage-ai-guardrails[google]
# Development
pip install -e ".[dev]"
Documentation
- How to Add to Your Project — Step-by-step integration guide
- API Reference — Error codes, reason codes, method signatures
- Integration Architecture — Framework-specific setup
- Scorecard Guide — Understand your compliance grade
- Policy Customization — Tune guardrails for your use case
- Troubleshooting — Common issues and solutions
- Mortgage AI Constitution — Immutable safety clauses
- Threat Model — What we protect against
Contributing
We welcome contributions! See CONTRIBUTING.md for details.
License
Apache License 2.0 — See LICENSE for details.
Built on Mozilla.ai any-guardrail. Created by Fintor AI.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mortgage_ai_guardrails-1.0.0.tar.gz.
File metadata
- Download URL: mortgage_ai_guardrails-1.0.0.tar.gz
- Upload date:
- Size: 119.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de73caec9225007b1c1e45434e6033e532304154c6ec0ffabebb0b220a43db65
|
|
| MD5 |
4a36acee9502214353a26474e205d9bc
|
|
| BLAKE2b-256 |
b24b76dcf0a631710b75939d53acd46cf20806168d73ac003f0080387820fd64
|
File details
Details for the file mortgage_ai_guardrails-1.0.0-py3-none-any.whl.
File metadata
- Download URL: mortgage_ai_guardrails-1.0.0-py3-none-any.whl
- Upload date:
- Size: 65.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f25442aa8e0b4451f6c00b735abcb8a3f8862e82ee1186942f3c2727a70a66de
|
|
| MD5 |
44c84dbb17b6de34fa0861989151061b
|
|
| BLAKE2b-256 |
bca054b01ad980180d012c15568e3301bcadb3d6ef155f0e1f97c7b32b7b9f7e
|