LoanShield is an enterprise-grade automated lending decision platform built on Google's Agent Development Kit (ADK 2.0). It ingests credit applications, redacts sensitive PII, executes parallel financial analysis and compliance verification using stdio Model Context Protocol (MCP) servers, calculates a multi-factor credit risk score, and dispatches regulatory ECOA-aligned explanation letters.
In this video, I walk through the complete architecture and demonstrate how LoanShield automates the loan underwriting workflow using Google ADK, MCP (Model Context Protocol), LLM, deterministic skills, and Human-in-the-Loop (HITL) review.
The LoanShield processing pipeline is structured as a LangGraph state workflow:
LoanShield implements a structured multi-agent cooperation architecture using Google ADK to distribute responsibility across highly specialized agents:
-
Orchestrator Agent (LangGraph Coordinator)
- Role: Governs the application lifecycle and execution state.
- Responsibilities: Sequences intake triggers, coordinates parallel branch fan-out/fan-in processing (Financial + Fraud agents), resolves conditional routes, and manages HITL wait interrupts for underwriters.
-
Gatekeeper Agent
- Role: Data intake, security sanitization, and document validation.
- Responsibilities: Executes
pii_redactor_skillto sanitize raw SSN, DOB, phone, and address into anonymized tokens. Queries thedocument_storage_mcp_final.jsondatabase. Pauses execution with an interrupt if documentation status isINCOMPLETE.
-
Financial Analyst Agent
- Role: Financial profile check, verification of stated parameters, and affordability math.
- Responsibilities: Invokes standard MCP server tools to query bank deposit lists, credit bureau indicators, and employment profiles. Executes the
income_verify_skillto detect monthly deposit variances (flags >100% variance as fraud). Executes thedti_calculator_skillto score total monthly DTI debt obligations. Executes thestability_modifier_skillto compute the employment stability of the applicant.
-
Fraud & Compliance Agent
- Role: Anti-fraud filters and circuit breakers.
- Responsibilities: Enforces strict operational guardrails based on credit history and age limits:
- Synthetic Fraud Rule: Catches anomalies where credit age < 6 months but credit score > 780.
- Income Mismatch Ratio: Triggers if the applicant's self-reported income on the intake form is 2 times the verified income [deposits] found in banking deposit statements.
- Immaturity/High-exposure Rule: Flags applicants under 21 requesting > $100,000.
- Employment Stable Income Check: Screens for employment status =
Terminated. - Instantly sets
fraud_flag = Trueto bypass score calculations and trigger immediate rejection.
-
Explanations Agent (Compliance Officer)
- Role: Regulatory adverse action notice compiler.
- Responsibilities: Evaluates final node outcomes and builds credit decision notification letters using the
explanation_skillLLM agent, aligning declines with Section 701(a) of the Equal Credit Opportunity Act (ECOA) (e.g. low FICO score, high DTI, fraud triggers) and masking all PII.
loanshield/
โโโ Makefile # Local dev commands (install, playground, test)
โโโ Dockerfile # Standardized container image definition
โโโ docker-compose.yml # Multi-container orchestration configurations
โโโ pyproject.toml # Python package and dependency management (uv synced)
โโโ .github/workflows/ # CI/CD automated lint/test validation triggers
โ โโโ github_actions.yaml
โโโ datasets/ # Reference mock datasets (JSON/CSVs)
โโโ app/
โ โโโ __init__.py # Application initialization
โ โโโ agent.py # LangGraph workflow coordination & agent nodes
โ โโโ config.py # Environment variable mappings
โ โโโ state.py # Graph state TypedDict and Pydantic schemas
โ โโโ mcp_server.py # Stdio MCP servers exposing databases as tools
โ โโโ skills/ # Modular business verification functions
โ โโโ pii_redactor.py # Regex + LLM-based PII mask
โ โโโ income_verify.py # Plaid-style bank deposit validation
โ โโโ dti_calculator.py # Affordability DTI ratio checks
โ โโโ stability_modifier.py # Job tenure scoring adjustment
โ โโโ risk_scoring.py # Multi-factor score calculator
โ โโโ fraud_detection.py # Hard risk rules & limits
โ โโโ explanation.py # ECOA regulatory notice builder
โโโ tests/
โโโ conftest.py # Global LLM mocks & patches (offline testing)
โโโ test_skills.py # Unit tests for scoring/verification skills
โโโ test_mcp.py # Integration tests for MCP server tools
โโโ test_graph.py # End-to-end integration tests over all 54 rows
This project uses uv for dependency management. Access all tasks via the Makefile:
Install Python dependencies (either through make or requirements.txt) and run the app locally:
cd loanshield
make install
python -m app.custom_web_serverLaunch the local ADK web playground interface for manual underwriter checks:
make playgroundAccess the interface locally at http://127.0.0.1:18081.
The LoanShield scoring engine generates risk scores (
-
Auto-Approve (Score
$\ge 70$ , zero fraud flags, all docs present): Applications are approved instantly. -
Human Review / HITL Interruption (Zero fraud flags): Suspends workflow execution context, initializing an asynchronous wait state for underwriter override validation under two scenarios:
-
Marginal Credit Tier: Score falls within the conditional window of
$40 - 69$ . - Document Collection Exceptions: Triggered immediately if mandatory documentation packets are marked missingโregardless of the baseline credit score metric.
-
Marginal Credit Tier: Score falls within the conditional window of
-
Auto-Reject (Score
$< 40$ OR any fraud flag): Terminate processing pipeline instantly, lock credit exposure boundaries, and generate a regulatory ECOA-compliant adverse action explanation letter.
We built a custom, high-fidelity web gateway interface for LoanShield, replacing the generic command-line or basic forms with a state-of-the-art underwriting workstation:
- 3D WebGL Backdrop: Utilizes Three.js to render a real-time, dot-matrix animated particle field that responds dynamically to pointer coordinates via parallax drift and features a slow breathing pulse.
- Translucent Glassmorphism Panels: Built with a sleek dark aesthetic (
#0A0A0A) accented by neon green (#A3E635), utilizing glass panels withbackdrop-filter: blur(12px). - Live Node Graph Workflow: Displays the exact LangGraph agent node layout connected by active, pulsing SVG bezier connection paths that light up in real-time.
- EventSource (SSE) Streaming: Connects directly to the backend memory runner to stream node state transitions (
running,paused,completed,failed) and transition logs. - Audit Trail Terminal Logs: Simulates a CLI logs terminal directly on the page, with info/warning/critical color-coding.
- Interactive Underwriter Overrides Box: Pauses execution and pops up override control buttons (
APPROVE,REJECT,RESUME) when human intervention is triggered.
This screenshot shows a prime credit application being successfully processed. The risk scorer evaluates the profile at a composite score of 85.4, resulting in a final verdict of APPROVED and drafting the congratulations approval notice.
This screenshot illustrates the workflow paused at human_underwriter_hitl_node (pulsing orange). Because the risk score of 64.1 lies within the review threshold, the process suspends and displays interactive APPROVE LOAN and REJECT LOAN override buttons in the bottom-right panel.
This screenshot showcases the application state after the human underwriter clicks the APPROVE LOAN override button for Harper Robinson. The workflow resumes from its paused state, evaluates the final decision as APPROVED, and displays the completed audit trail logs.
This screenshot demonstrates the auto-rejection state for applicant. A synthetic fraud identity mismatch is flagged, resulting in a risk score being overridden to a REJECTED verdict. The formal ECOA Credit Notice letter details the specific adverse action reasons at the bottom.
This screenshot shows the formal ECOA Credit Notice letter.
For low-level tracing, debugging, and inspecting state changes between individual LangGraph nodes, you can execute the workflow inside the built-in Google Agent Development Kit (ADK) Playground:
The default, clean workspace interface of the Google ADK playground portal, loaded with the app configuration. From here, you can initiate new underwriting traces, inspect state histories, evaluate metrics, and send custom JSON application messages.
This screenshot shows the complete, successfully resolved 14-step event trace history. You can inspect the final computed risk score (85.42), the automated approval routing edge transition, and the completed ECOA credit notice letter generated by the Explanations agent.
NOTE: Only in the notifier_node. PII redacted data is replaced by raw data. Throughout the workflow, PII redacted data is being referred. Refer to the following screenshot of state data captured in between the workflow execution

