Inspiration

People who borrow against their gold keep asking the lender the same questions: how much can I borrow, what is my loan status, when is my next payment due, and what happens if I pay late. Today the answers need a branch visit or a call, so customers wait, give up, or never ask. The lender also has no simple view of what customers actually ask.

What it does

A customer chats with the assistant on WhatsApp, at any hour, in English or Malayalam.

  • Eligibility estimate. Takes gold weight and any purity (8K-24K or a hallmark number like 916), then calculates an estimate from a live gold rate and a configurable loan-to-value ratio. Always labelled as an estimate.
  • Loan lookup. Shows status, outstanding amount and next due date for the customer's own loans only.
  • Dues, late fees and part-payment what-ifs. What is due in the next 30-90 days, the late fee per day, and a month-by-month result if the customer pays less or more than due.
  • Branch finder. Nearest branch by city, PIN code or branch name (Malayalam city names work too).
  • Gold rate today and a list menu for greetings.
  • Fallback. Off-topic questions get a polite reply and are recorded as "other". The agent never invents loan terms or amounts.
  • Admin dashboard. Cognito login. Shows daily active users, messages per day, what customers asked, tool use, recent conversations, unanswered questions and WhatsApp delivery health. Customer IDs and phone numbers are masked.

How we built it

WhatsApp -> AWS End User Messaging Social -> Amazon SNS -> Lambda handler -> Amazon Bedrock AgentCore agent -> AgentCore Gateway -> tools Lambda (check_eligibility, lookup_loan, find_branch, get_upcoming_dues, calculate_overdue_charges, simulate_partial_payment) -> Amazon DynamoDB.

  • The agent calls tools for every number (eligibility, loan figures, interest, late fees) instead of generating them.
  • Amazon Bedrock Guardrails check the customer's message and the agent's reply.
  • Every turn is logged to DynamoDB (time, anonymised user, category, tool, outcome). The dashboard reads it through API Gateway with a Cognito JWT authorizer and is hosted on S3 and CloudFront.
  • Reliability: asynchronous Lambda with 2 retries, a dead-letter SNS topic, no duplicate replies, and CloudWatch alarms that email an operator.
  • Resources are tagged project / owner / env. A CloudFormation template with deploy and teardown scripts covers the tables, topics, Lambdas, dashboard API and alarms.

Customer identification

The phone number comes from the verified WhatsApp sender in the event, never from chat text. Loan lookup also needs a loan ID that belongs to that number, and locks for 30 minutes after three wrong IDs. Only limited data is shown.

Challenges

  • Keeping an AI agent honest about money: all calculations live in tested tools (135 unit tests) and a live evaluation of 31 chats (31/31 passing) checks the deployed agent, including prompt-injection and "someone else's loan" attempts.
  • Identity without an OTP: the handler passes the verified number in and every tool re-checks ownership.
  • Changing the agent's prompt or tools invalidates stored chat history, so we version sessions and retry on a fresh session if a call fails.
  • A flaky third-party gold price API: the handler retries and falls back to the last good quote.

Accomplishments

A working end-to-end assistant on a real WhatsApp number with Malayalam support, a live gold price, a guardrail, alarms, and a dashboard that updates as people chat.

What we learned

Tool-calling agents are only as trustworthy as their tools and the checks around them. Replaying real chats in an evaluation script caught more problems than reading prompts did.

Data and limits

  • All customers, loans, branches and rates are synthetic demo data.
  • Phone-number identification is weaker than an OTP (swapped SIM, shared phone). A production system would use a separate channel such as SMS from the lender's own systems.
  • The CloudFormation template does not yet cover the WhatsApp account, agent, Gateway, Cognito or dashboard hosting.
  • Out of scope: payments, KYC, loan closure and top-up, core banking integration.

What's next

OTP over a separate channel, real data and core-system integration, an official lender or IBJA rate feed, per-purity LTV, proactive payment reminders with approved WhatsApp templates, and full infrastructure as code.

Built With

Share this project:

Updates

Submission history