Contact Us

Case study

AI agent case study: a lending agent that keeps loan applications moving, inside set limits

ResultTime to an application's next action: 48 hours down to 18 to 24

Client
A small business financing platform (anonymised)
Industry
Financial services: small business lending
Service
AI agent development
Type
AI agent
Timeline
7 months
Status
Trial usage

This AI agent case study is about a small business financing platform with three parties in every loan conversation, and conversations that kept stalling. We built one AI agent that answers all three, shows each of them only what their role may see, follows the stage each application has reached, and negotiates only between a floor and a ceiling the business sets. In trial usage, the wait for an application's next action fell from 48 hours to between 18 and 24.

18 to 24 hours
to an application's next action, down from 48 (trial usage)
8 to 15%
more applications completed (trial usage)
20 to 30%
fewer support tickets asking what happens next (trial usage)
5 to 10%
of long chats with a repeated answer, down from 20 to 30%

The challenge: helping three parties see what comes next

A small business loan on this platform passes between a merchant, who applies and sends documents, a funder, who reviews the deal, and a sales rep, who supports the process. Before the build, their conversations were spread across channels, timely follow-up was difficult, and the sales team had limited visibility into what each application needed next.

Each party needs something different from the same conversation. The merchant wants plain answers about the application. The funder wants talk about the deal. The rep wants to know where the pipeline stands. And the right answer depends on the stage: a new application, an approval, a decline, a missing document or a final deal each call for a different reply.

What we built: an AI agent that knows who it's talking to

The platform has three front ends, one per role, each a Next.js 14 app written in TypeScript and styled with Tailwind CSS: a merchant's view, a layer where funders interact, and a portal where reps track tasks, take escalations and watch the pipeline. Behind them, a Python and FastAPI service holds the APIs and the business rules and talks to the agent.

The agent's decision flow runs in LangGraph. Every message goes through three steps: the agent reads what's being asked and where the application stands, decides what it may do, and only then writes the reply. Google's Gemini 2.0 Flash does the language work. When a question needs something from a document or an earlier call, the agent searches the platform's PDFs and its past call transcripts, using Gemini embeddings and an Upstash Vector index. Supabase holds the applications, the activity and the platform's data.

How every message moves through the agent

  1. 01People

    A message arrives

    From a merchant, a funder or a sales rep, each in their own front end

  2. 02The agent

    Read

    What's being asked, and where the application stands

  3. 03The agent

    Decide

    What this role may see and do at this stage, between the floor and the ceiling

  4. 04The agent

    Write

    The reply, searching the platform's PDFs and past call transcripts when it needs them

  5. When the frustration score reaches the handoff threshold
    05People

    A sales rep takes over

    From the requests for support in the rep portal

Every message goes through the same three steps, and the conversation is handed to a sales rep when its frustration score indicates that personal support would help.

Three engineering problems shaped it:

  • Keeping roles apart. Each role has its own prompt and its own context layer, so a merchant's chat never carries a funder's details, and access rules decide what each person can see.
  • Negotiating live. The agent can move a rate, a term or a loan amount during the conversation, and it has to keep that progress between messages although the API it runs on holds no state.
  • Not repeating itself. In long sessions, 20 to 30% of conversations had the agent repeat an answer. Checks against repeats and controls on what it remembers brought that to about 5 to 10%.

Follow-ups are scheduled so they do not depend on a team member remembering each one. When an application is awaiting a response, APScheduler sends a reminder by SMS through Twilio or by email through Resend after 24 hours, again after 72, and again after 168.

When an application is awaiting a response

  1. Hour 0

    The application is awaiting a response

  2. 24 hours

    A reminder, by SMS or email

    Sent by APScheduler, through Twilio or Resend

  3. 72 hours

    A second reminder

  4. 168 hours

    A third reminder

Follow-ups are scheduled so the team does not have to track each one from memory. In trial usage, they helped 10 to 18% more pending applications resume than when there was no automated follow-up.

Where the AI agent stops, and who takes over

The agent works inside written rules. These are the ones that stop it or send the conversation on:

The rules the lending agent works inside
When this happensThe agent
The application hasn't reached an offerDoesn't discuss offers
The application was declinedDoesn't negotiate
Information is still missingAsks for what's missing, and gives no update it can't yet confirm
A rate, term or amount would fall outside the set limitsHolds at the floor or the ceiling
The conversation's frustration score indicates that personal support would helpHands the conversation to a sales rep
Someone asks about another party's detailsAnswers from their own role's view only

The frustration score triggers the handoff. The agent evaluates each conversation as it progresses, and when the score indicates that personal support would help, the conversation moves to a rep with its context attached.

Results from trial usage

Measured in trial usage, against the process before the build

  • Time to an application's next action

    Before48 hours

    In trial usageAbout 18 to 24 hours

  • Applications completed

    BeforeCompletion rate before the trial

    In trial usageUp about 8 to 15%

  • Document requests per application

    BeforeRequest volume before the trial

    In trial usageDown about 15 to 25%

  • Support tickets asking about next steps

    BeforeTicket volume before the trial

    In trial usageDown about 20 to 30%

  • Failed payment attempts

    Before3 to 6%

    In trial usage1 to 2%

  • Long chats where the agent repeated itself

    BeforeAbout 20 to 30%

    In trial usageAbout 5 to 10%

The scheduled follow-ups helped 10 to 18% more pending applications resume than when there was no automated follow-up. Failed payments fell through retries, clearer error messages and recovery that remembers where a payment stopped. These are figures from trial usage, not from production.

Technologies and tools

  • Next.js 14
  • TypeScript
  • Tailwind CSS
  • Python
  • FastAPI
  • LangGraph
  • Gemini 2.0 Flash
  • Gemini embeddings
  • Upstash Vector
  • Supabase
  • APScheduler
  • Twilio
  • Resend

Timeline

The build took seven months.

If your own applications, claims or onboarding files stall between people, our page on AI agents for finance sets out how we scope an agent like this one and the rules it would work inside.

Bring us the conversation that needs a clearer next step

Tell us who talks to whom, what each person needs at every stage and where timely support is hardest today. An engineer replies within two business days with how we'd scope the agent and the rules it would work within.