title: CallCenterSummarizationAgent
emoji: 🚀
colorFrom: red
colorTo: red
sdk: docker
app_port: 8501
tags:
- streamlit
pinned: false
short_description: Summarize Call Center Conversations
license: mit
args:
- '--server.enableCORS'
- 'false'
- '--server.enableXsrfProtection'
- 'false'
Call Center Data Analysis Agent
This project implements a multi-agent workflow using LangGraph to process, transcribe, summarize, and score call center data. It comes with a Streamlit user interface to easily upload .csv, .json, .mp3, or .wav files and view the resulting insights.
Workflow Flow & Agent Classes
The core analysis logic is driven by a LangGraph StateGraph defined in src/workflow.py. The state moves sequentially between several agent classes located in the src/agents/ directory.
Workflow Architecture
[ IntakeAgent ]
|
v
[ Router (file type) ]
/ | \
(CSV invalid)/ (If Audio) (If Text)
v v v
(END) [ TranscriptionAgent ] |
| |
v |
[ ModerationAgent ] <-----/
|
v
[ SummarizationAgent ]
|
v
[ PostSummarizeRouter (output) ]
| |
(END) [ QualityScoringAgent ]
|
v
(END)
Notes:
- The workflow uses a LangGraph memory checkpointer (
MemorySaver) and fallbacks on critical nodes (summarization/scoring) to avoid UI breakage on transient API/parse errors. - If CSV headers are invalid, the workflow terminates immediately and the UI shows a validation error.
- After summarization, the workflow can short-circuit to
ENDif the transcript is too short or the model output is missing/empty.
Agent Classes
IntakeAgent(src/agents/IntakeAgent.py)- Entry Point.
- Reads the uploaded file, validates the file format and schema, extracts basic metadata, and runs a first-pass clean-up (using an LLM).
- CSV requirement: headers must include
idandtranscript(case-insensitive). - JSON supported shapes: a list of
{id, transcript}objects, a single{id, transcript}object, or a dict withtranscripts/callsarrays containing{id, transcript}objects.
Router(src/agents/Router.py)- Conditional Routing Node.
- Determines the next step based on the file type and intake validation state.
- If Audio (
.mp3,.wav): Routes to theTranscriptionAgent. - If Text (
.csv): Routes to theModerationAgentthen summarization/scoring. - If CSV invalid: Routes to
END(the UI displaysmetadata.intake_error).
PostSummarizeRouter(src/agents/Router.py)- Routes based on model output quality (e.g., short transcript or missing summary can skip scoring).
TranscriptionAgent(src/agents/TranscriptionAgent.py)- Utilizes
openai-whisperto convert audio files into text. - Also scrubs the resulting transcript of profanity before passing it down the pipeline.
- Utilizes
ModerationAgent(src/agents/ModerationAgent.py)- Receives text either directly from the
Router(if text upload) or from theTranscriptionAgent(if audio upload). - Identifies any obscene words or profanity using an LLM and replaces them entirely with a
***mask to safely prepare the text for downstream analysis.
- Receives text either directly from the
SummarizationAgent(src/agents/SummarizationAgent.py)- Takes the redacted text from the
ModerationAgent. - Generates a concise summary, key points, action items, tags, and highlights using OpenAI (
gpt-4o) with Pydantic-structured output.
- Takes the redacted text from the
QualityScoringAgent(src/agents/QualityScoringAgent.py)- Takes the clean text and evaluates it against a predefined rubric.
- Scores the transcript based on Tone, Professionalism, and Structured Resolution using Pydantic structured output (function calling when supported). Automatically applies a 3-point penalty to each score and logs a count of policy violations if the
ModerationAgentdetected and masked any profanity (***).
Prerequisites
- Python 3.9+
- An OpenAI API key
ffmpeginstalled on your system (required foropenai-whisperaudio transcription).- On macOS:
brew install ffmpeg - On Ubuntu/Debian:
sudo apt update && sudo apt install ffmpeg
- On macOS:
Installation
- Create a virtual environment and activate it (if you haven't already):
python3 -m venv .venv source .venv/bin/activate - Install the required dependencies:
pip install -r requirements.txt
Running the Application
Ensure your OpenAI API key is set in your environment variables:
export OPENAI_API_KEY="your_api_key_here"Start the Streamlit application:
streamlit run src/streamlit_app.pyOpen your browser to the local URL provided by Streamlit (usually
http://localhost:8501).Use the sidebar to upload a
.csv,.mp3, or.wavfile and watch the agents analyze your data!
Processed Files
Note: The following sample data can be used for analysis: