Escalation and Ambiguity
Mostly design guidance: the docs give mechanisms but not the policy. The policy below is the standard answer pattern.
Explicit escalation triggers (design guidance)
Define escalation in terms the agent and your code can both check:
- the user explicitly asks for a human;
- the request needs an action outside policy or authority (refund above a limit, account change needing verification you cannot perform);
- a policy gap: the rules do not cover the situation;
- no progress after a bounded number of attempts or tool failures;
- the action is irreversible or high impact and confidence is low.
Put hard limits in code or hooks, not only in the prompt (1.4).
Why sentiment is a poor trigger (design guidance)
"Escalate when the customer sounds angry" misfires both ways: calm customers with serious, out-of-policy requests are missed, and frustrated customers with simple solvable issues are escalated needlessly. Escalate on task facts (policy, authority, repeated failure, explicit request), and use sentiment only as a secondary signal for tone.
Ambiguity: ask, do not guess (design guidance)
- Multiple records match a name and the action is not reversible: ask a clarifying question, listing the options, or require an identifier.
- Heuristic to choose between asking and proceeding: if a wrong guess is cheap and reversible, proceed and state the assumption; if it is costly or irreversible, ask.
- In Claude Code, the
AskUserQuestiontool (verified) asks multiple-choice questions to clarify requirements.
Mechanisms available
- A
PreToolUsehook can returnask(prompt the user) ordefer, which ends the turn withstop_reason: "tool_deferred"so the call can be resumed later after a human decides (Domain 1.5). maxTurnsand spend caps stop runaway attempts; a subagent that hitsmaxTurnsreturns output marked partial.- In
-pruns,--permission-prompts nonedenies anything that would prompt.
The handoff package (design guidance)
Escalate with a self-contained summary: who the user is (ids), what they asked, what was tried and the results, the reason for escalation, and a suggested next step (1.4).
Exam traps
- Sentiment-based escalation as the primary rule.
- Guessing among multiple matches for an irreversible action.
- Escalating with "see transcript".
- Unbounded retries before escalating.
- Prompt-only escalation rules for hard limits.
References
- Hooks in the SDK — checked Oct 16, 2026
- Subagents in the SDK — checked Oct 16, 2026
- Tools reference — checked Oct 16, 2026
Check your understanding
Two accounts match "John Smith"; the action is a refund. What now?Show answerHide answer
Answer
Ask for a distinguishing identifier before acting.Three tool failures in a row on the same step. Next move?Show answerHide answer
Answer
Stop retrying and escalate with the attempts logged.Better escalation trigger: customer sounds upset, or request exceeds the refund limit?Show answerHide answer
Answer
Exceeds the limit (task fact).