Why Conversational AI Completes
the Telecom Bot Architecture

The LLM + MCP Tools design handles single-turn Q&A well. But real customer service requires multi-turn dialog management, slot filling, sentiment-aware escalation, and structured conversation flows. Here's how Conversational AI fills the gap.

What's Missing Without Conversational AI?

The current LLM-only approach handles simple lookups. But telecom customer service has structured, multi-step workflows that need deterministic flow control.

Current: LLM + Tools Only

Single-turn Q&A — "What is my bill?" works great
Multi-turn flows — "Change my plan" requires 4-5 exchanges with slot filling GAP
Slot collection — LLM may forget to ask for required fields GAP
Confirmation loops — No guarantee LLM confirms before executing changes GAP
Sentiment detection — Frustrated customer gets same response as happy one GAP
Human handoff — No structured escalation path to live agents GAP
Flow determinism — LLM may take unpredictable paths for critical operations GAP
Entity extraction — Relies entirely on LLM; no structured NLU layer GAP
Fallback strategy — When LLM fails, no graceful degradation GAP

Enhanced: Conversational AI Layer

Single-turn Q&A — LLM handles lookup queries via tools
Dialog Manager — State machine drives multi-turn flows deterministically NEW
Slot Filling Engine — Tracks required vs collected fields, prompts for missing NEW
Confirmation Gate — Mandatory confirm/deny before state-changing operations NEW
Sentiment Analyzer — Detects frustration → adjusts tone or escalates NEW
Agent Handoff — Structured transfer with full context summary NEW
Hybrid Routing — Deterministic flows for critical ops, LLM for flexible Q&A NEW
NLU Pipeline — Intent classifier + entity extractor before LLM NEW
Fallback Chain — LLM → FAQ search → canned response → human NEW

Real Scenario: Why It Matters

Consider: "I want to upgrade my plan from 499 to 999"

Without Conversational AI

LLM might call upgrade_plan tool immediately without confirmation
If customer says "wait, what are the benefits?" — LLM may lose upgrade context
If customer says "never mind" — tool may already have executed
No structured way to collect billing-cycle preference, proration choice
Risk: Unintended plan changes, customer complaints
vs

With Conversational AI

Dialog Manager enters PLAN_UPGRADE flow with required slots
Slot Filling: current_plan ✓, target_plan ✓, billing_preference ?, proration ?
Prompts for missing: "Should the change apply immediately or next cycle?"
Confirmation gate: "Upgrade to ₹999/month starting next cycle. Confirm?"
Safe: Tool only executes after explicit confirmation

Enhanced Architecture with Conversational AI

The Conversational AI layer sits between the API controllers and the LLM, providing structured dialog management.

🌐 Client Layer
Mobile App
Web Widget
IVR / Twilio
WhatsApp
▼ HTTPS / WSS
🔀 API Gateway + Auth
JWT Validation
Rate Limiting
TLS Termination
▼ Authenticated Request
🧠 Conversational AI Layer (NEW)
NLU EngineIntent + Entity Extraction
Dialog ManagerState Machine Flows
Slot Filling EngineRequired Field Tracking
Sentiment AnalyzerFrustration Detection
Conversation RouterHybrid LLM vs Flow
Agent HandoffEscalation Manager
▼ Routed: Structured Flow OR Free-form LLM
🤖 AI Orchestration Layer (Enhanced)
LLM OrchestratorLangChain4j
Guardrails EnginePre/Post Filters
Session ManagerRedis + TTL
NLG FormatterResponse Templating
▼ MCP Tool Calls
🔧 MCP Tool Server + 💾 Data Layer
Billing Tools
Account Tools
Plan Tools
PostgreSQL (RLS)
Redis (Sessions)

The Hybrid Routing Principle

The Conversation Router decides per-turn whether to use a deterministic dialog flow (for state-changing operations like plan upgrades, payments, profile updates) or free-form LLM (for informational queries like "what's my bill?" or "explain data rollover"). This gives you the reliability of state machines where it matters and the flexibility of LLM where it shines.

New Components for Conversational AI

Six new Java services that add structured dialog management to the existing prototype.

1. NLU Engine (Intent + Entity)

Classifies user intent before the LLM sees the message. Extracts structured entities (amounts, dates, plan names). Uses a lightweight classifier (logistic regression or small BERT) for speed, falling back to LLM for ambiguous cases.

DJL (Deep Java Library)ONNX RuntimeBERT-tiny

2. Dialog Manager (State Machine)

Manages conversation state for multi-turn flows. Each flow (billing inquiry, plan change, complaint) is a finite state machine with defined transitions, required slots, and confirmation gates. Persisted in Redis per session.

Spring StatemachineRedis PersistenceYAML Flow Defs

3. Slot Filling Engine

Tracks which information has been collected and what's still needed. Generates targeted prompts for missing slots. Validates slot values against business rules (e.g., plan code must exist, amount must be positive).

Custom JavaValidation APIEntity Resolution

4. Sentiment Analyzer

Detects customer frustration, anger, or confusion in real-time. Triggers tone adjustments ("I understand this is frustrating...") or escalation to human agents when sentiment drops below threshold.

DJL + DistilBERTSliding WindowEscalation Rules

5. Conversation Router

The brain that decides per-turn: use a structured dialog flow (deterministic, safe for mutations) or free-form LLM (flexible, great for queries). Routes based on detected intent + current dialog state.

Rule EngineIntent → Flow MapFallback Chain

6. Agent Handoff Manager

