- Home
- Case studies
- AI agent case study
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.
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
A message arrives
From a merchant, a funder or a sales rep, each in their own front end
Read
What's being asked, and where the application stands
Decide
What this role may see and do at this stage, between the floor and the ceiling
Write
The reply, searching the platform's PDFs and past call transcripts when it needs them
- When the frustration score reaches the handoff threshold
A sales rep takes over
From the requests for support in the rep portal
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
- Hour 0
The application is awaiting a response
- 24 hours
A reminder, by SMS or email
Sent by APScheduler, through Twilio or Resend
- 72 hours
A second reminder
- 168 hours
A third reminder
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:
| When this happens | The agent |
|---|---|
| The application hasn't reached an offer | Doesn't discuss offers |
| The application was declined | Doesn't negotiate |
| Information is still missing | Asks for what's missing, and gives no update it can't yet confirm |
| A rate, term or amount would fall outside the set limits | Holds at the floor or the ceiling |
| The conversation's frustration score indicates that personal support would help | Hands the conversation to a sales rep |
| Someone asks about another party's details | Answers 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
Applications completed
Document requests per application
Support tickets asking about next steps
Failed payment attempts
Long chats where the agent repeated itself
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.
More case studies
All case studiesBring 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.