Fade0510/CallCenterSummarizationAgent
0
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 the
TranscriptionAgent. - If Text (`.csv`): Routes to the
ModerationAgentthen 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.
- `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.
- `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.
- `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
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.txtRunning 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.py- Open 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:
