Follow Discord
Sweep 22 Oct 2026 · 04:32Z Build v2.1.308 527 read Stable v2.1.308 Latest v2.1.308 Next v2.1.308 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One change · claude-code

Handle approvals and user input changedagent-sdk/user-input

Nearest release: v2.1.295, published 9 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 9 Oct 2026 03:28 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 9 Oct 2026 03:37 UTC.

Upstream edited
Recorded here
Lines+10added
Lines−5removed
From line 30 where the diff opens
First seen 14 Aug 2026 this site's first read of the page
Recorded edits12to this page, all time

The whole hunk

from line 30, old and new numbered
/
lines
from line 30
3030 ```
3131 
3232 ```typescript TypeScript theme={null}
33 async function handleToolRequest(toolName, input, options) {
33 import type { CanUseTool } from "@anthropic-ai/claude-agent-sdk";
34 
35 const handleToolRequest: CanUseTool = async (toolName, input, options) => {
3436 // options includes { signal: AbortSignal, suggestions?: PermissionUpdate[] }
35 // Prompt user and return allow or deny
36 }
37 // Prompt the user here, then return allow or deny
38 return { behavior: "deny", message: "User declined" };
39 };
3740 
3841 const options = { canUseTool: handleToolRequest };
3942 ```
from line 431
428431 // Include AskUserQuestion in your tools list
429432 tools: ["Read", "Glob", "Grep", "AskUserQuestion"],
430433 canUseTool: async (toolName, input) => {
431 // Handle clarifying questions here
434 // Placeholder that approves every call. The Detect AskUserQuestion step replaces it.
435 return { behavior: "allow", updatedInput: input };
432436 }
433437 }
434438 })) {
from line 745
741745 
742746 ```typescript TypeScript theme={null}
743747 import { query } from "@anthropic-ai/claude-agent-sdk";
748 import type { PermissionResult } from "@anthropic-ai/claude-agent-sdk";
744749 import * as readline from "readline/promises";
745750 
746751 // Helper to prompt user for input in the terminal
from line 766
761766 }
762767 
763768 // Display Claude's questions and collect user answers
764 async function handleAskUserQuestion(input: any) {
769 async function handleAskUserQuestion(input: any): Promise<PermissionResult> {
765770 const answers: Record<string, string> = {};
766771 
767772 for (const q of input.questions) {
Feedback