Skip to content
Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

27 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

TIARA - Tata Intelligent Agent for Real-world Agents

EY Techathon 6.0 Agentic AI Next.js TypeScript

An intelligent multi-agent AI system revolutionizing personal loan sales through conversational banking

Built for EY Techathon 6.0 - BFSI Challenge


πŸŽ₯ Demo Video

πŸ‘‡ Click the thumbnail image to watch video on youtube TIARA


πŸ“‹ Table of Contents


Overview

TIARA (Tata Intelligent Agent for Real-world Agents) is a next-generation conversational AI system that transforms the personal loan sales process. Built on a multi-agent architecture, TIARA orchestrates specialized AI agents to deliver a seamless, human-like loan application experience from initial conversation to sanction letter generation.

Challenge Context

EY Techathon 6.0 - BFSI Track: Tata Capital

Tata Capital, a leading NBFC, aims to increase personal loan sales through an AI-driven web chatbot. The challenge requires building an agentic AI solution where a Master Agent coordinates multiple Worker Agents to handle the complete loan journey - from discovery to approval.


Problem Statement

Business Objective

Improve personal loan sales success rate through an AI-driven conversational approach that:

  • Engages customers landing via digital ads/marketing emails
  • Understands customer needs and convinces them to take personal loans
  • Completes end-to-end process: verification β†’ underwriting β†’ sanction letter generation

Key Requirements

  1. Master Agent: Orchestrates conversation flow and coordinates worker agents
  2. Worker Agents:
    • Sales Agent: Negotiates terms, discusses amount/tenure/rates
    • Verification Agent: Confirms KYC details and document uploads
    • Underwriting Agent: Validates eligibility based on credit rules
    • Sanction Generator: Creates automated PDF approval letters

Solution Architecture

              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚                          TIARA System                           β”‚
              β”‚                   (Master Agent Controller)                     β”‚
              β”‚              Powered by Google Gemini 2.5 Flash                 β”‚
              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                       β”‚
                      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                      β”‚                β”‚                β”‚
                      β–Ό                β–Ό                β–Ό
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚ Discovery     β”‚ β”‚ Sales Agent  β”‚ β”‚ Verification β”‚
              β”‚ & Welcome     β”‚ β”‚ (Negotiation)β”‚ β”‚ Agent (KYC)  β”‚
              β”‚ (Master)      β”‚ β”‚              β”‚ β”‚              β”‚
              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      β”‚                β”‚                β”‚
                      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                       β–Ό
                      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                      β”‚    Underwriting Agent          β”‚
                      β”‚    (Credit Evaluation)         β”‚
                      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                       β–Ό
                      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                      β”‚   Sanction Letter Generator    β”‚
                      β”‚   (PDF Generation - pdf-lib)   β”‚
                      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Agentic AI Workflow

Stage-by-Stage Journey

Stage 1: Welcome & Authentication

  • Master Agent greets the customer
  • Phone number collection & OTP verification
  • Customer profile retrieval from mock CRM

Stage 2: Discovery

  • Master Agent understands loan requirements
  • Extracts: Purpose, Amount, Preferred Tenure
  • Natural language understanding for amount detection (β‚Ή3 lakhs, 300000, etc.)

Stage 3: Sales

  • Sales Agent presents personalized loan offer
  • Shows EMI calculations with tenure options (36/48/60 months)
  • Handles negotiation and customer objections
  • Displays credit score and affordability ratios

Stage 4: Verification

  • Verification Agent requests KYC documents
  • Document upload interface: Aadhaar, PAN, Salary Slip (conditional)
  • Real-time upload validation

Stage 5: Underwriting

  • Underwriting Agent evaluates eligibility
  • Credit score verification (min 700/900)
  • Pre-approved limit checks
  • EMI-to-salary ratio validation (max 50%)

Stage 6: Sanction

  • Sanction Generator creates PDF offer letter
  • Instant download with loan details
  • Unique Loan ID generation

Key Features

🎭 Multi-Agent Orchestration

  • Master Agent seamlessly coordinates 4 specialized worker agents
  • Intelligent stage transitions based on conversation context
  • Agent handoff notifications for transparency

πŸ’¬ Human-Like Conversation

  • Natural language understanding using Google Gemini 2.5 Flash
  • Context-aware responses with conversation memory
  • Smart amount/tenure extraction from free-form text

πŸ“Š Intelligent Underwriting

