Add AI Classification to a Deterministic Flow
Classify fictional tickets with a Basic LLM Chain and route only after structural validation.
Today's Goals
- Assign judgment to the model and validation/actions to the workflow.
- Define output fields and low-confidence escalation.
- Route model or parser failures to human review.
n8n can connect an AI model into a workflow, but adding an agent node is not a substitute for defining the task. For this bounded classifier, a simple language-model chain is easier to inspect than an agent with tools and memory. The model proposes a label; deterministic nodes decide whether the proposal is valid and where it goes.
Plain-Language Walkthrough
Give the model a narrow job
Feed the normalized ticket text and ID from D3 to a Basic LLM Chain connected to an approved chat model. The Basic LLM Chain documentation describes the current node and its optional output parser. The prompt asks for one of the fixed categories, urgency, an exact evidence quote, and a human-review reason when needed. It must not ask the model to send email or update a customer record. A chain has no need to decide which API credential to use.
A Structured Output Parser can constrain the format; see its official node reference. Check the settings in your installed version and the way sub-nodes receive data. A parser failure should become a visible review item, not an empty result that quietly falls into the normal branch. The parser checks structure, not whether a quote appears in the original ticket. Add a deterministic check for the exact quote or send paraphrases to a person.
Avoid presenting a model's self-reported confidence as a calibrated probability. Use an explicit “review required” rule for mixed issues, policy conflicts, missing attachments, or unsupported evidence. If the model produces an unknown category, reject it. If the model is unavailable, the workflow should route the ticket to manual review with the source ID and error class. The business operation continues in a slower but accountable path.
Interview questions
Why should classification not send email directly?为什么分类模型不该直接发送邮件?
Common in ChinaCommon overseasBasic#ai-boundary#approval🔒 Unlock this chapter to see the answer keys.
What must be checked after parsing?解析通过后还要查什么?
Common in ChinaCommon overseasIntermediate#parser#semantic-validation🔒 Unlock this chapter to see the answer keys.
How do you handle uncertainty?如何处理不确定结果?
Common in ChinaCommon overseasIntermediate#degradation#human-review🔒 Unlock this chapter to see the answer keys.
