Every support ticket in the AI Ticket Support System travels through a defined pipeline: from a raw user description to a fully classified, context-enriched response — either automatically resolved by the AI or queued for a human agent. Understanding this lifecycle helps you configure thresholds, monitor ticket health, and integrate with the system’s REST API.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/yocxy2/2a/llms.txt
Use this file to discover all available pages before exploring further.
Ticket states
A ticket exists in one of three mutually exclusive states at any point in time. State transitions are driven by the AI confidence score on creation and by agent actions afterward.| Status | Meaning | Next Actions |
|---|---|---|
pending_agent | AI confidence score is below 0.7 — human review is required | Agent reviews, responds, and closes; or re-routes |
ai_resolved | AI confidence score is 0.7 or above — the system auto-resolved the ticket | Agent may reopen or reassign; otherwise left resolved |
closed | Ticket has been manually closed by an agent | Terminal state; no further actions expected |
Submission flow
When aPOST /api/v1/tickets request arrives, the controller orchestrates several services before a ticket record is persisted. Each step below maps directly to code in ticketController.ts.
Receive the user description
POST /api/v1/tickets accepts a JSON body with a user_description field. The controller validates that the field is present; missing descriptions return a 400 Bad Request immediately.AI classification
classifyTicket(user_description) calls GPT-4o-mini and returns the ticket category, a suggested support response, and a confidence score between 0.0 and 1.0.Hybrid RAG search
searchKnowledgeBase(user_description) generates a 1536-dimension embedding for the query and runs a hybrid pgvector search against the knowledge base, blending vector similarity with recency decay and article importance weights.GraphRAG entity context
getGraphContextForTicket(user_description) finds entities similar to the ticket text in the knowledge graph, then traverses the graph via BFS (depth=2, max 10 nodes) to collect a set of relevantEntities.Response enhancement
The raw AI response is enriched with the top knowledge base articles (title + first 100 characters of content) and any related entities discovered by GraphRAG. Both additions are appended to
ai_suggested_response in plaintext.Confidence-based status assignment
The confidence score from step 2 determines the initial ticket status. Scores of 0.7 or above are considered reliable enough for automatic resolution.
Persist to PostgreSQL
The fully assembled ticket record is written to the
tickets table via Prisma. The created_at and updated_at timestamps are set automatically by the database.Async entity extraction
Entity extraction runs after the ticket creation response has already been sent to the client. This means the initial API call remains fast regardless of how long the AI entity extraction takes. The job is processed byentityExtractionWorker, which:
- Calls
extractEntities()to identify named entities (Person, Place, Concept, Product, Organization) in the ticket text via GPT-4o-mini. - For each new entity, generates a 1536-dimension vector embedding and stores the entity in the
entitiesPostgreSQL table. - Creates
related_toedges inentity_relationsbetween every pair of entities found in the same ticket (if the relationship doesn’t already exist).
TypeScript interfaces
The following interfaces fromsrc/models/ticket.ts define the shape of ticket data throughout the system.