Skip to content

Loan Scoring Workflow - Usage Examples

Example 1: Basic Step-by-Step Workflow

Scenario: New loan inquiry for existing customer

Step 1: Initiate Workflow

User: "I want to check if customer 456 qualifies for a loan"

AI Response:
{
  "step": "search_customer",
  "success": true,
  "customer_id": 456,
  "customer_name": "Jane Smith",
  "message": "Customer found: Jane Smith. Now select a loan product.",
  "next_step": "select_product",
  "prompt": "Which loan product would they like?"
}

Step 2: Select Product

User: "What products do we have?"

AI: (calls list_loan_products)
1. Personal Loan - 12% annual interest, Min: 10k, Max: 500k
2. Business Loan - 15% annual interest, Min: 50k, Max: 2M
3. Home Loan - 8% annual interest, Min: 100k, Max: 5M

User: "Let's use the Personal Loan"

AI Response:
{
  "step": "select_product",
  "success": true,
  "customer_id": 456,
  "product_id": 1,
  "product": {
    "id": 1,
    "name": "Personal Loan",
    "code": "PL001",
    "interest_rate": 12.0,
    "min_amount": 10000,
    "max_amount": 500000,
    "tenure_days": 365
  },
  "message": "Product selected: Personal Loan. Now enter the loan amount.",
  "next_step": "enter_amount",
  "prompt": "Enter the loan amount (min: 10000, max: 500000)"
}

Step 3: Enter Amount

User: "They want 75000"

AI Response:
{
  "step": "enter_amount",
  "success": true,
  "customer_id": 456,
  "product_id": 1,
  "loan_amount": 75000,
  "message": "Loan amount 75000 confirmed. Now calculating loan score...",
  "next_step": "calculate_score",
  "prompt": "Ready to calculate the loan score"
}

Step 4: Calculate Score

User: "Go ahead"

AI Response:
{
  "step": "calculate_score",
  "success": true,
  "customer_id": 456,
  "customer_name": "Jane Smith",
  "product": "Personal Loan",
  "loan_amount": 75000,
  "score_result": {
    "score": 820,
    "risk_level": "LOW",
    "recommendation": "APPROVED",
    "breakdown": {
      "created_on": "2026-02-02T14:30:00",
      "risk_level": "LOW"
    }
  },
  "message": "Loan scoring completed. Score: 820 (LOW risk). Recommendation: APPROVED ✓",
  "workflow_complete": true
}


Example 2: All-in-One Request

Scenario: Fast-track scoring with all parameters provided

User: "Run loan scoring for customer 789, product 2 (Business Loan), amount 200000"

AI Response (after all steps):
{
  "step": "calculate_score",
  "success": true,
  "customer_id": 789,
  "customer_name": "Bob Johnson",
  "product": "Business Loan",
  "loan_amount": 200000,
  "score_result": {
    "score": 650,
    "risk_level": "MEDIUM",
    "recommendation": "REVIEW",
    "breakdown": {
      "created_on": "2026-02-02T15:45:00",
      "risk_level": "MEDIUM"
    }
  },
  "message": "Loan scoring completed. Score: 650 (MEDIUM risk). Recommendation: REVIEW - Additional documentation recommended",
  "workflow_complete": true
}

Example 3: Error Scenario - Customer Not Found

Scenario: User provides invalid customer ID

User: "Do loan scoring for customer 99999"

AI Response (Step 1):
{
  "step": "search_customer",
  "error": "Customer with ID 99999 not found",
  "prompt": "Enter a valid customer ID",
  "suggestion": "You can search for customers by name using list_customers"
}

User: "Search for customers named John"

AI: (calls list_customers)
Found 3 customers:
- John Doe (ID: 123)
- John Smith (ID: 456)
- Johnny Brown (ID: 789)

User: "Use customer 123"

AI Response:
{
  "step": "search_customer",
  "success": true,
  "customer_id": 123,
  "customer_name": "John Doe",
  "message": "Customer found: John Doe. Now select a loan product.",
  "next_step": "select_product"
}

Example 4: Error Scenario - Blacklisted Customer

Scenario: Customer is on blacklist

User: "Check loan scoring for customer 555"

AI Response (Step 1):
{
  "step": "search_customer",
  "error": "Customer 555 is blacklisted and cannot apply for loans",
  "prompt": "Enter a different customer ID or contact support",
  "details": {
    "blacklist_reason": "Loan default",
    "blacklist_date": "2025-06-15",
    "status": "active"
  }
}

User: "Can we check if they're eligible for removal?"

AI: "You'll need to contact the compliance department. 
     Check the blacklist_status of customer 555 for more details, 
     or use get_blacklist_status tool for full information."

Example 5: Error Scenario - Amount Out of Range

Scenario: Requested amount exceeds product limits

User: "They want to borrow 1000000"

AI Response (Step 3):
{
  "step": "enter_amount",
  "error": "Loan amount must be between 10000 and 500000",
  "prompt": "Enter a valid loan amount within the product limits",
  "product_limits": {
    "product_name": "Personal Loan",
    "minimum": 10000,
    "maximum": 500000
  }
}

User: "What about 400000?"

AI Response:
{
  "step": "enter_amount",
  "success": true,
  "customer_id": 456,
  "product_id": 1,
  "loan_amount": 400000,
  "message": "Loan amount 400000 confirmed. Now calculating loan score...",
  "next_step": "calculate_score"
}

Example 6: Multiple Customers Sequential Scoring

Scenario: Staff needs to score multiple customer applications

User: "Score customer 111 for product 1, amount 50000"

AI: Completes workflow for customer 111
Score: 700 (LOW) → APPROVED

User: "Now score customer 222 for product 2, amount 150000"

AI: Completes workflow for customer 222
Score: 580 (MEDIUM) → REVIEW

User: "And customer 333 for product 3, amount 300000"

AI: Completes workflow for customer 333
Score: 620 (MEDIUM) → REVIEW

User: "Summarize all three"

AI:
Loan Scoring Summary:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1. Customer 111 - 50,000 Personal Loan
   Score: 700 (LOW) → APPROVED ✓

2. Customer 222 - 150,000 Business Loan
   Score: 580 (MEDIUM) → REVIEW ⚠

3. Customer 333 - 300,000 Home Loan
   Score: 620 (MEDIUM) → REVIEW ⚠
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Example 7: Score Investigation

Scenario: Need to understand why a score is low

User: "The score of 450 for customer 777 seems low. What's the issue?"

AI: "The LOW score (450, HIGH RISK) is likely due to:

     Let me check the score history for customer 777:
     (calls get_loan_score_history)

     Recent Scores:
     • 6 months ago: 580 (MEDIUM)
     • 3 months ago: 520 (MEDIUM)
     • Today: 450 (HIGH)

     Possible factors:
     1. Recent loan defaults or missed payments
     2. Increased debt exposure
     3. Change in income status

     Recommendation: Review customer's recent transaction history
     and request updated documentation before proceeding."

User: "Check their recent transactions and blacklist status"

AI: (calls get_transaction_by_id, list_transactions, get_blacklist_status)

Results show:
- Multiple overdue loan payments in last 3 months
- High transaction volume (possible financial stress)
- NOT currently blacklisted but at risk

Example 8: Product Comparison

Scenario: Customer eligible for multiple products

User: "Can we compare products for customer 444 with amount 80000?"

AI: "Let me score customer 444 with different products:

Product 1: Personal Loan (12%)
Score: 750 (LOW) → APPROVED ✓
Monthly: ~7,200 over 12 months

Product 2: Business Loan (15%)
Score: 680 (LOW) → APPROVED ✓
Monthly: ~8,000 over 12 months

Product 3: Home Loan (8%)
Score: 790 (LOW) → APPROVED ✓✓ (Best)
Monthly: ~6,800 over 12 months

Recommendation: Home Loan offers best terms and highest approval score"

Example 9: Bulk Scoring Report

Scenario: Generate report for multiple customer applications

User: "I have 5 loan applications to process. Can you score them all?"

AI: "I'll score each application. Please provide customer IDs and amounts:

Provide data like:
1. Customer 111, 50,000
2. Customer 222, 75,000
3. Customer 333, 100,000
4. Customer 444, 80,000
5. Customer 555, 120,000"

User: (provides list)

AI: (Runs workflow for each, times vary by scoring complexity)

Processing Results:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✓ Customer 111 - Score: 750 (LOW) - APPROVED
✓ Customer 222 - Score: 680 (LOW) - APPROVED  
⚠ Customer 333 - Score: 580 (MEDIUM) - REVIEW
⚠ Customer 444 - Score: 620 (MEDIUM) - REVIEW
✗ Customer 555 - Score: 420 (HIGH) - REJECT
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Summary:
- 2 Approved
- 2 Require Review
- 1 Rejected

Next Steps for Review Cases: Request additional documentation"

Example 10: Workflow with Interruption & Resume

Scenario: User needs to check something mid-workflow

User: "Score customer 666 with product 1 for 120000"

AI: Starts workflow, completes Step 1-3

User: "Wait, let me verify that product. What's the current rate?"

AI: (answers the question)
"Product 1 (Personal Loan) has an interest rate of 12% per annum"

User: "OK, proceed with scoring"

AI: (continues with Step 4, calculating score)

Score: 710 (LOW) → APPROVED ✓

Common Workflow Patterns

Pattern 1: Quick Approval Check

User: "Will customer 100 get approved for 60000?"
AI: (runs full workflow)
Result: Score 780 (LOW) → APPROVED ✓

Pattern 2: Risk Assessment

User: "Is customer 200 high risk?"
AI: (runs workflow)
Result: Score 420 (HIGH) → REJECT ✗ (Yes, high risk)

Pattern 3: Maximum Loan Amount

User: "What's the max customer 300 can borrow?"
AI: "Based on score of 750, the product max is 500,000.
     Recommend: 350,000-400,000 for better terms"

Pattern 4: Comparative Scoring

User: "Which product is best for customer 400?"
AI: (scores with multiple products, recommends best)

Tips for Effective Usage

  1. Have Data Ready: Have customer ID and desired amount before starting
  2. Verify Information: Always confirm customer name and amount
  3. Check Limits First: Review product limits before entering amount
  4. Understand Risk Levels: Know what each score range means
  5. Use Score History: Check past scores for trends
  6. Review Blacklist: Always check blacklist status for high-risk
  7. Document Decisions: Keep notes on why you approve/reject
  8. Follow Up: For REVIEW cases, get additional documentation

These examples demonstrate the flexibility and power of the loan scoring workflow in various real-world scenarios.