A support assistant that validates every inbound message, identifies the customer, retrieves grounded answers from a vector knowledge base, and routes on confidence — auto-resolving what it's sure of, and escalating everything else with full context.
Support teams answer the same questions on repeat while complex cases sit in a queue. Leadership has no daily visibility into volume, resolution rate, or sentiment without someone manually pulling numbers. And a single unhandled error — a bad payload, an API timeout — can silently drop a customer conversation with no trace.
Three connected pieces. First, the assistant itself: validate input → identify or create the customer record → classify intent, urgency, sentiment, and confidence → retrieve relevant knowledge base content via vector similarity → generate a grounded response → route on a confidence threshold. Second, the escalation path: below that threshold, the system creates a support ticket, notifies the team in Slack and email, and hands the human agent an AI-written summary instead of a blank conversation. Third, observability: a global error handler attached to every workflow writes a dead-letter audit record and alerts support ops on any failure, and a 7am scheduled workflow computes yesterday's resolution rate, escalation rate, sentiment, and response time — then emails leadership a written summary automatically.
flowchart TD
A[Website Chat Trigger] --> B[Normalize Input]
B --> C[Validate and Sanitize]
C --> D{Is Valid?}
D -->|No| E[Send Validation Message / Log Invalid Event]
D -->|Yes| F[Identify or Create Customer
Postgres upsert]
F --> G[Intent Analysis
OpenAI Agent, structured output]
G --> H[Knowledge Search
PGVector similarity]
H --> I[Aggregate Knowledge Context]
I --> J[Generate Response
Grounded OpenAI Agent]
J --> K{Confidence over 90%?}
K -->|Yes| L[Prepare Auto Resolution]
K -->|No| M[Create Support Ticket]
M --> N[Notify Support: Slack + Email]
N --> O[Prepare Escalation]
L --> P[Merge Resolution]
O --> P
P --> Q[Send Reply to Customer]
Q --> R[Update CRM]
R --> S[Store Conversation]
S -.feeds.-> T[Daily Executive Report
7am scheduled]
alwaysOutputData on the analytics query, so the daily report runs — with honest zeros — on a quiet day instead of crashingFigures are evidence-based expectations for this architecture — happy to run this against your real ticket volume and report live numbers.