The modern mortgage application process remains one of the most friction-heavy experiences in consumer finance. For years, the industry attempted to solve this with chatbots, but these tools typically functioned as glorified FAQ search engines, capable of answering basic questions but unable to navigate the nuanced financial logic required to match a borrower with a specific loan product. Developers and financial institutions have long sought a way to move beyond simple retrieval toward autonomous agents that can actually reason through a user's financial profile and provide actionable advice in real time.

The Architecture of a Three-Agent Mortgage System

LendingTree has moved past the limitations of single-prompt chatbots by implementing a multi-agent orchestration layer powered by Amazon Bedrock. The system is built around three distinct AI entities: a Supervisor and two specialized Workers. The Supervisor acts as the central brain, analyzing user intent and formulating a step-by-step execution plan. Rather than attempting to handle every request itself, the Supervisor delegates tasks to either the Education Worker or the Matching Worker, depending on whether the user needs general knowledge or a specific financial product.

The Education Worker is designed to guide users through the complexities of mortgage terminology and options. This agent leverages Amazon Bedrock Knowledge Bases combined with Amazon OpenSearch Service to implement a Retrieval-Augmented Generation (RAG) workflow. By utilizing a vector store, the Education Worker performs grounding, ensuring that its responses are based on actual, up-to-date documentation rather than the internal parametric memory of the LLM. This prevents the hallucinations that often plague financial AI and provides a reliable educational resource for the borrower.

In contrast, the Matching Worker functions as a precision tool for financial calculation. Instead of searching documents, it interacts directly with internal offer databases, loan qualification systems, and real-time interest rate APIs. While the Education Worker acts as a library, the Matching Worker acts as a calculator, processing variables such as credit scores and income to output personalized loan options. To manage these agents, LendingTree utilizes LangGraph for stateful orchestration and the Model Context Protocol (MCP) to standardize communication between the different model components.

From an infrastructure perspective, the system is deployed using Amazon ECS and AWS Fargate. Because the team required production-ready deployment before the general availability of Amazon Bedrock AgentCore, they opted for a containerized approach where each agent runs in its own isolated container. This allows the system to scale independently based on demand. The user interface is a React application, also hosted on ECS and Fargate, providing a seamless bridge between the web browser and the backend agentic workflow.

The Logic of Model Branching and State Persistence

What separates this implementation from a standard LLM wrapper is the strategic use of model branching. LendingTree does not apply a high-cost, high-reasoning model to every single interaction. Instead, the system differentiates between the complexity of the task and the model assigned to it. For high-stakes logical reasoning and the critical classification tasks handled by the Supervisor, the system employs Amazon Nova Pro. This ensures that the execution plan is accurate and the routing logic is sound.

For simpler tasks, such as generating conversational responses or performing lightweight classification, the system automatically switches to Amazon Nova Lite. This multi-model strategy optimizes operational costs without sacrificing the reliability of the core logic. To further reduce latency, the communication layer incorporates connection pooling. By maintaining a pool of pre-established connections via MCP, the Supervisor can hand off tasks to workers without the overhead of creating new sessions or re-authenticating for every request, significantly increasing the perceived speed of the conversation.

Consistency in a multi-agent handoff is a notorious challenge in AI development. To solve this, LendingTree uses a LangGraph PostgreSQL checkpointer hosted on Amazon RDS. This serves as a persistent state store that records the progress of the conversation and the current status of the state machine. If a user pauses a session or if a service restarts, the system can recover the exact context from the database. This ensures that the Supervisor knows exactly which node of the workflow the user is in and what conditions must be met to transition to the next stage, maintaining logical coherence across complex, multi-turn financial consultations.

Security in the mortgage industry is not a feature but a regulatory requirement. LendingTree addresses this by implementing a dual-layer security architecture. The first layer is Amazon Bedrock Guardrails, which operates at the infrastructure level to detect hate speech, filter profanity, and mask Personally Identifiable Information (PII) such as phone numbers or social security numbers. This ensures that sensitive data is scrubbed before it ever reaches the model's processing core, mitigating the risk of data leakage.

Parallel to the Guardrails, the system runs a separate LLM-based Safety Classifier. This classifier acts as a real-time auditor, verifying that the conversation adheres to strict corporate and legal policies. By running these two processes in parallel, LendingTree achieves high-grade compliance without adding significant latency to the user experience. Furthermore, the system includes a business logic layer that can detect when a conversation has become too complex for AI, triggering an immediate handoff to a human mortgage specialist to ensure the user is not left with an inadequate answer.

To maintain this rigorous environment, the entire stack is managed via Terraform for Infrastructure as Code (IaC) and GitLab CI/CD for automated testing and deployment. This removes the risk of human error during configuration updates and ensures that security policies are applied consistently across all environments.

This transition from a linear chatbot to a stateful, multi-agent ecosystem marks a shift toward truly autonomous financial services where AI does not just talk about products, but actively navigates the logic required to deliver them.