Single logo
  • Courses
  • Blog
  • About
Join on SkoolJoin on Skool

In this topic

Claude
  • Claude.ai Interface Tour: Every Control You Need on One Screen
  • The AI Fluency Model: Delegation, Description, Discernment and Diligence
  • Working With Claude: Pick the Surface, Match the Model, Keep the Context Clear
  • Claude's Four Entry Points: Choose Chat, Projects, Artifacts or Research Before You Type
  • What Claude Can Do: Extended Thinking, Web Search, Artifacts and File Analysis
  • Getting More From a Claude Chat: Steer the Conversation Instead of Starting Over
  • Claude Research Mode End to End: From One Prompt to a Cited Briefing
  • Claude's Capability Layer: When to Use Skills, Code Execution or Memory
  • Code Execution and File Creation in Claude: Calculated Numbers and a Real Excel File
  • Adding and Using Skills in Claude: Let Claude Pick the Skill, Then Teach It Your Format
  • Claude Memory, Curation and Incognito: Keep What Helps, Remove What Has Gone Stale
  • Claude Styles, Preferences and Project Instructions: Three Dials, Three Scopes
  • Claude Projects: Knowledge, Instructions and a Real Workspace You Set Up Once
  • Keeping a Claude Project Current and Connected: Refresh, Prune and Grant the Least
  • Claude Scheduled Tasks: Let Claude Work on a Schedule and Email You the Result
  • Claude Code and Claude for Chrome: What They Are and Who They Are For
  • Anatomy of a Good Prompt: Role, Context, Task, Format and Examples
  • Shaping Claude's Output: Format, Tone and Length in a Few Words
  • Iterating and Refining a Prompt: Read, Diagnose, Adjust, Repeat
  • Five Prompting Patterns for Work: Summarise, Extract, Rewrite, Classify and Draft
  • Why Evaluating AI Output Matters Most: Trust, Then Verify
  • Spotting AI Hallucinations and Fabrications: Four Tells and Where Risk Spikes
  • Fact-Checking Claude's Answers: Four Techniques and a Line-by-Line Claim Log
  • Judging AI Output Quality: Four Questions That Score Any Answer
  • Adapting AI Output for Your Audience: One Answer, Three Readers
  • When a Human Must Review AI Output Before It Ships
  • A Personal Validation Checklist for AI Output: Six Lines, Any Draft
  • Fitting Claude Into Real Work: Where It Helps and Where It Never Should
  • Breaking Big Tasks Into Steps With Claude: Small Asks, Checked Hand-offs
  • Designing a Repeatable Claude Workflow: A Reusable Weekly Report Template
  • Measuring If Claude Is Actually Working: One Number, Before and After
  • Communicating AI Value and Limitations to Stakeholders: The Honest Pitch
  • Data Privacy With Claude: What Never Goes in a Prompt, and How to Redact a Document Before You Paste It
  • Responsible AI Use and Transparency: Helpful, Honest, Harmless, and One Honest Line
  • Troubleshooting a Weak Claude Answer: Name the Cause, Fix One Thing, Then Make It Cheaper
  • CLAUDE.md, settings.json and Plugins: Which Claude Code File Advises, Which Enforces, Which Packages
  • Authoring a Claude Skill: SKILL.md, Frontmatter, Progressive Disclosure and the Description That Triggers It
  • One Change, Four Environments: Where a Claude Config Edit Lands in Dev, Staging, Prod and CI
  • Claude in the SDLC: Prompts in Git, a Change Gate by Path, a Claude Review That Advises and a Person Who Merges
  • Hooks That Block Destructive Actions: a PreToolUse Gate That Allows, Asks or Denies
  • Choosing a Claude Code Extension: Skill, Hook, Rules File, Subagent, Slash Command or Plugin
  • Rolling Out Claude Code to a Team: Settings Precedence, dontAsk in CI, a Hook for Every-Time Rules and a Plugin for Five Repos
  • A Claude Code Review Bot in CI: Headless -p, JSON Findings, Team Rules in Git and a Person on the Merge
  • Lab: Three Planted Bugs in a Claude Code CI Repo, a Permission Mode, a Plugin Path and an MCP Token Variable
  • Configuring MCP Servers in Claude Code: A Command or a URL, Three Scopes, and Three Moves When One Breaks
  • Claude Code's Built-in Tools: Read, Write, Edit, Bash, Grep and Glob, and When Each One Is the Right Pick
  • The CLAUDE.md Hierarchy: User, Project and Directory Files, How They Stack, and the Team Rule Stuck on One Laptop
  • Split a 600-Line CLAUDE.md: @import Lines, .claude/rules Files and Which One to Pick
  • Path-Specific Rules in Claude Code: paths Globs, When a Rule Loads and the Glob That Matches Nothing
  • Claude Code Slash Commands and Skills: Project vs User Scope, $ARGUMENTS, context: fork and allowed-tools
  • Iterative Refinement with Claude Code: Input/Output Examples, Tests First and the Interview Pattern
  • Claude Code Sessions: Resume by Name, Fork From a Baseline, or Start Fresh With a Summary Card
  • CI Reviews That Don't Repeat Themselves: Prior Findings, Existing Tests and Test Standards in CLAUDE.md
  • The Claude Messages API: Your First Call, Field by Field
  • Claude Tool Use: How tool_use and tool_result Work in the Messages API
  • Claude Client SDKs Wrap One REST API: Raw HTTP, Python, TypeScript and Async Calls Compared
  • Anthropic SDK Timeouts, Retries and Error Classes: Configure the Client Once, Then Give 429, 529, 400 and Timeouts Their Own Move
  • Claude Streaming Events: The Event Order, message_stop, Tool Arguments, Stop Reasons and a WebSocket Relay
  • Images, PDFs and Thinking Blocks in the Claude Messages API: Typed Blocks In, Typed Blocks Out
  • Getting Data Into Claude: PDF Documents, the Files API, Search Results and Citations
  • Opus, Sonnet or Haiku: Pick the Claude Model per Job, and Test the Request When a New Release Arrives
  • Adaptive Thinking and Effort in Claude: Two Dials, Set per Workload, and the Thinking Block You Must Pass Back
  • Claude Cost Tracking From usage: Count Before, Cap During, Read After, Then Find the Line That Drives the Bill
  • Claude Cache Breakpoints: Where to Put cache_control, How to Move It With the Chat, and Why the Reads Stay at Zero
  • Claude Message Batches or Real Time: Choose by Who Is Waiting, Match by custom_id, Resend Only the Failures
  • Calling Claude Through Amazon Bedrock, Google Cloud and Microsoft Foundry: Same Call, Different Door
  • The Life Cycle of a Claude App: Six Phases, a Model That Retires, and a Release Gate for Every Change
  • Pinning Claude Model IDs and Upgrading Safely: One Change at a Time, a Golden-Set Replay and a Staged Rollout
  • Content Boundaries and Schema Design for Claude: Fence the Input in a Tag, Let the Output Say I Don't Know
  • The Agentic Loop and stop_reason: Keep Turning on tool_use, Stop on end_turn, Cap the Turns
  • The Claude Agent SDK: query(), ClaudeAgentOptions and @tool, in Python and TypeScript
  • Fix the Agent: Four Broken Claude Agent SDK Configs, From the Symptom to the One Wrong Line
  • Claude Managed Agents: Cloud Sandbox, Self-Hosted Sandbox or Self-Hosted Service
  • Agent SDK Hooks for Deterministic Actions: PreToolUse, PostToolUse, and Four Hooks That Fail Silently
  • Memory and Context-Window Patterns for Claude Agents: Context Editing, Compaction and the Memory Tool
  • Reading an Agent Trace: Five Signatures, Five Missing Patterns, and How Long a Fact Must Live
  • Tool Descriptions for Claude: How Claude Picks a Tool, and How to Stop It Picking the Wrong One
  • Tool Input Schemas and Error Responses for Claude: Required Fields, Enums, is_error and a Retry Flag
  • Tool Response Shaping and a Lean Tool Set: Give Claude a Sticky Note, Not the Filing Cabinet
  • Fix the Tool Schema: Read the Trace, Fix the Card, Re-Run (Four Real Schema Bugs)
  • Client Tools, Server Tools and Approval Gates: Who Runs the Tool, and Who Says Yes First
  • Built-in Tool, Custom Tool, Skill or MCP Server? Pick the Lightest One That Fits
  • System Prompt or User Turn: Where Each Instruction Goes, and Output Limits Your Code Enforces
  • Refine the Prompt One Line at a Time, Then Clean and Fence the Customer's Text
  • Prompt Revision Driven by Evals: Name the Cause, Change One Thing, Rerun the Whole Suite
  • Long-Running Sessions: Compact, Prune, Isolate or Start Fresh, Decided by Naming the Failure
  • Context Isolation Through Subagents: Read the Logs Elsewhere, Keep One Line
  • Defensive Parsing of Claude Replies: Check the Stop Reason, Read the Block or the Text, Then Validate the Values
  • Full Context or Retrieval: Choose by Corpus Size, Cost and Freshness
  • Skepticism Toward Confident Output: Check the Quote, the Record and the Sum Before You Send
  • Debugging a Claude App: Three Error Types, the Recovery Each One Earns, and the First Failing Row
  • Six Ways a 200 Can Still Be Wrong: Hallucination, Refusal, Under-Acting, Context Loss, Format Drift and Inconsistency
  • Fix the Cause, Not the Symptom: Four Recovery Drills for an LLM App, Each Checked on a New Input
  • Integration Layer or Model Output? Three Taps and Three Questions to Find Where a Wrong Answer Lives
  • Which Test Layer Owns the Failure? Unit, Functional, Integration and End-to-End Tests for a Claude App
  • Designing an Overnight Document Pipeline on Claude: Batch Lane, Live Lane, a Cached Prefix and a custom_id Reconcile
  • Proving a Model Upgrade Is Ready: A Frozen Golden Set, a Calibrated Judge, the Right Layer and a Release Gate
  • From Requirement to Design for a Claude App: Eight Requirements, Five Elements and a Trace With No Gaps
  • Build a Claude Refund App: the Messages API, Two Tools, an MCP Server and a Hook in One Loop
  • Ship a Claude App: an Eval Gate, Two Guardrail Layers, a Cost Check From usage and a Pinned Model
  • Lab: a 30-Case Golden Set, a Calibrated Judge and a Per-Slice CI Gate on a Claude Refund App
  • Lab: Cut a Claude App's Bill by 62 Percent With Usage Data, Layered Cache Breakpoints and a Batch Job
  • Lab: Three Planted Bugs in a Claude App, a Vague Prompt, a Mistyped Tool Schema and a Broken Stream Handler
  • Lab: Three Planted Bugs in a Claude Code CI Repo, a Permission Mode, a Plugin Path and an MCP Token Variable
  • Lab: Harden a Claude App, an Uncalibrated Judge, a Retry Loop That Retries Everything and a Hook Matcher With a Gap
  • Lab: Turn a Claude App Into a Reusable Template, One Pinned Model Id, No Key in Code and Evals Built From Data
  • Building an MCP Server: Tools, Resources and Prompts in Python and TypeScript
  • MCP Transports: stdio or Streamable HTTP, and Who Starts the Server
  • Deploying and Authenticating an MCP Server: Environment Keys for stdio, Bearer Tokens and Scopes for HTTP
  • Validation-Retry Loops for Claude Extraction: Send Back the Exact Errors, and Stop When a Retry Cannot Help
  • Multi-Pass and Multi-Instance Code Review with Claude: A Fresh Reviewer, Per-File Passes and an Integration Pass
  • When a Claude Support Agent Should Escalate: Three Clear Triggers, Not Mood or a Confidence Score
  • Error Propagation Across Subagents: Retry Locally, Then Report the Failure, the Attempts and What You Found
  • Human Review and Confidence Calibration: Check Accuracy by Type and Field Before You Stop Looking
  • Provenance in Multi-Source Research: Keep Every Claim With Its Source and Date, and Show Conflicts Instead of Settling Them
  • Lab: An Extraction Pipeline With a Nullable Schema, Validation-Retry, a 100-Request Batch and Human Review
  • Lab: A Research Pipeline With Parallel Subagents, a Timeout That Keeps Its Partial Results, and a Report With Its Trail
  • Coordinator and Subagents: Decompose, Delegate, Check Coverage, and Call Only the Spokes You Need
  • Passing Context to Subagents: Nothing Is Inherited, So Put Findings, Goal and Criteria in the Prompt
  • Parallel Subagents: Several Task Calls in One Response, Every Result Back in One User Turn
  • Task Decomposition: a Fixed Prompt Chain With an Integration Pass, or a Dynamic Plan That Adapts
  • Prompt Guidance vs Programmatic Gates: Block the Refund Until the Customer Is Verified, Then Hand Off a Card That Stands Alone
  • Scoped Tools per Agent and tool_choice: Three to Five Tools per Role, a Shared One, and auto, any or a Forced Tool
  1. Blog
  2. /
  3. Claude
  4. /
  5. Building with the Claude API

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.

