Handle approvals and user input changedagent-sdk/user-input
Nearest release: v2.1.329, published 4 hours before upstream edited the page. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.
Upstream edited this page at 19 Nov 2026 23:04 UTC, give or take a minute or two: the time comes from Anthropic’s own sitemap rather than from a commit. This site recorded the change at 19 Nov 2026 23:07 UTC.
Upstream edited
Recorded here
Lines+2added
Lines−2removed
From line
42
where the diff opens
First seen
14 Aug 2026
this site's first read of the page
Recorded edits17to this page, all time
The whole hunk
from line 42, old and new numbered
/
from line 42
4242
4343The callback fires in two cases:
4444
451. **Tool needs approval**: Claude wants to use a tool that isn't auto-approved by a [permission rule](https://code.claude.com/docs/en/agent-sdk/permissions.md) or permission mode. Check `tool_name` for the tool (e.g., `"Bash"`, `"Write"`).
451. **Tool needs approval**: Claude makes a call that the [permission flow](https://code.claude.com/docs/en/agent-sdk/permissions.md#how-permissions-are-evaluated) hasn't already approved or denied. Check `tool_name` for the tool (for example, `"Bash"`, `"Write"`).
46462. **Claude asks a question**: Claude calls the `AskUserQuestion` tool. Check if `tool_name == "AskUserQuestion"` to handle it differently. If you specify a `tools` array, include `AskUserQuestion` for this to work. For more information, see [Handle clarifying questions](#handle-clarifying-questions).
4747
4848> [!WARNING]
from line 49
4949>
5050> **An earlier step can allow or deny a call before `canUseTool` runs.** The [permission evaluation flow](https://code.claude.com/docs/en/agent-sdk/permissions.md#how-permissions-are-evaluated) checks deny rules, the permission mode, and allow rules before your callback.
5151>
52> To run your checks on calls that a rule or the permission mode already allowed, use a [`PreToolUse` hook](https://code.claude.com/docs/en/agent-sdk/hooks), which runs for those calls and can allow, deny, or modify them.
52> To check calls that run without your callback, such as file reads inside your [working directories](https://code.claude.com/docs/en/permissions.md#working-directories), use a [`PreToolUse` hook](https://code.claude.com/docs/en/agent-sdk/hooks), which can allow, deny, or modify them.
5353
5454You can also use the [`PermissionRequest` hook](https://code.claude.com/docs/en/agent-sdk/hooks#available-hooks) to send external notifications (Slack, email, push) when Claude is waiting for approval.
5555
No line in this hunk matches that.