Support Ticket Router · AI Recommendation with Human Gate
SupportFlow Mini
Production System
A customer support ticket router with AI recommendation, human review gate, and webhook delivery. Built end-to-end with FastAPI, Pydantic, SQLite, OpenAI, and deterministic evaluation. One problem, one model call, one human decision, one safe integration.
Status: In Progress
A production-grade support ticket routing system. Handles ticket ingestion, AI-powered categorization and priority assignment, human review and approval workflow, webhook delivery to external systems, and quality evaluation across a held-out test set.
The problem
Manual support ticket triage is slow and inconsistent. Tickets arrive with a subject and description. A human reviewer reads each one and routes it to the right team, but:
- •Categorization varies between reviewers (billing vs. account, technical vs. feature request)
- •Priority assignments are subjective and slow
- •Urgent tickets can get buried if a reviewer is slow
- •Misroutings waste time and hurt customer experience
How it works
SupportFlow Mini routes each ticket through a simple, auditable workflow: submit the ticket, get an AI recommendation, let a human decide, deliver the routing to the team, measure accuracy.
Architecture
FastAPI backend with Pydantic validation, SQLite for ticket and event storage, mock-first workflow logic, browser-based review interface, OpenAI for AI recommendation, and webhook integration for delivery. Deterministic evaluation harness measures model accuracy.
Why mock first
Building with mock data first isolates the workflow, routing logic, database behavior, review state and UI integration from model uncertainty. You prove the core works before adding AI.
Chapter 4 walks through deterministic triage with keyword-matching rules. Once forms, storage, and review all work correctly, Chapter 6 swaps in the real model call. Same data schema, same API contract, same webhook flow.
Implementation approach
Deterministic Testing
Mock the model to prove workflow logic. Same seed produces same recommendations, same review UI renders correctly, same webhook fires.
Typed Contracts
Pydantic enforces field types and presence. Invalid requests are rejected before business logic runs. Model outputs are always schema-valid.
One Problem, One Model Call
Ticket routing has exactly one decision: where should this go and how urgent is it? One model call, one confidence score, one human gate.
Human Gate Separates Review from Decision
Reviewer decision is stored separately from AI recommendation. You can compute agreement, measure confidence calibration, and maintain an audit trail.
Workflow First, Model Second
Build the full end-to-end flow with mock data. Prove forms, storage, review, and webhooks work. Then add the model call — same integration points, same data schema.
Production Practices from Day One
Dependency injection, environment config, secret boundaries, error handling, audit logs. No refactoring required when you ship.
Stack
System capabilities
✓Ticket ingestion: Accept customer support tickets via REST API with full validation. Store in SQLite with complete audit trail.
✓AI categorization: Recommend ticket category (billing, technical, account, feature request, other) and priority (low, medium, high, urgent) with confidence score.
✓Human review workflow: Web interface for reviewers to see recommendation, approve, correct, or reassign. Separate human decision from AI recommendation for audit trail.
✓Webhook delivery: Send approved routing to external systems via HTTP with idempotency, retry logic, and error handling.
✓Quality evaluation: Measure model accuracy against held-out test set. Track agreement with human reviewers and confidence calibration.
✓Deterministic testing: Mock workflow without AI to prove forms, storage, review, and delivery work before adding the model.
✓Production foundation: Pydantic validation, dependency injection, environment config, secret boundaries, and comprehensive error handling.
View the implementation
Complete, production-ready system from API through evaluation. Covers ticket ingestion, AI recommendation, human review workflow, webhook delivery, and quality measurement.