How to Design a Customer-Support Chatbot
How to design a support chatbot that answers from help articles, checks every action in code and hands hard cases to a person, for your AI interview.
In short
A customer-support chatbot answers from our help articles and the customer's own order, checks each action in code, and hands hard cases to a person. It is judged on whether the customer's problem is solved and stays solved.
13 min readIntermediateVery common · estimateFacts checked 26 November 2026
Say it out loud
Read it once, then say it without looking. Start with the short one; use the long one when they ask you to go deeper.
A customer-support chatbot answers from our help articles and the customer's own order. It can only look up what it is allowed to see, and code, not the model, decides every action, like a refund. Anything risky, angry or outside policy goes to a person, with a short summary. I judge it on real past chats: a problem solved without a person, and not coming back.
Start with the job. A support chatbot takes the common questions, like where a parcel is or how returns work, and answers them from our own help articles and the customer's own order. Anthropic's guide to building agents says support interactions naturally follow a conversation flow while they need outside facts and actions.
The design has four parts. A front door checks the message and sorts the topic. Answer sources hold the facts: articles found by search, and an order system the bot can only read, for the logged-in customer only. The model writes the reply from what those sources return. Last, a reply check stops promises the policy does not allow.
The hard part is knowing when to stop. An angry customer, a refund over the limit or a legal word goes to a person, with a summary so nobody repeats themselves. When the articles do not answer the question, the bot says so instead of guessing. The model asks for an action, and code checks the owner and the limit before any money moves.
I measure it on a test set of past real chats. Success means the problem is solved without a person and not reopened within a week. I also track wrong answers found in audits, the handoff rate and the cost per solved chat, because agents cost more and can make errors that build on each other.
What is a customer-support chatbot, in plain words?
It is an AI chat on a company's help pages. It answers the common questions from the company's own help articles, looks up the customer's own order, and passes the hard cases to a person.
Anthropic's guide to building agents says support interactions naturally follow a conversation flow. They also need outside facts and actions to finish the job.
Think of a bank's phone line. The front-line adviser handles the usual questions with a script and a screen that shows the account. A complaint goes to a senior colleague with the notes. A support bot works the same way. A bank's chat bot can read a customer's own account and quote the fee table, but a fee waiver goes to an adviser, with the chat log attached.
Key words
- Retrieval (RAG)
- Searching your own documents first, then giving the matching text to the model.
- Tool
- A function the model can ask your code to run, like looking up an order.
- Handoff
- Passing the chat to a person, with a short summary, so the customer does not repeat themselves.
- Guardrail
- A check in code that stops a bad input or a bad reply.
- Resolution
- The customer's problem is solved without a person, and stays solved.
How does one message travel through the bot?
Every message takes the same path. Anthropic's guide describes this as routing: a step that classifies each input and sends it to a specialised follow-up task.
How one customer message travels
Customer message
a question typed in the chat
Front door
Input check
blocks abuse and hidden instructions
Router
sorts the topic and the customer
Answer sources
Help articles
search first, then quote from them
Order system
read only, own orders only
Model and check
Model writes reply
uses only what the tools return
Reply check
no promises the policy forbids
Reply sent
the chat stays open for more
Hand to a person
with a short summary
- 1The customer's message arrives and is checked first.
- 2If it passes the check, the router sorts the question.
- 3A policy question goes to the help articles.
- 4An order question goes to the order system.
- 5The articles found become the facts the model may use.
- 6The order details found come back the same way.
- 7The draft reply is checked before the customer sees it.
- 8A clean reply goes out, and the chat stays open.
- 9Anything risky or outside policy goes to a person.
Take a shopper who writes: "Where is my parcel? It says delivered." Here is what the bot does, step by step. The numbers and the policy are made up for this example.
- 1
Front door
The input check finds nothing odd, and the router marks it as an order question.
- 2
Order system
The bot reads this customer's own order. The carrier scan says delivered, and the tool refuses any order that is not this customer's.
- 3
Help articles
The article on lost parcels says a refund waits for a carrier trace, which takes about 7 working days.
- 4
Reply
The bot offers to start a trace now. It says it cannot refund yet, and it promises no money.
- 5
Handoff
If the customer then says they want a lawyer, the chat goes to a person, with the order and the trace attached.
How does it answer from help articles without making things up?
Help articles are too long to paste into every chat, so the bot searches first. Anthropic's research on retrieval cuts the knowledge base into smaller pieces, called chunks, usually no more than a few hundred tokens. A token is a small piece of text, a word or part of one.
Meaning-based search finds the right article for a question about returns. It can still miss exact matches, like an order number or an error code. Keyword search, called BM25, finds precise word matches, so a good bot often keeps it alongside meaning-based search. Anthropic's research says meaning-based search can miss exact matches.
- Without rules
The bot guesses
It writes a plausible return window, and the customer buys on a promise the policy never made.
- With rules
The bot quotes or stops
It quotes the article it found, or says it does not know and offers a person.
Anthropic's guide on reducing hallucinations says that giving the model permission to admit uncertainty can drastically reduce false information. For long documents, over 20k tokens, asking it first to extract word-for-word quotes also grounds the reply in the real text.
Tip
Asked how the bot avoids guessing? Say it answers only from what the search returned, quotes the article, and says so when nothing matches. Never let it invent a return window.
Which actions can the bot take, and who checks them?
Tools let the bot do things: look up an order, start a return, issue a refund. The model only asks for a tool to run. Your code runs it, so your code is where the checks go.
“Route privileged calls through a deterministic policy engine that re-validates intent and arguments at execution time.”
OWASP, 2026 list
“Require explicit human confirmation before any privileged, irreversible, or externally visible action”
OWASP, 2026 list
OWASP asks for a person on every privileged action. Our $50 solo limit is a risk choice the support team makes and reviews, not a rule OWASP sets.
Give each tool the least access it needs. A reader for order status cannot refund anything. The refund tool takes an order ID and an amount, and code will not pay any amount over the limit, and that case goes to a person. The limit in this example is a made-up $50 for the bot alone.
- Model decides
Model picks the amount
It chooses the order and the sum, and the code runs whatever it asks for.
- Code decides
Code checks, a person signs
Code checks the order owner and the limit, and a person approves anything above it.
Keep approvals for the few big cases, or people stop reading. OWASP warns that approval fatigue degrades reviewer judgment at volume.
Here is the same idea in plain Python. The model asked for three refunds, and code decides each one.
# A refund gate: the model asks, the code decides.
REFUND_LIMIT = 50 # dollars the bot may refund alone
def decide_refund(order_owner, asking_customer, amount):
# The order must belong to the logged-in customer. Checked in code, not in the prompt.
if order_owner != asking_customer:
return "BLOCKED: order belongs to another customer"
# Anything above the limit waits for a person to approve it.
if amount > REFUND_LIMIT:
return "HANDOFF: $" + str(amount) + " is over the $" + str(REFUND_LIMIT) + " limit"
return "REFUND: $" + str(amount) + " issued"
# The model asked for three refunds. Code decides each one.
print(decide_refund("cust_1047", "cust_1047", 20))
print(decide_refund("cust_1047", "cust_1047", 180))
print(decide_refund("cust_2210", "cust_1047", 20))Output
REFUND: $20 issued HANDOFF: $180 is over the $50 limit BLOCKED: order belongs to another customer
Who decides what on a refund
Model asks
it can only ask, never pay
Code checks
Owns the order?
must be this customer's order
Under the limit?
bot alone up to a set amount
Person approves
only above the limit
Refund issued
under the limit, this customer only
Refund blocked
not this customer's order
- 1The model asks for a refund and names an order.
- 2Once the order is confirmed as this customer's, code checks the amount.
- 3Another customer's order is blocked outright.
- 4A refund under the limit goes through.
- 5A refund above the limit waits for a person to approve it.
How do you know it works?
“Building a successful LLM-based application starts with clearly defining your success criteria and then designing evaluations to measure performance against them.”
Anthropic, success criteria
Define success first. For this bot, success is a problem solved without a person and not reopened within a week. The target is a made-up one, set with the support team.
Build a test set from past real chats, with the right answer or the right article for each one. A person scores a sample of replies, and a second AI model marks the rest against that right answer. Rerun the set after every prompt change, so a new prompt cannot quietly break the refund path.
Tip
Watch four numbers each week: solved without a person, wrong answers found in audit, handoff rate and cost per solved chat. A fall in solved chats, or a rise in wrong answers, is a warning sign to investigate.
How would you handle a refund that is over the limit?
A customer says a blender arrived cracked and asks for $180. The bot's limit is $50, so it cannot say yes. Splitting it into smaller refunds does not help, because the limit must count the total refunded on one order. The code shown checks one call at a time, so a real system must also keep that running total.
- 1
Check the owner
The order is this customer's, so the lookup goes ahead.
- 2
Hit the limit
Code sees that $180 is over the limit, so the refund does not run.
- 3
Hand over with a summary
The chat goes to a person with the order, the photos, the policy article and the customer's own words.
- 4
Keep the customer informed
The bot says a person will decide and shows the usual wait for the queue. It promises no refund.
Interviewers listen for the boundary. The model decides what to say, code decides what can happen, and a person decides the big cases.
What does the interviewer want to hear?
A strong answer covers
- Scope: a bot that answers from help articles and order data, and hands off hard cases.
- Grounding: search first, quote the source, and say I don't know instead of guessing.
- Actions: the model asks, code checks the owner and the limit, and a person approves big ones.
- Handoff: clear triggers, with a short summary so the customer does not repeat themselves.
- Measurement: real past chats, with success defined as solved and not reopened.
- Limits said honestly: some chats still need a person, and long chats cost more.
Common traps
Trap"The model should check the refund limit itself."
BetterNever. A model can be talked out of a rule. Code checks the limit and the order owner.
Trap"One big prompt covers the whole bot."
BetterPrompts help, but routing, tools and checks in code do the real work.
Trap"A bot can answer everything, so no handoff is needed."
BetterPlan the handoff from day one, with triggers, a summary and a person on shift.
Can you spot the risk?
Spot the risk
The bot searched help articles and an order note. Which snippet is a risk?
Quick check
The bot may refund $50 alone. A customer asks for $400 on a damaged bike. What should happen?
Can you answer these from memory?
Flash cards · tap a card to flip it
What will they ask next?
- Q348Design company document Q&A.13 min
- Q350Design semantic search.Coming soon
- Q351Design a content-moderation pipeline.Coming soon
- Q201What is prompt injection?12 min
- Q209How do you build defence in depth against injection?13 min
- Q202Direct vs indirect prompt injection?10 min
Learn it in depth
Last updated on 26 November 2026
Building a support bot for your customers?
I design and build AI products and agents, the screen and the system behind them. Book a short call and tell me what your bot must do, and what it must never do.