When a Claude Support Agent Should Escalate: Three Clear Triggers, Not Mood or a Confidence Score
A support agent hands off when the customer asks for a human, when the policy is silent, or when it is stuck. An angry customer with a simple question gets a sorry and a fix, and two customers called Maya Khan mean one more question, never a guess.
What you will learn
- Name the three escalation triggers: an explicit request for a human, a policy gap, and no progress
- Resolve an upset customer's simple, in-policy issue instead of handing it off
- Explain why sentiment and self-reported confidence are poor escalation triggers
- Ask for an email or order number when a lookup matches more than one customer
Before you start
- Tool input schemas and error responses for Claude
- Writing a system prompt
- Basic Python
Your parcel is late. You write to the shop, and you're not happy: This is ridiculous. Where is my parcel? The support agent has a choice. Hand you to a person, or just help?
A good agent decides by a rule, not by your mood. This article writes those rules into a system prompt and checks them on six cases.
Going by mood gets both cases wrong
Two customers write in.
- The first is angry, but the question is simple: where is my parcel? The agent hands them to a human anyway, for a simple lookup.
- The second is calm, but the request is unusual: match the price a marketplace seller offers. The policy never says the shop does that. The agent promises a match anyway.
The first should have been resolved. The second should have been escalated. An agent that reads the mood swaps them.
Think of a shop assistant and a manager. A customer says manager, please: the assistant calls the manager right away, no questions first. A customer asks the shop to match another shop's price: the rulebook has no page for that, so the assistant calls the manager. A customer sighs, parcel again? They're upset, but the question is easy, so the assistant says sorry and fixes it. No manager needed. The assistant calls the manager when asked, or when the rulebook has no page. Not because someone sounds upset.
Three triggers
- The customer asks for a human. Escalate now. No lookup first, and no attempt to talk them out of it.
- A policy gap. The policy is silent or unclear on the request, like matching a marketplace price. Escalate; don't invent a rule.
- No progress. The agent has made real attempts and is still stuck. Escalate, and pass along what was tried.
All three end with the same tool, escalate_to_human. The tool is the easy part. The rule decides when to call it. (If you want to see how a hand-off tool sits next to the other tools in a working loop, the refund app build-along has one.)
Notice what is not on the list. A hard case that the policy covers isn't a trigger. The agent can handle it.
A demand is not the same as a sigh
Upset is not the same as asking for a person.
- "Get me a human." That's an explicit request. Escalate at once.
- "Third time! Where is my parcel?" That's an upset customer with a simple question. Say sorry, look up the order, give the status. It's inside what the agent can do.
- If that same customer then asks for a person, the wish is now clear. Escalate.
So honour a request the first time it's made. Offer the fix first only when nobody asked for a human.
Two poor triggers
Two signals look tempting, and both mislead:
- Sentiment. How angry does the customer sound? An angry customer may have a simple question. A calm one may have a policy gap.
- The model's self-reported confidence. That number doesn't measure how hard the case really is. A model can feel sure and still be wrong (more on that in checking confident output against sources).
Escalate on what was asked and what the policy says, not on a feeling or a number.
system_prompt.txt: the rules in writing
This is the file the agent reads before every conversation:
You are the support agent for a small online shop.
Tools: get_customer, lookup_order, process_refund, escalate_to_human.
ESCALATE to a human when:
1. The customer asks for a human. Do it at once. Do not investigate.
2. The policy is silent or unclear on the request.
3. You cannot make meaningful progress after real attempts.
RESOLVE it yourself when:
- The issue is simple and in policy, even if the customer is upset.
Say sorry, then offer the fix. Escalate only if they ask again.
Never escalate because of tone or because you feel unsure.
If a lookup returns several customers, ask for an email or an order
number. Never pick one yourself.
Examples:
Customer: "Get me a human."
Action: escalate_to_human now, no lookup first.
Customer: "Third time asking! Where is my parcel?"
Action: say sorry, look up the order, give the status.
Customer: "Match the price a marketplace seller offers."
Action: policy only covers our own price drops, so escalate.
- Two lists: when to escalate and when to resolve. The resolve rule says "even if the customer is upset" out loud.
- A guard: never escalate because of tone or because you feel unsure. That line names both poor triggers.
- Three few-shot examples: one escalates at once, one resolves with a sorry, one escalates on a policy gap. Examples show the model the difference better than rules alone.
decide.py: the same rules, case by case
The project uses a stand-in agent, not a real model: decide() applies the rules from the prompt with plain if statements, so no API key is needed. It prints one action per case and the rule that fired.
"""Stand-in agent: applies the rules in system_prompt.txt. No key."""
COVERED = {"parcel status", "own price drop", "damaged item"}
def decide(c):
if c["asks_human"]:
why = "asked again" if c["repeat"] else "asked for a human"
return "ESCALATE", why + ", at once"
if c["matches"] > 1:
return "ASK FOR ID", "two records match, never guess"
if c["topic"] not in COVERED:
return "ESCALATE", "policy is silent on this"
if c["tries"] >= 3:
return "ESCALATE", "no progress after 3 tries"
return "RESOLVE", "inside policy, say sorry and fix it"
def case(**kw):
base = dict(mood="calm", conf=.9, topic="parcel status",
asks_human=False, repeat=False, matches=1, tries=0)
return {**base, **kw}
CASES = [
("asks for a human", case(mood="angry", asks_human=True)),
("angry, simple", case(mood="angry", conf=.4)),
("angry, asks again", case(mood="angry", asks_human=True,
repeat=True)),
("marketplace price", case(topic="competitor price")),
("stuck", case(topic="damaged item", tries=3)),
("two Maya Khans", case(matches=2)),
]
for name, c in CASES:
action, why = decide(c)
print(f"{name:18} -> {action:10} {why}")
Look at what decide() reads: asks_human, matches, topic and tries. Every case also carries a mood and a conf, on purpose, and decide() never reads either. "Angry, simple" has conf=.4 and still resolves; "marketplace price" is calm with conf=.9 and still escalates. Three tries as the "stuck" line is the demo's own number; the prompt itself says "after real attempts".
Run it
Running python decide.py:
asks for a human -> ESCALATE asked for a human, at once
angry, simple -> RESOLVE inside policy, say sorry and fix it
angry, asks again -> ESCALATE asked again, at once
marketplace price -> ESCALATE policy is silent on this
stuck -> ESCALATE no progress after 3 tries
two Maya Khans -> ASK FOR ID two records match, never guess
- Asks for a human: escalate at once, with no lookup.
- Angry, simple: the parcel status is covered, so resolve. Angry, low confidence, doesn't matter.
- Angry, asks again: the same customer now asks for a person, so escalate.
- Marketplace price:
competitor priceisn't inCOVERED, so the policy is silent. Escalate. - Stuck: a damaged item is covered, but three tries in, nothing moves. Escalate.
- Two Maya Khans: ask for an identifier.
Two Maya Khans: ask, never guess
The lookup finds two customers called Maya Khan: one with order 1042, one with order 2210. The shortcut is to guess, say, take the latest one. But then a refund may go to the wrong person.
The right move is one more question: ask for an email or an order number, then look up the right record. The prompt says it plainly: Never pick one yourself. If your lookup tool can return several matches, its result should make that visible to the agent, which is the kind of design covered in tool input schemas and error responses.
Common mistakes
- Escalating on anger. The angry parcel question is a simple lookup. Say sorry and fix it.
- Investigating first when someone asks for a human. An explicit request is honoured at once, no lookup, no persuasion.
- Filling a policy gap with a promise. If the policy is silent, the agent doesn't invent a rule; it escalates.
- Trusting the model's confidence score. It doesn't measure how hard the case is.
- Picking one of several matching customers. Ask for one more identifier.
- Rules with no examples. Few-shot examples show the line between escalate and resolve better than rules alone.
Recap
| Situation | Action | Why |
|---|---|---|
| "Get me a human." | Escalate at once | Explicit request |
| Upset, simple, in policy | Resolve: sorry plus the fix | Inside what the agent can do |
| Policy silent or unclear | Escalate | Don't invent a rule |
| Stuck after real attempts | Escalate with what was tried | No progress |
| Several customers match | Ask for an email or order number | Never guess |
| Angry tone, or a low confidence score | Not a trigger | Neither measures the case |
Exam lens: pick the answer that escalates on a clear rule and asks before choosing between matching customers, and distrust any option that triggers on tone or on a confidence number.
Try it yourself
Add a case to CASES where a customer is polite but asks about a topic the policy doesn't cover, and check what decide() does. Then add a fourth few-shot example to system_prompt.txt for a stuck case, showing what the agent should pass along when it escalates.
Related course on Udemy
Claude Certified Architect - Foundations (CCAR-F) Exam Prep
Agentic loops, tools, MCP, Claude Code, prompts, structured output and context.View on Udemy ↗: Claude Certified Architect - Foundations (CCAR-F) Exam Prep (paid course, opens in a new tab)Related posts
The Claude Messages API: Your First Call, Field by Field
One request in, one Message out. The four fields of a Messages API call (model, max_tokens, system, messages), how to read content blocks, stop_reason and usage, and why every turn resends the history.
Claude Tool Use: How tool_use and tool_result Work in the Messages API
Follow one order question through Claude's tool round trip: define a tool, read the tool_use block, run your own function and send a matching tool_result back, including parallel calls and is_error.
Claude Client SDKs Wrap One REST API: Raw HTTP, Python, TypeScript and Async Calls Compared
Every Claude client SDK wraps the same REST request: a POST to /v1/messages with a JSON body. See it built by hand, through the Python and TypeScript SDKs, as typed errors, and as async calls that wait together.
Anthropic SDK Timeouts, Retries and Error Classes: Configure the Client Once, Then Give 429, 529, 400 and Timeouts Their Own Move
Configure the Anthropic SDK client (timeout, max_retries, with_options, async, pagination), see which errors it retries by itself, then repair a retry wrapper so a 429, a 529, a 400 and a timeout each get the move the docs support.