Chaand Sheikh

·27 November 2026Building with the Claude API

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

  1. The customer asks for a human. Escalate now. No lookup first, and no attempt to talk them out of it.
  2. A policy gap. The policy is silent or unclear on the request, like matching a marketplace price. Escalate; don't invent a rule.
  3. 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".

One rule fires per case asks for a human? more than one customer matches? policy silent on the topic? 3 tries, still stuck? RESOLVE: say sorry, fix it no no no no yes yes yes yes ESCALATE at once, no lookup ASK FOR ID, never guess ESCALATE, don't invent a rule ESCALATE with what was tried mood and conf are in every case; decide() never reads them
The checks in decide(), in order. The first rule that matches decides the action.

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 price isn't in COVERED, 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

SituationActionWhy
"Get me a human."Escalate at onceExplicit request
Upset, simple, in policyResolve: sorry plus the fixInside what the agent can do
Policy silent or unclearEscalateDon't invent a rule
Stuck after real attemptsEscalate with what was triedNo progress
Several customers matchAsk for an email or order numberNever guess
Angry tone, or a low confidence scoreNot a triggerNeither 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.

Tried the exercise? Share your answer or ask a question.

The StudyEasy AI Community is free to join, with the lesson files, notebooks and code.

Join free on Skool

Keep going in Claude · 112 of 123

Previous
Multi-Pass and Multi-Instance Code Review with Claude: A Fresh Reviewer, Per-File Passes and an Integration Pass
Next post
Error Propagation Across Subagents: Retry Locally, Then Report the Failure, the Attempts and What You Found

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.

On this page

  • Going by mood gets both cases wrong
  • Three triggers
  • A demand is not the same as a sigh
  • Two poor triggers
  • system_prompt.txt: the rules in writing
  • decide.py: the same rules, case by case
  • Run it
  • Two Maya Khans: ask, never guess
  • Common mistakes
  • Recap
  • Try it yourself
Community · Free to join
Single logo

StudyEasy AI Community

Hosted onSkool

Learn AI engineering, share what you build, and connect with other learners.

  • Free resources: lesson files, notebooks and code

  • Ask questions and join engineering discussions

  • Meet real people learning and building with AI

Join free on Skool

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)

Single logo

Empowering Education, One Course at a Time

About
About usContact us
Legal
Terms of UsePrivacy Policy

© 2026 StudyEasy Organization. All rights reserved.