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.
Metadata
Release files for mortgage-ai-guardrails 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mortgage_ai_guardrails-1.0.0.tar.gz | 119.2 kB | Without provenance | Details for mortgage_ai_guardrails-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mortgage_ai_guardrails-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for mortgage_ai_guardrails-1.0.0-py3-none-any.whl |
Total release size: 184.4 kB
Release files / mortgage_ai_guardrails-1.0.0.tar.gz
| Download URL | mortgage_ai_guardrails-1.0.0.tar.gz |
|---|---|
| Size | 119.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
de73caec9225007b1c1e45434e6033e532304154c6ec0ffabebb0b220a43db65
|
|
BLAKE2b-256 checksum How to use checksums |
b24b76dcf0a631710b75939d53acd46cf20806168d73ac003f0080387820fd64
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Release files / mortgage_ai_guardrails-1.0.0-py3-none-any.whl
| Download URL | mortgage_ai_guardrails-1.0.0-py3-none-any.whl |
|---|---|
| Size | 65.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f25442aa8e0b4451f6c00b735abcb8a3f8862e82ee1186942f3c2727a70a66de
|
|
BLAKE2b-256 checksum How to use checksums |
bca054b01ad980180d012c15568e3301bcadb3d6ef155f0e1f97c7b32b7b9f7e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Security for mortgage-ai-guardrails 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.