gvaishnava/ai-call-center-assistant
๐ AI Call Center Assistant
An end-to-end Agentic AI system that transforms raw call center data โ audio recordings or text transcripts โ into structured insights using a multi-agent LangGraph pipeline powered by GPT-4o.
๐ง System Overview
The AI Call Center Assistant automatically performs the following on every call:
- Validates & registers call metadata (customer, agent, timestamp)
- Transcribes audio to text (via OpenAI Whisper API for files, or local
RealtimeSTTfor Live WebRTC Calls) or accepts text directly - Summarizes the conversation into key points, sentiment, and action items
- Quality scores the agent's performance against a structured rubric
- Detects sentiment & churn risk from the customer's behavior
- Presents all results through an interactive Streamlit UI
๐๏ธ Architecture
User Input (Text / Audio)
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Intake Agent โ Validates & enriches metadata (UUID, timestamp)
โโโโโโโโโโโโโโฌโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Transcription Agent โ Whisper API (audio files), RealtimeSTT (Live Call), or passthrough (text)
โโโโโโโโโโโโโโฌโโโโโโโโโโโโโ
โ
โโโโโโดโโโโโ
โ โ (parallel async execution via LangGraph)
โผ โผ
โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโ
โ Summarizationโ โ Quality Scoring โ
โ Agent โ โ Agent โ
โโโโโโโโฌโโโโโโโโ โโโโโโโโโโฌโโโโโโโโโโโ
โ โ
โโโโโโโโโโฌโโโโโโโโโโ
โผ
Streamlit UI (Results)All agents are connected via a LangGraph StateGraph with full async/await support, ensuring summarization and quality scoring run in parallel after transcription completes.
๐ค Agents
1. IntakeAgent โ agents/intake_agent.py
- Validates raw user input using Pydantic models
- Auto-generates
call_id(UUID) andtimestampif not provided - Returns a structured
CallMetadataobject
2. TranscriptionAgent โ agents/transcription_agent.py
- Live Call (WebRTC): Uses
streamlit-webrtcandRealtimeSTT(local, free Whispertiny.enorbase.enmodels) to capture and transcribe browser microphone audio instantly via true multi-threading. - Audio File mode: Calls OpenAI
whisper-1viaAsyncOpenAIfor fast file-based speech-to-text. - Text mode: Directly wraps provided text into a
TranscriptionResult - Cloud API calls are wrapped with LangSmith
wrap_openaifor full trace visibility
3. SummarizationAgent โ agents/summarization_agent.py
- Uses
gpt-4owith a structured prompt via LangChain - Extracts:
- One-line call summary
- Key discussion points
- Overall sentiment (Positive / Neutral / Negative)
- Action items โ including callbacks, follow-ups, and future dates
- Returns a structured
CallSummaryPydantic object
4. QualityScoreAgent โ agents/quality_score_agent.py
- Uses
gpt-4owith a loaded rubric fromconfig/rubrics.json - Scores agent performance across 5 dimensions (1โ10 scale): | Dimension | Description | |---|---| |
technical_score| Technical knowledge & issue resolution | |professionalism_score| Demeanor, respectfulness, brand representation | |communication_score| Clarity, conciseness, language appropriateness | |process_adherence_score| Policy compliance & verification steps | |soft_skills_score| Empathy, active listening, emotional de-escalation | - Also extracts: customer sentiment, primary emotion, agent tone, sentiment shift, and churn risk
5. RoutingAgent โ agents/routing_agent.py
- LangGraph orchestrator that connects all agents
- Exposes a single
async run(raw_input)entry point - Manages the state machine (
GraphState) across all nodes - Handles errors gracefully per node without crashing the full pipeline
๐ฅ๏ธ User Interface
Streamlit (ui/streamlit_app.py) provides an interactive web dashboard:
- Choose input mode: Text Transcript, Audio File upload (WAV/MP3/M4A), or Live Call (WebRTC)
- Live Call mode streams browser audio via true multi-threaded
AudioProcessorBaseinto a local Whisper engine, updating text on the screen word-by-word with zero text loss. - Enter customer and agent names
- Click Generate Insights to run the full pipeline
- View results:
- Quality score metric cards (Professionalism, Soft Skills, Technical)
- Sentiment analysis (sentiment, emotion, agent tone, churn risk, sentiment shift)
- Call summary (one-line, key points, action items)
- Full transcript expander
- Quality scoring rubric notes expander
๐ Quality Rubric
Scoring rubric is externalized to config/rubrics.json for easy customization without code changes.
Each category maps score brackets to agent behavior descriptions:
๐ Observability โ LangSmith
The system integrates LangSmith for full trace visibility into every call processed:
- All LangChain/LangGraph calls are automatically traced (via
LANGCHAIN_TRACING_V2) - Direct OpenAI Whisper calls are traced via
langsmith.wrappers.wrap_openai - View token usage, latency, prompts, outputs, and LangGraph node transitions at smith.langchain.com
๐ Getting Started
Prerequisites
- Python 3.10+
- OpenAI API Key
- LangSmith API Key (optional, for tracing)
- System Packages:
ffmpegandportaudio19-dev(Linux) for microphone/audio processing.
Installation
# 1. Clone the repository
git clone <repo-url>
cd "AI Call Center Assistant"
# 2. Create and activate virtual environment
python -m venv venv
.\venv\Scripts\Activate.ps1 # Windows
source venv/bin/activate # Linux/Mac
# 3. Install dependencies
pip install -r requirements.txtConfiguration
Create a .env file in the root directory:
OPENAI_API_KEY="sk-..."
# Optional: LangSmith tracing
LANGCHAIN_TRACING_V2=true
LANGCHAIN_API_KEY="lsv2_..."
LANGCHAIN_PROJECT="AI Call Center Assistant"OPENAI_API_KEY = "sk-..."
LANGCHAIN_TRACING_V2 = "true"
LANGCHAIN_API_KEY = "lsv2_..."
LANGCHAIN_PROJECT = "AI Call Center Assistant"
# TURN Server (Metered.ca)
TURN_USERNAME = "..."
TURN_CREDENTIAL = "..."
# Optional: Faster Hugging Face downloads
HF_TOKEN = "hf_..."Hugging Face Spaces Deployment
This repository includes the required metadata in README.md to run as a Hugging Face Space.
- Create a new Space on Hugging Face.
- Select Streamlit as the SDK.
- Connect this GitHub repository.
- Add the secrets listed above to Settings > Variables and Secrets on Hugging Face.
- Note: Use "Secrets" for API keys and "Variables" for public config.
- Hugging Face will automatically install dependencies from
requirements.txtand system packages frompackages.txt.
The application automatically syncs these secrets to environment variables on startup.
Run the Application
streamlit run ui/streamlit_app.pyOpen http://localhost:8501 in your browser.
๐งช Testing
The project includes a closed-ended LLM-as-judge evaluation framework.
python -m tests.test_closed_ended_validationThis runs a second gpt-4o model as an independent judge that evaluates each pipeline output against pre-defined yes/no validation questions per sample transcript.
Latest results: 10 / 10 tests passed (100%)
Sample validation questions include:
- "Does the one_line_summary mention an issue with the internet cutting out or fluctuating?"
- "Is the churn_risk_detected correctly identified based on the customer's behavior?"
- "Did the quality score professionalism_score exceed 6?"
Real-Time Audio Testing
To mathematically verify that the WebRTC background threads are lossless, a direct STT pipeline test is provided.
python tests/test_realtime_stt.pyThis script bypasses Streamlit and chunks a standard WAV file into 100ms segments, simulating exactly how the browser sends audio, proving that the local VAD and threading implementation does not drop frames.
๐ Project Structure
AI Call Center Assistant/
โโโ agents/
โ โโโ intake_agent.py # Input validation & metadata extraction
โ โโโ transcription_agent.py # Audio-to-text (Whisper) or text passthrough
โ โโโ summarization_agent.py # GPT-4o call summarization
โ โโโ quality_score_agent.py # GPT-4o rubric-based quality scoring
โ โโโ routing_agent.py # LangGraph orchestrator
โโโ config/
โ โโโ rubrics.json # Dynamic quality scoring rubric
โ โโโ mcp.yaml # Model Control Plane configuration
โโโ data/
โ โโโ sample_transcripts/
โ โโโ samples.json # Sample call transcripts for testing
โโโ tests/
โ โโโ test_closed_ended_validation.py # LLM-as-judge evaluation suite
โโโ ui/
โ โโโ streamlit_app.py # Streamlit web interface
โโโ utils/
โ โโโ logger.py # Centralized logging
โ โโโ validation.py # Pydantic models (CallMetadata, QualityScore, etc.)
โโโ .env # API keys & environment config
โโโ requirements.txt # Python dependencies
โโโ docker-compose.yml # Docker deployment config
โโโ README.md # This document๐ฆ Dependencies
๐ฎ Key Design Decisions
๐ณ Docker Deployment
docker-compose up --buildThe docker-compose.yml is configured to run the Streamlit application in a container.
Built with LangGraph, GPT-4o, OpenAI Whisper, LangSmith, and Streamlit.