Approval Rules:
βœ“ Amount ≀ Pre-approved Limit β†’ Instant Approval
βœ“ Amount ≀ 2Γ— Limit + Salary Slip β†’ Conditional Approval
βœ— Amount > 2Γ— Limit β†’ Rejection
βœ— Credit Score < 700 β†’ Rejection
βœ— EMI > 50% Salary β†’ Rejection

🌐 Multi-Language Support

  • English, Hindi, Odia, Tamil, Malayalam, Marathi, Kannada, Bengali
  • Language switcher in chat interface

πŸ“„ Automated Sanction Letters

  • PDF generation with loan details
  • Downloadable offer letters
  • Professional formatting with Tata Capital branding

Tech Stack

Frontend

  • Next.js 16 - React framework with App Router
  • TypeScript - Type-safe development
  • Tailwind CSS - Utility-first styling
  • Lucide Icons - Modern icon library

Backend

  • Next.js API Routes - Serverless functions
  • OpenRouter API - AI model orchestration
  • Google Gemini 2.5 Flash Lite - Conversational AI

Document Generation

  • PDFKit - PDF creation library
  • Canvas-based rendering for professional documents

State Management

  • React Hooks (useState, useEffect, useRef)
  • localStorage - Session persistence
  • Server-side memory store for conversation history

Installation & Setup

Prerequisites

Node.js 18.x or higher
npm or yarn package manager

Clone Repository

git clone https://github.com/sujit-prog/EY.git
cd EY

Install Dependencies

npm install
# or
yarn install

Environment Variables

Create a .env.local file:

OPENROUTER_API_KEY=your_openrouter_api_key_here

Run Development Server

npm run dev
# or
yarn dev

Open http://localhost:3000 in your browser.

Build for Production

npm run build
npm start

User Journey

Step-by-Step Flow

  1. Landing

    • Customer arrives via marketing campaign
    • TIARA welcomes with friendly greeting
  2. Authentication

    • Phone number input: 9337236782
    • OTP verification (any 4-digit code accepted in demo)
  3. Conversation

    User: "I need a loan for education"
    TIARA: "Great! How much are you looking to borrow?"
    
    User: "3 lakhs"
    TIARA: "Based on your profile, we can offer β‚Ή3 lakhs at 10.5% p.a..."
    
  4. Negotiation

    • EMI calculations shown
    • Tenure options presented
    • Customer can adjust terms
  5. Document Upload

    • Aadhaar Card βœ“
    • PAN Card βœ“
    • Salary Slip (if amount > pre-approved limit) βœ“
  6. Instant Decision

    • Underwriting completes in seconds
    • Approval/rejection notification
  7. Sanction Letter

    • PDF download with full loan details
    • Unique Loan ID for reference

Underwriting Logic

Approval Matrix

Scenario Amount Credit Score Salary Slip EMI Ratio Decision
Instant ≀ Pre-approved β‰₯ 700 Not Required ≀ 50% βœ… APPROVED
Conditional ≀ 2Γ— Limit β‰₯ 700 Required ≀ 50% βœ… APPROVED
High Amount > 2Γ— Limit Any Any Any ❌ REJECTED
Low Credit Any < 700 Any Any ❌ REJECTED
High EMI Any β‰₯ 700 Yes > 50% ❌ REJECTED

Example Calculations

Customer: Dharmendra Mahanta
Salary: β‚Ή60,000/month
Pre-approved: β‚Ή4.5 lakhs
Credit Score: 780/900

Scenario 1: β‚Ή3 lakhs request
β†’ Within limit β†’ Instant Approval βœ…

Scenario 2: β‚Ή7 lakhs request  
β†’ < 2Γ— limit (β‚Ή9L) β†’ Needs salary slip
β†’ EMI: β‚Ή16,500 (27.5% of salary) β†’ Approved βœ…

Scenario 3: β‚Ή10 lakhs request
β†’ > 2Γ— limit β†’ Rejected ❌

Test Scenarios

Pre-Configured Test Users

Phone Name Salary Credit Pre-approved Scenario
9876543210 Rahul Sharma β‚Ή75K 820 β‚Ή6L Instant Approval
9337236782 Dharmendra Mahanta β‚Ή60K 780 β‚Ή4.5L Conditional
9876543214 Vikram Singh β‚Ή55K 650 β‚Ή2L Low Credit Score
9876543212 Amit Patel β‚Ή125K 850 β‚Ή10L Premium Customer

