This project is an AI-powered support ticket agent built with LangGraph, Azure OpenAI, and FAISS + Hugging Face Transformers for context-aware ticket resolution. It classifies, drafts, reviews, and escalates support tickets through a multi-step reasoning loop using LangGraph’s dynamic state machine.
- Ticket Classification: Categorizes incoming support tickets using an LLM.
- Context Retrieval: Uses FAISS + Hugging Face embeddings to retrieve relevant support knowledge.
- LLM Drafting: Automatically drafts a response using Azure OpenAI based on category and context.
- Review & Feedback Loop: Simulates a quality reviewer that can approve or reject drafts with feedback.
- Escalation Path: If a draft is rejected more than twice, the ticket is escalated and logged.
.
├── main.py # Graph definition and execution
├── nodes/
│ ├── classify_node.py # Classifies ticket category
│ ├── retrieve_node.py # Retrieves relevant context using FAISS
│ ├── draft_node.py # Drafts response using LLM
│ ├── review_node.py # Simulates LLM review of draft
│ └── escalate_node.py # Escalates and logs tickets after 2 failed reviews
├── utils/
│ └── rag_utils.py # FAISS setup with HuggingFace embeddings
├── .env # Azure OpenAI credentials
├── escalation_log.csv # Log of escalated tickets
└── README.md
- 🧩 LangGraph: To model the reasoning flow between nodes.
- 🤖 Azure OpenAI: For classification, drafting, and review.
- 🔍 FAISS + Hugging Face: For semantic search using
all-MiniLM-L6-v2. - 🧪 LangChain: For LLM chaining and prompt management.
-
Clone this repo:
git clone https://github.com/your-org/support-ticket-agent.git cd support-ticket-agent -
Create and activate Python 3.10 virtual environment:
py -3.10 -m venv venv venv\Scripts\activate # Windows
-
Install dependencies:
pip install -r requirements.txt
-
Add your
.envfile:OPENAI_API_KEY= OPENAI_API_BASE= OPENAI_API_VERSION= OPENAI_API_TYPE= OPENAI_DEPLOYMENT_NAME= -
Run the app:
python main.py
ticket = {
"subject": "Charged twice for subscription",
"description": "I was billed twice this month for the same plan."
}Depending on review outcomes, the agent will loop through retrieve → draft → review. If rejected twice, it logs the issue via escalate_node.
- FAISS is initialized once in
rag_utils.pyusing Hugging Face sentence transformers. - You can expand the knowledge base by editing the
docs_by_categorydictionary. - Escalated tickets are saved to
escalation_log.csv.