When the bot can't resolve (3+ failed attempts, negative sentiment, explicit request), it prepares a structured context summary and transfers to a human agent via queue with full conversation history.

SQS / RabbitMQContext SummarizerAgent Dashboard API

Component Interaction Matrix

User SaysNLU OutputRouter DecisionHandler
"What's my bill?"Intent: BILL_INQUIRY
Entities: none
Free-form LLMLLM → get_current_bill tool → response
"Change my plan to 999"Intent: PLAN_CHANGE
Entity: target_plan=POST999
Structured FlowDialog Manager → PLAN_CHANGE flow → slot filling → confirmation → tool
"This is the third time I'm calling!"Intent: COMPLAINT
Sentiment: FRUSTRATED
Escalation PathSentiment triggers empathy prompt → Agent Handoff if persistent
"Update my email to new@mail.com"Intent: PROFILE_UPDATE
Entity: field=email, value=new@mail.com
Structured FlowDialog Manager → PROFILE_UPDATE → OTP re-verify → confirmation → tool
"How does data rollover work?"Intent: FAQ
Entities: topic=data_rollover
RAG + LLMVector search FAQ → LLM formats answer
"Talk to a human"Intent: AGENT_REQUESTHandoffAgent Handoff Manager → context summary → queue

Dialog Flow: Plan Upgrade

Example of a structured multi-turn conversation managed by the Dialog Manager.

1INIT
Intent detected:
PLAN_CHANGE
2COLLECT
Slot filling:
target plan, timing
3VALIDATE
Check plan exists,
eligibility rules
4CONFIRM
Show summary,
ask confirmation
5EXECUTE
Call MCP tool
after "Yes"
6COMPLETE
Confirm success,
offer next help

Conversation Transcript

Customer: I want to upgrade my plan

→ NLU: intent=PLAN_CHANGE | Router: STRUCTURED_FLOW | State: INIT → COLLECT

Bot: I'd be happy to help you upgrade! You're currently on the Postpaid ₹499 plan. Which plan would you like to switch to? We have Postpaid ₹999 (150GB data, unlimited calls) and Fiber ₹799 (200GB).

Customer: The 999 one

→ NLU: entity=POST999 | Slot filled: target_plan=POST999 | Missing: timing | State: COLLECT

Bot: Great choice! The Postpaid ₹999 gives you 150GB data and unlimited calls. Should the change take effect immediately or from your next billing cycle (April 1)?

Customer: Next cycle

→ Entity: timing=NEXT_CYCLE | All slots filled | State: COLLECT → VALIDATE → CONFIRM

Bot: Here's a summary of your plan change:
• Current: Postpaid ₹499/month
• New: Postpaid ₹999/month (150GB, unlimited calls)
• Effective: 01 Apr 2026
• Monthly increase: ₹500

Shall I proceed with this upgrade? (Yes/No)

Customer: Yes, go ahead

→ Confirmation: YES | State: CONFIRM → EXECUTE → COMPLETE | Tool: upgrade_plan(POST999, NEXT_CYCLE)

Bot: Done! Your plan has been upgraded to Postpaid ₹999. It will take effect on 01 Apr 2026. You'll receive a confirmation SMS shortly. Is there anything else I can help with?

All Supported Dialog Flows

Flow IDTrigger IntentRequired SlotsConfirmation?Mutates Data?
BILL_PAYMENTPAY_BILLamount, payment_methodYesYes
PLAN_UPGRADEPLAN_CHANGEtarget_plan, timingYesYes
PROFILE_UPDATEUPDATE_PROFILEfield, new_value, otpYesYes
COMPLAINT_FILEFILE_COMPLAINTcategory, descriptionYesYes
PLAN_INQUIRYPLAN_INFOnone (optional: plan_code)NoNo
BILL_INQUIRYBILL_INFOnone (optional: month)NoNo
USAGE_CHECKDATA_USAGEnone (optional: period)NoNo
AGENT_TRANSFERHUMAN_REQUESTnoneNoNo

Implementation Strategy

Key Java classes and how they integrate with the existing Spring Boot prototype.

Integration Point

The Conversational AI layer is inserted between the controllers and the AI orchestrator. The ChatController now calls ConversationRouter instead of calling AiOrchestratorService directly. The router decides whether to use a structured dialog flow or free-form LLM per turn.

Core Integration Flow

// ChatController (modified)
@PostMapping("/message")
public
ResponseEntity<ChatResponse> chat(@RequestBody ChatRequest req) {
// Step 1: NLU extracts intent + entities
NluResult nlu = nluEngine.analyze(req.message());
// Step 2: Sentiment check
SentimentScore sentiment = sentimentAnalyzer.analyze(req.message());
// Step 3: Router decides: structured flow vs free-form LLM
return conversationRouter.route(sessionId, nlu, sentiment, req.message()); }

File Overview

New FilePurposeLines (est.)
NluEngine.javaIntent classification + entity extraction via lightweight model~180
DialogManager.javaState machine for structured conversation flows~250
SlotFillingEngine.javaTracks required slots, generates prompts for missing fields~200
SentimentAnalyzer.javaReal-time sentiment scoring with escalation triggers~120
ConversationRouter.javaHybrid routing: structured flows vs free-form LLM~220
AgentHandoffManager.javaContext summarization and queue-based agent transfer~150
DialogFlowDefinitions.javaYAML-driven flow definitions (states, slots, transitions)~180
ConversationState.javaRedis-persisted session state (current flow, slots, history)~100