# Workflow — AI Customer Support Agent

## 1. 1. Normalize the ticket

Receive the helpdesk webhook, strip quoted history and signatures, and build the canonical ticket object. Attach known customer reference if present.

## 2. 2. Classify cheaply

Run the low-cost model to label intent, sentiment, urgency, and language, and produce an initial confidence. Short-circuit obvious spam/auto-replies.

## 3. 3. Ground with retrieval

Issue targeted kb_search queries and the minimal crm_lookup/order_lookup calls the intent requires. Filter to high-relevance context; stop once you have enough.

## 4. 4. Gate sensitive intents

If the intent needs an account action, check verify_identity. If unverified, request verification or escalate before going further.

## 5. 5. Decide under policy

The strong model applies thresholds and escalation triggers and emits the structured decision object with confidence, grounded flag, actions, reply, and tags.

## 6. 6. Execute through the guard

The deterministic executor validates each action (identity, refund cap, PII redaction, approval mode) and runs only what passes; anything invalid is downgraded to ESCALATE.

## 7. 7. Log & learn

Persist the full decision trail and outcome. Route low-confidence, no-source tickets to a knowledge-gap log and feed approvals/edits back as evaluation data.
