How sumaylen/ai-support-ticket-agent works
This is a work-in-progress AI support-ticket agent. A ticket enters the LangGraph workflow, passes prompt-injection checks and classification, may trigger order/account lookups, retrieves policy context, and receives a fact-checked draft or escalation. The graph also preserves the policy knowledge base, database-backed lookup tools, logging, and evaluation capabilities. Source excerpts show several direct calls; README workflow documentation supports the broader stages. The policy-ingestion relationship and unsampled workflow details are not fully visible, so those links are omitted or marked unverified.
Main entry points: graph.py Ticket orchestration · retrieval.py Policy retrieval · llm_client.py LLM backend · respond.py Draft and verify
Components 17
Ticket workflow
- Ticket orchestration
src/graph.py - Prompt guards
src/guardrails.py - Category and urgency
src/classify.py - Lookup agent
src/agent.py - Draft and verify
src/respond.py - Escalation decision
src/escalation.py
Knowledge and data
- Policy retrieval
src/retrieval.py - Support policies
data/policies - Knowledge-base builder
build_knowledge_base.py - Order and account tools
src/tools.py - Company database
data/company.db
Model services
- LLM backend
src/llm_client.py - Training dataset split
src/dataset.py
Safety and evaluation
- JSON event logs
src/JSON_logger.py - Retrieval evaluation
src/evaluate_retrieval.py - Verifier evaluation
src/evaluate_verifier.py
Other components
- Customer
Connections 23
- Customer → Ticket orchestration: submits ticket
README.md - Ticket orchestration → Prompt guards: checks input
src/graph.py - Ticket orchestration → Category and urgency: classifies ticket
src/graph.py - Ticket orchestration → Lookup agent: dispatches lookup
src/graph.py - Ticket orchestration → Policy retrieval: retrieves context
src/graph.py - Ticket orchestration → Draft and verify: creates draft
src/graph.py - Ticket orchestration → Escalation decision: checks escalation
src/graph.py - Ticket orchestration → JSON event logs: records outcome
src/graph.py - Prompt guards → LLM backend: checks message
src/guardrails.py - Prompt guards → JSON event logs: logs flags
src/guardrails.py - Category and urgency → LLM backend: classifies
src/classify.py - Category and urgency → Training dataset split: loads categories
src/classify.py - Lookup agent → LLM backend: requests tool calls
src/agent.py - Lookup agent → Order and account tools: dispatches tools
src/agent.py - Order and account tools → Company database: queries
src/tools.py - Draft and verify → LLM backend: drafts and verifies
src/respond.py - Draft and verify → JSON event logs: logs failures
src/respond.py - Policy retrieval → LLM backend: queries policy store
src/retrieval.py - Retrieval evaluation → Policy retrieval: evaluates results
src/evaluate_retrieval.py - Verifier evaluation → Policy retrieval: uses retrieved context
src/evaluate_verifier.py - Verifier evaluation → Draft and verify: evaluates verification
src/evaluate_verifier.py - Support policies → Knowledge-base builder: supplies policy text
- Knowledge-base builder → Policy retrieval: populates index
build_knowledge_base.py