Connect Blend to AI Agents: Automate Lending Cycles and Reports
Give your AI agent Blend tools.
Connect Blend to AI Agents (LangChain, Vercel SDK) using Truto. Fetch AI-ready tools via the /tools endpoint, manage complex loan pipelines, and handle asynchronous exports programmatically.
In this guide
- 01Initialize Truto Tool Manager
- 02Fetch AI-Ready Proxy APIs
- 03Bind Tools to Your LLM
- 04Implement Rate Limit Handling
- 05Execute Multi-Step Workflows
The guide
Learn how to connect Blend to AI Agents using Truto's /tools endpoint to autonomously manage home lending applications, income verification, and closing cycles.
You want to connect Blend to an AI agent so your system can autonomously manage home lending applications, initiate income verifications, generate loan documents, and orchestrate closing schedules. Here is exactly how to do it using Truto's /tools endpoint and SDK, bypassing the need to build and maintain a custom Blend API integration from scratch.
Giving a Large Language Model (LLM) read and write access to your mortgage origination platform is an engineering challenge with zero margin for error. You either spend months building, securing, and maintaining a custom connector capable of navigating complex lending data models, or you use a managed infrastructure layer that provides normalized tools out of the box. If your team uses ChatGPT, check out our guide on connecting Blend to ChatGPT, or if you are building on Anthropic's models, read our guide to connecting Blend to Claude. For developers building custom autonomous workflows, you need a programmatic way to fetch these tools and bind them to your agent framework.
This guide breaks down exactly how to fetch AI-ready tools for Blend, bind them natively to an LLM using frameworks like LangChain, LangGraph, CrewAI, or the Vercel AI SDK, and execute complex lending operations. For a broader look at this design pattern across multiple platforms, read our core architectural research on Architecting AI Agents: LangGraph, LangChain, and the SaaS Integration Bottleneck.
The Engineering Reality of the Blend API
Giving an LLM access to external data sounds trivial in a rapid prototype. You write a standard Node.js script that makes a fetch request and wrap it in a tool decorator. When moving to production against a complex point-of-sale (POS) or loan origination system (LOS) like Blend, this naive approach collapses.
Blend's API introduces several specific integration challenges that break standard REST assumptions. If you hardcode these interactions into your agent, you will spend your engineering cycles writing defensive integration code instead of improving your model's reasoning capabilities.
Asynchronous File Exports and Polling
Mortgage origination relies heavily on standard industry data formats, specifically MISMO XML and Fannie Mae 3.2 files. You cannot simply hit a GET endpoint and instantly receive a massive 3.2 file for an application.
Blend requires an asynchronous workflow for exports. You first submit a request to export the application. Blend accepts the request and returns a job ID. You must then poll a separate endpoint using that ID until the export status resolves to complete. An AI agent lacking temporal awareness or state management will hallucinate the file contents if it expects synchronous data returns. Your tool layer must account for this asynchronous reality, often requiring an agentic loop (like those built in LangGraph) to check status sequentially before proceeding.
Deeply Nested and Co-Dependent Data Models
Lending applications are not flat JSON structures. A single home lending application contains arrays of borrowers, co-borrowers, employers, income verifications, liabilities, and closing details. When updating an application, standard LLMs often attempt to send flat, intuitive JSON objects.
Blend's API expects heavily nested structures. If an agent attempts to update a borrower's employer information without supplying the correct, nested party_id and corresponding array indices, the API will reject the payload. Pushing this schema mapping complexity directly into the LLM prompt consumes valuable context window space and drastically increases the probability of failed tool calls.
Pagination and Cursor Constraints
Blend uses specific cursor-based pagination for listing large datasets, such as retrieving all activities for a home lending application. Blend returns a prevCursor and expects the integration to page forward using that specific token (up to a hard limit of 200 records per page for activities). If an LLM is given raw access to a pagination endpoint without a constrained tool schema (see our research on feeding paginated results to agents), it will frequently invent page numbers or guess at offset integers, resulting in infinite loops or 400 Bad Request errors.
Why a Unified Tool Layer Matters for Agent Safety
Before writing a line of code, you must decide what abstraction layer your agent communicates with.
Direct API tools - exposing one tool per raw Blend endpoint - look convenient but push provider quirks directly into the LLM's context. The model has to remember exactly how to structure an income verification payload, or how to handle Blend's specific error formats. Every one of those quirks is a hallucination risk.
Truto provides Proxy APIs for Blend that wrap these endpoints in a standardized schema. Your agent sees stable functions like list_all_blend_home_lending_applications or create_a_blend_income_verification. This provides immediate safety wins:
- Smaller attack surface for hallucination: The LLM only chooses from a stable list of function names. It never invents query parameters or payload structures that fall outside the defined schema.
- Deterministic input validation: Every tool provided by Truto has a strict JSON schema. Invalid arguments generated by the LLM are rejected before they hit Blend's servers, allowing your agent to catch the error locally, reason about the failure, and retry.
- Framework agnostic: Because tools are fetched dynamically via an API endpoint (
/tools), they can be consumed by any agent framework that supports standard function calling.
Architecting the Connection: Truto's /tools Endpoint
Truto maps external APIs into a set of REST-based Proxy APIs. Every integration has Resources (e.g., applications, closings, documents) and Methods (List, Get, Create, Update). Truto automatically exposes all of these methods as AI-ready tools via the /integrated-account/<id>/tools endpoint.
When your agent initializes, it requests this endpoint, receives the JSON schemas for the Blend operations, and binds them to the LLM (using .bindTools() in LangChain, for example). Truto handles the underlying authentication and query parameter processing, while your application retains full control over the execution flow.
sequenceDiagram
participant Agent as AI Agent (LangChain)
participant Truto as Truto /tools API
participant Blend as Blend API
Agent->>Truto: GET /integrated-account/<id>/tools
Truto-->>Agent: Returns JSON schemas for Blend tools
Note over Agent: Agent binds tools to LLM
Agent->>Truto: Execute tool (e.g., create_application)
Truto->>Blend: POST /home-lending/applications (Authenticated)
Blend-->>Truto: JSON Response
Truto-->>Agent: Normalized JSON outputHandling Rate Limits with Truto
When integrating with any financial API, rate limiting is a critical engineering consideration. It is a factual requirement to understand that Truto does not retry, throttle, or apply backoff on rate limit errors.
When Blend returns an HTTP 429 (Too Many Requests), Truto passes that error directly back to the caller. However, Truto normalizes the upstream rate limit information into standardized headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset) following the IETF specification. This allows your agent framework to read standardized headers and execute its own intelligent backoff or sleep routines without needing to parse provider-specific error bodies.
Hero Tools for Blend
Truto provides comprehensive coverage of the Blend API, but a high-functioning agent only needs a curated subset of high-leverage operations to execute core workflows. Here are the primary hero tools you should bind to your Blend AI Agents.
get_single_blend_home_lending_application_by_id
Retrieves the complete JSON object containing all application data for a specific home lending application. This is the cornerstone tool for an agent needing context before making decisions, checking statuses, or updating loan parameters.
"Fetch the complete application data for application ID
app-99812-alphaso I can review the current borrower information and loan amount."
create_a_blend_income_verification
Performs an income verification or reverification for a specific party on the loan. Based on the selected operation, this API pushes the party through the Blend income verification waterfall. This is critical for automated underwriting agents.
"Initiate an income reverification process for party ID
pty-5541on the current application."
update_a_blend_closing_by_id
Updates an existing closing record for a given loan. This endpoint can update multiple elements at once, such as setting the scheduled ceremony time, closing type, or updating timezone constraints for the borrower.
"Update the closing record
cls-22991to set the scheduled ceremony time for next Thursday at 2 PM EST."
create_a_blend_home_lending_application_export_request
Initiates an asynchronous attempt to export application data into standardized formats (like MISMO XML). Because this is asynchronous, the agent uses this tool to begin the job, receives an ID, and then uses a separate tool to poll for completion.
"Start a MISMO XML export request for application ID
app-99812-alphaand give me the export request ID so I can track it."
list_all_blend_documents
Gets a paginated list of all uploaded and signature-complete documents on a specific application. An agent uses this to audit loan files and determine if the borrower has submitted all required conditions.
"List all the completed documents currently attached to application
app-99812-alphato verify if the W-2s have been uploaded."
create_a_blend_follow_up
Creates a follow-up task for an applicant on a specific application. When an agent detects missing information or stalled verification, it can autonomously generate a follow-up to prompt the borrower.
"Create a follow-up task for the applicant on application
app-99812-alphareminding them to upload their most recent bank statements."
To view the complete inventory of available Blend tools, schemas, and required parameters, visit the Blend integration page.
Workflows in Action
To understand how these tools map to actual business value, let's look at how specific personas use an AI Agent equipped with Blend tools to automate lending cycles.
Workflow 1: The Autonomous Loan Processor
Loan processors spend hours manually checking if borrowers have submitted required documentation and initiating verifications. An autonomous agent can handle this continuously.
"Check the document inventory for application
app-88210. If the W-2 is present, initiate an income verification for the primary borrower. If it is missing, create a follow-up task for the borrower to upload it."
Agent Execution Steps:
- The agent calls
list_all_blend_documentspassing theapplicationIdto retrieve the document manifest. - It evaluates the JSON response to check for a document type matching "W-2" or "Income Statement".
- If found, the agent calls
create_a_blend_income_verificationpassing thepartyIdassociated with the primary borrower to run it through the verification waterfall. - If missing, the agent calls
create_a_blend_follow_upto generate a task on the borrower's dashboard requesting the missing W-2.
Result: The processor's queue is cleared automatically. Verifications are triggered the moment documents arrive, cutting days out of the processing cycle.
Workflow 2: The Closing Coordinator
Orchestrating closing dates requires aligning system data with borrower availability. An agent can read external calendar intents and apply them directly to the LOS.
"The borrower for application
app-33411agreed via email to close next Friday at 10 AM. Update their closing record to reflect this new scheduled ceremony time and check if the closing eNote has been generated."
Agent Execution Steps:
- The agent calls
list_all_blend_closingsusing theapplicationIdto find the specific closing record ID for this loan. - The agent calls
update_a_blend_closing_by_id, parsing "next Friday at 10 AM" into a valid ISO timestamp, and patching the closing schedule. - The agent calls
get_single_blend_closing_by_idto read the updated closing state and verify the presence of an eNote in the payload.
Result: The closing schedule is updated deterministically without manual data entry, and the coordinator is alerted if closing documents are still pending generation.
Building Multi-Step Workflows
To implement these agentic loops in your own infrastructure, you need to pull the tools into your framework and handle errors appropriately. Because Truto's /tools endpoint returns standard JSON schemas, you can bind them to any modern AI SDK.
Below is a conceptual TypeScript implementation using the truto-langchainjs-toolset. Notice how the system is responsible for trapping the HTTP 429 error and implementing backoff logic based on the normalized ratelimit-reset header.
import { ChatOpenAI } from "@langchain/openai";
import { AgentExecutor, createToolCallingAgent } from "langchain/agents";
import { ChatPromptTemplate } from "@langchain/core/prompts";
import { TrutoToolManager } from "truto-langchainjs-toolset";
async function runBlendAgent(userPrompt: string) {
// 1. Initialize the Truto Tool Manager with your Integrated Account ID
const toolManager = new TrutoToolManager({
trutoToken: process.env.TRUTO_API_KEY,
integratedAccountId: "blend-account-id-123",
});
// 2. Fetch Proxy APIs dynamically from Truto's /tools endpoint
const tools = await toolManager.getTools();
// 3. Initialize the LLM and bind the Blend tools
const llm = new ChatOpenAI({
modelName: "gpt-4-turbo",
temperature: 0,
}).bindTools(tools);
const prompt = ChatPromptTemplate.fromMessages([
["system", "You are a senior mortgage processing assistant. Execute tasks against the Blend API. If a tool fails with a 429 Too Many Requests, you must read the ratelimit-reset header and wait before retrying."],
["human", "{input}"],
["placeholder", "{agent_scratchpad}"],
]);
// 4. Create the LangChain agent execution loop
const agent = createToolCallingAgent({
llm,
tools,
prompt,
});
const executor = new AgentExecutor({
agent,
tools,
maxIterations: 10,
// Ensure the agent can observe tool failures to execute retries
returnIntermediateSteps: true,
});
try {
console.log("Executing Blend automation workflow...");
const result = await executor.invoke({ input: userPrompt });
console.log("Workflow Complete:", result.output);
} catch (error: any) {
// The caller is responsible for handling rate limits.
// Truto passes the 429 upstream error and normalizes rate limit headers.
if (error.status === 429) {
const resetTime = error.headers['ratelimit-reset'];
console.error(`Rate limited by Blend API. Backoff required until: ${resetTime}`);
// Implement custom sleep/retry logic here
} else {
console.error("Agent execution failed:", error.message);
}
}
}
// Example invocation
runBlendAgent("List all documents for application 'app-99812' and check for a W-2.");By leveraging the Proxy APIs provided by Truto, your engineering team avoids writing hundreds of lines of boilerplate HTTP logic, pagination cursors, and OAuth token management. Your AI agents interact with a clean, deterministic schema, allowing them to autonomously drive mortgage pipelines forward.
FAQ
- Does Truto automatically handle Blend API rate limits?
- No. Truto passes HTTP 429 errors from the Blend API directly to the caller. However, Truto normalizes the upstream rate limit information into standard headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset), allowing your agent to implement its own backoff logic.
- Can I use Truto's Blend tools with LangGraph or CrewAI?
- Yes. Truto's /tools endpoint returns standard JSON schemas that can be parsed and bound to any LLM using any major framework, including LangChain, LangGraph, CrewAI, and the Vercel AI SDK.
- How does the AI agent handle Blend's asynchronous export requests?
- An agent must be instructed to handle asynchronous workflows. It first calls the export creation tool to receive a job ID, and then uses a polling loop to query the export status tool until the job completes and the data is available.
- Do I have to write custom code for Blend's pagination?
- No. Truto's Proxy APIs handle the underlying cursor-based pagination and parameter processing natively, allowing your agent to simply call the tool and receive a normalized list of records.