Classify and Route
Use an AI step to label incoming messages, then use rules to send each one to the right place.
Objective
By the end of this lesson, you can write a classification prompt with fixed labels and route messages based on the label.
Why classify
Many small organizations have one inbox that gets everything. At a South Side community center, one inbox gets volunteer offers, donation questions, people asking for help, and vendor spam. One staff member reads it all.
Classification puts each message into a label. Then plain rules route it: send it to the right person, sheet, or folder.
The AI does one small job, choosing a label. Rules do the rest.
Fixed labels are the key
Never let the AI make up labels. Give it a short list and require it to answer with exactly one. Always include a safe label like Needs human review for anything unclear.
For the community center:
- Volunteer
- Donation
- Help request
- Vendor or sales
- Needs human review
Build the classifier prompt
Message classifier
Make the AI answer with exactly one label from your list, and nothing else.
Your prompt
Act as a careful intake assistant for a community center. Your task: Read the message and reply with exactly one label from this list: Volunteer, Donation, Help request, Vendor or sales, Needs human review. If the message mentions danger, abuse, self-harm, or a child at risk, always reply Needs human review. If you are not sure, reply Needs human review. Format: One label only. No other words.
Notice the safety rule in the task. Some messages must always reach a person, no matter what the AI thinks. You write that rule in, on purpose.
Route with rules
Once you have a label, routing is plain logic. Try it below.
Route by label
Change the label to each option and run it. Then try a label the AI was not supposed to give, like 'Urgent'. What happens? Keyboard users: press Esc, then Tab, to leave the editor.
The last rule is a fallback: what happens when the label is unexpected. Your fallback should always be "a person looks at it," never "ignore it."
Test before you trust
Before turning on a classifier, test it on 20 practice messages that you labeled yourself. Count how many it got right. Look closely at the wrong ones.
- If it puts help requests in Vendor, that is a serious failure. Someone in need gets no reply.
- If it puts vendors in Needs human review, that is a small cost. A person spends five seconds.
Errors are not equal. Design so the AI's mistakes land on the safe side.