Testing Flows

Flow 1: Instant Approval

Phone: 9876543210
Amount: β‚Ή4 lakhs
Expected: Approved without salary slip

Flow 2: Salary Slip Required

Phone: 9337236782  
Amount: β‚Ή7 lakhs
Expected: Approved after salary slip upload

Flow 3: Rejection - Amount

Phone: 9876543216
Amount: β‚Ή10 lakhs
Expected: Rejected (exceeds 2Γ— limit)

Project Structure

EY/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ page.tsx                 # Landing page
β”‚   β”œβ”€β”€ layout.tsx               # Root layout
β”‚   β”œβ”€β”€ api/
β”‚   β”‚   └── chat/
β”‚   β”‚       └── route.ts         # Multi-agent orchestration logic
β”‚   └── loan/
β”‚       └── chat/
β”‚           └── page.tsx         # Chatbot page route
β”œβ”€β”€ components/
β”‚   └── chat/
β”‚       β”œβ”€β”€ ChatShell.tsx        # Main chat UI component
β”‚       β”œβ”€β”€ MessageBubble.tsx    # Individual message rendering
β”‚       β”œβ”€β”€ SuggestionChips.tsx  # Message suggestion
β”‚       └── StageIndicator.tsx   # Visual stage progress
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ users.ts                 # Mock CRM data (10 customers)
β”‚   β”œβ”€β”€ prompts.ts               # Agent system prompts
β”‚   β”œβ”€β”€ emi.ts                   # EMI calculation utilities
β”‚   β”œβ”€β”€ pdf.ts                   # Sanction letter generator
β”‚   β”œβ”€β”€ memory.ts                # Session state management
β”‚   β”œβ”€β”€ loanConfig.ts            # Interest rates & terms
β”‚   └── openrouter.ts            # AI model configuration
β”œβ”€β”€ public/                      # Static assets
β”œβ”€β”€ .env.local                   # Environment variables
└── README.md                    # This file

Team

Team Name: Veggies

Team Members:

Avatar Name Role GitHub
Dharmendra Mahanta Backend Development @dharmendra-007
Sujit Kumar Sha Frontend Development @sujit-prog
Alpana Mohanty Agentic AI Backend Development @Al-Pa-Na
Aditi Panda Backend,system integration @aditipanda01
Prerana Priyadarsini Das Business Logic & Rule Design @preranadas03

Institution: Veer Surendra Sai University Of Technology, Burla, Sambalpur

Hackathon: EY Techathon 6.0 - BFSI Challenge


Key Learnings

Agentic AI Design Principles

  1. Clear Agent Boundaries: Each agent has a specific, well-defined role
  2. Master Orchestration: Central controller manages workflow transitions
  3. Context Preservation: Conversation history maintained across agents
  4. Error Handling: Graceful degradation when agents fail
  5. Human-in-the-Loop: User controls pace of conversation

Technical Achievements

  • βœ… Implemented multi-agent orchestration with 4 specialized AIs
  • βœ… Built intelligent underwriting with 5+ business rules
  • βœ… Created natural language understanding for loan parameters
  • βœ… Developed real-time document upload simulation
  • βœ… Generated professional PDF sanction letters
  • βœ… Achieved sub-2-second response times

Edge Cases Handled

Edge Case Handling Strategy
User uploads wrong document Re-upload prompt with clear instructions
Amount in different formats Regex patterns for lakhs/L/numbers
Tenure not specified Default to 48 months, allow adjustment
Network failure Error message with retry option
Invalid phone number Validation before OTP generation
Borderline credit score Clear rejection message with reason
Multiple loan requests Session isolation via unique IDs

Future Enhancements

  • Voice Integration: Speech-to-text for hands-free interaction
  • Live Credit Bureau API: Real-time credit score fetching
  • Co-applicant Support: Joint loan applications
  • EMI Calculator Widget: Interactive affordability tool
  • WhatsApp Integration: Loan application via messaging
  • Predictive Analytics: ML-based approval likelihood
  • Regional Language NLP: Advanced multilingual support
  • Video KYC: Live verification for high-value loans

Contact

For queries regarding this project:

Email: dev.dharmendra.m@gmail.com
LinkedIn: @dharmendram007
GitHub: @dharmendra-007


Built with ❀️ for EY Techathon 6.0

Empowering India's Digital Future Through Agentic AI

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages