navamara55/callcenter-agent
AI Call Center Assistant π
Multi-Agent AI System for Call Center Audio Analysis with Automated Transcription, Summarization, Sentiment Analysis, and Quality Scoring.
  
π [Live Demo](https://huggingface.co/spaces/navamara55/callcenter-agent) - Try it on Hugging Face Spaces!
π Features
- ποΈ Audio Transcription: Automatic speech-to-text using OpenAI Whisper API with intelligent caching
- π Call Summarization: Concise, structured summaries with key points and resolutions
- π Sentiment Analysis: Customer and agent sentiment tracking with emotional journey mapping
- π Quality Scoring: Comprehensive evaluation on 5 criteria (greeting, empathy, resolution, professionalism, adherence)
- β Action Item Extraction: Automatic identification of follow-ups, commitments, and tasks
- π₯ Role-Based Views: Specialized dashboards for Agents, Managers, and QA Teams
- π Interactive Visualizations: Radar charts, sentiment timelines, and exportable action items
- οΏ½ PDF Export: Professional reports with text and visual charts for stakeholder distribution
- οΏ½π Conversation Memory: Context-aware interactions using LangGraph checkpointing
- β‘ Smart Routing: GPT-4o-mini powered query classification and agent routing
- π‘οΈ Production Guardrails: Rate limiting, cost control, circuit breaker, and metrics tracking
πΈ Screenshots
Home View
Agent View
Manager View
Quality Score Dashboard
Call Summary
Topic Tags
ποΈ Architecture
Multi-Agent System with Guardrails
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β User Query β
βββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββ
β
βββββββββΌβββββββββ
β Query Router β (GPT-4o-mini)
βββββββββ¬βββββββββ
β
βββββββββββββββΌββββββββββββββ
β β β
ββββββΌββββ ββββββΌβββββ βββββΌββββββ
β Call β β Trans- β β Summar- β
β Intake β β criptionβ β ization β
ββββββββββ ββββββ¬βββββ βββββββββββ
β
ββββββββββΌβββββββββ
ββββββΌβββββ ββββββΌβββββββββ
β Quality β β Sentiment β
β Scoring β β Analysis β
βββββββββββ βββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π‘οΈ Guardrail Layer (All API Calls)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Rate Limiting β Cost Tracking β Circuit Breaker β Metrics
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ5 Specialized Agents
- Call Intake Agent: Initial query handling and system guidance
- Transcription Agent: Audio β text with speaker labeling (Whisper + GPT-4o-mini)
- Summarization Agent: Structured call summaries with key insights
- Quality Scoring Agent: 1-10 scoring on 5 criteria with justifications
- Sentiment Analysis Agent: Emotion tracking + action item extraction
π Quick Start
Prerequisites
- Python 3.10 or higher
- OpenAI API key
- (Optional) Hugging Face token for datasets
Installation
- Clone the repository
git clone https://github.com/yourusername/ai-callcenter-assistant.git
cd ai-callcenter-assistant- Install uv (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | shOr on macOS/Linux:
brew install uv- Install dependencies with uv (recommended)
uv syncOr using pip:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt- Set up environment variables
cp .env.example .envEdit .env and add your API keys:
OPENAI_API_KEY=sk-your-openai-api-key-here
HF_TOKEN=hf_your-huggingface-token-here # Optional- Run the application
With UV (recommended):
uv run python -m streamlit run app.py --server.port 8501Or using pip/venv:
source venv/bin/activate
streamlit run app.pyThe app will open in your browser at http://localhost:8501
π‘ Tip: See docs/UV_COMMANDS.md for all available UV commands
π Usage
Upload and Analyze Calls
- Upload Audio: Click "Upload Call Recording" in the sidebar
- Supported formats: MP3, WAV, M4A, OGG
- Max size: 25MB
- Transcribe: Click "ποΈ Transcribe Audio"
- First transcription uses Whisper API
- Subsequent transcriptions of the same file use cache
- Analyze: Choose from three views:
π€ Agent View
- Generate call summaries
- View action items
- Quick insights for call handlers
π Manager View
- Quality score radar charts
- Performance metrics
- Strengths and improvement areas
π QA View
- Detailed quality evaluation
- Sentiment analysis
- Action item tracking with CSV export
Example Queries
- "Transcribe this audio file"
- "Summarize this call"
- "What was the customer sentiment?"
- "Evaluate the quality of this conversation"
- "What action items were mentioned?"
π§ͺ Testing
Run Tests
With UV (recommended):
# Run all tests
uv run pytest tests/ -v
# Run with coverage
uv run pytest tests/ --cov=src/ai_callcenter_assistant --cov-report=html
# Using test runner script
./run_tests_uv.sh allTraditional method:
pytest tests/ -vTest Coverage
- 125+ test methods across 27+ test classes
- 2,500+ lines of test code
- 87.5%+ passing rate (112/128 tests)
- Coverage: Agents (100%), Orchestration (95%+), Router (95%+)
See docs/testing/TESTING.md for detailed testing guide and docs/UV_COMMANDS.md for all UV test commands.
π Evaluation
The system uses BLEU scores to evaluate summarization quality.
Run Evaluation
uv run evaluate-systemEvaluation Metrics
- BLEU Score: Measures summary quality against references
- Quality Score MAE: Mean absolute error for quality predictions
- Action Item F1: Precision and recall for action item extraction
Creating Ground Truth
- Prepare reference summaries in
data/evaluation/ground_truth.json - Run system on test calls
- Compare outputs using the evaluator
from ai_callcenter_assistant.utils.evaluator import get_system_evaluator
evaluator = get_system_evaluator()
results = evaluator.evaluate_summaries(generated, references)
print(f"Mean BLEU: {results['mean_bleu']:.4f}")π§© Project Structure
ai-callcenter-assistant/
βββ app.py # Streamlit application
βββ pyproject.toml # Dependencies & config
βββ requirements.txt # Pinned dependencies
βββ Dockerfile # Container definition
βββ .env.example # Environment template
β
βββ src/
β βββ ai_callcenter_assistant/
β βββ config.py # Configuration & prompts
β βββ graph.py # LangGraph workflow
β βββ router.py # Query routing
β β
β βββ agents/ # 5 specialized agents
β β βββ call_intake.py
β β βββ transcription.py
β β βββ summarization.py
β β βββ quality_scoring.py
β β βββ sentiment_analysis.py
β β
β βββ tools/ # Core tools
β β βββ whisper_transcriber.py
β β
β βββ utils/ # Utilities
β β βββ evaluator.py
β β
β βββ scripts/ # CLI scripts
β βββ download_audio_datasets.py
β βββ evaluate_system.py
β
βββ tests/ # Unit tests
β βββ test_router.py
β βββ test_agents.py
β βββ test_whisper.py
β
βββ data/
β βββ audio_files/ # Uploaded audio
β βββ transcripts/ # Cached transcripts
β βββ evaluation/ # Evaluation data
β
βββ .github/
βββ workflows/
βββ deploy.yml # HF Spaces deploymentπ§ͺ Testing
Run All Tests
uv run pytestRun with Coverage
uv run pytest --cov=src/ai_callcenter_assistant --cov-report=htmlRun Specific Tests
pytest tests/test_router.py
pytest tests/test_agents.py
pytest tests/test_whisper.pyπ³ Docker
Build Image
docker build -t ai-callcenter-assistant .Run Container
docker run -p 8501:8501 \
-e OPENAI_API_KEY=your-key-here \
ai-callcenter-assistantUsing Docker Compose
docker-compose upπ Deployment
Hugging Face Spaces
- Create a new Space on Hugging Face
- Choose "Streamlit" as SDK
- Name it
ai-callcenter-assistant
- Add Secrets in Space settings
OPENAI_API_KEY: Your OpenAI API key
- Configure GitHub Actions
- Add
HF_TOKENto repository secrets - Update
.github/workflows/deploy.ymlwith your HF username
- Push to trigger deployment
git push origin mainManual Deployment
# Add Hugging Face remote
git remote add hf https://huggingface.co/spaces/YOUR_USERNAME/ai-callcenter-assistant
# Push to HF Spaces
git push hf mainβοΈ Configuration
Model Settings
Edit config.py or set environment variables:
OPENAI_MODEL_ROUTER = "gpt-4o-mini" # Router model
OPENAI_MODEL_AGENT = "gpt-4o-mini" # Agent model
WHISPER_MODEL = "whisper-1" # Transcription model
ROUTER_TEMPERATURE = 0.0 # Deterministic routing
AGENT_TEMPERATURE = 0.3 # Creative responsesπ‘οΈ Production Guardrails
The system includes comprehensive production guardrails for cost control and reliability:
Rate Limiting:
RATE_LIMIT_RPM=60 # Requests per minute
RATE_LIMIT_TPM=90000 # Tokens per minute
MAX_TOKENS_PER_REQUEST=2000 # Max tokens per requestCost Control:
MAX_COST_PER_SESSION=1.00 # Maximum USD per sessionReliability:
MAX_RETRIES=3 # Retry attempts on failure
RETRY_BACKOFF_FACTOR=2.0 # Exponential backoff multiplier
REQUEST_TIMEOUT=30 # Request timeout (seconds)
CIRCUIT_BREAKER_THRESHOLD=5 # Failures before circuit opens
CIRCUIT_BREAKER_TIMEOUT=60 # Circuit reset timeout (seconds)Features:
- β Token bucket rate limiting (thread-safe)
- β Automatic cost tracking and budget enforcement
- β Circuit breaker for cascading failure prevention
- β Exponential backoff retry logic
- β Real-time metrics and monitoring
- β UI dashboard with budget usage display
See docs/architecture/guardrails.md for complete documentation.
SSL/TLS Configuration (macOS/uv)
Note: This project disables SSL verification as a workaround for certificate issues with uv-managed Python on macOS. The configuration is in config.py.
For production deployments:
- Use system Python or Docker (where SSL works correctly)
- Or configure proper SSL certificates for your environment
Audio Limits
MAX_AUDIO_SIZE_MB = 25 # Max upload size
MAX_AUDIO_DURATION_SECONDS = 600 # 10 minutesQuality Criteria
QUALITY_CRITERIA = [
"greeting",
"empathy",
"problem_resolution",
"professionalism",
"script_adherence"
]π° Cost Optimization
Caching Strategy
- Whisper transcriptions: Permanent cache using file hash (no re-transcription)
- Agent responses: Session-based cache with configurable TTL
- LangGraph memory: Efficient conversation context management
Model Selection
- Router: GPT-4o-mini ($0.15/$0.60 per 1M tokens) for classification
- Agents: GPT-4o-mini for all analysis tasks
- Whisper: $0.006/minute with aggressive caching
Estimated Costs (per call)
- Transcription (5 min): ~$0.03 (cached after first use)
- Routing: ~$0.0001
- Analysis (all agents): ~$0.01-0.02
- Total: ~$0.04 per call (first analysis), ~$0.01 (cached transcript)
π§ Development
Setup Development Environment
# Install with dev dependencies
uv sync --all-extras
# Install pre-commit hooks (if using)
uv run pre-commit installCode Formatting
uv run black src/ tests/
uv run ruff check src/ tests/ --fixAdding New Agents
- Create agent file in
src/ai_callcenter_assistant/agents/ - Follow existing agent pattern (inherit system prompt, process method)
- Register in
graph.py - Update router with new agent name
- Add tests in
tests/
π Performance
- Transcription: ~2-5 seconds per minute of audio (Whisper API)
- Analysis: ~3-10 seconds per query (GPT-4o-mini)
- Routing: <1 second (GPT-4o-mini)
- Total: ~10-20 seconds for full analysis of 5-minute call
π€ Contributing
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π Acknowledgments
- OpenAI for GPT-4o-mini and Whisper API
- LangChain and LangGraph for agent orchestration
- Streamlit for the web interface
- Hugging Face for hosting and datasets
π§ Contact
For questions, issues, or feedback:
- Create an Issue
- Email: your.email@example.com
πΊοΈ Roadmap
- [ ] Real-time audio streaming support
- [ ] Speaker diarization with pyannote-audio
- [ ] Multi-language support
- [ ] Custom quality scoring rubrics
- [ ] Batch processing API
- [ ] Analytics dashboard
- [ ] Integration with CRM systems
Built with β€οΈ using GPT-4o-mini, OpenAI Whisper, LangGraph, and Streamlit
