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

Agent SDK reference - TypeScript changedagent-sdk/typescript

Recorded here
Lines+58added
Lines−0removed
From line 1,688 where the diff opens
First seen 14 Aug 2026 this site's first read of the page
Recorded edits114to this page, all time

#### `PreModelSwitchHookInput` #### `PostModelSwitchHookInput`

The whole hunk

from line 1688, old and new numbered
/
lines

This page is larger than the 256 KiB this site keeps, so one side of the diff below stops where the stored text does.

from line 1688
16881688 | "SubagentStop"
16891689 | "PreCompact"
16901690 | "PostCompact"
1691 | "PreModelSwitch"
1692 | "PostModelSwitch"
16911693 | "PermissionRequest"
16921694 | "PermissionDenied"
16931695 | "Setup"
from line 1754
17521754 | SubagentStopHookInput
17531755 | PreCompactHookInput
17541756 | PostCompactHookInput
1757 | PreModelSwitchHookInput
1758 | PostModelSwitchHookInput
17551759 | PermissionRequestHookInput
17561760 | SetupHookInput
17571761 | TeammateIdleHookInput
from line 2002
19982002};
19992003```
20002004 
2005#### `PreModelSwitchHookInput`
2006 
2007Fires before a requested model switch takes effect. `context_tokens` and the fields after it estimate what re-sending the conversation to the new model costs. For the full field descriptions and blocking semantics, see [PreModelSwitch](/docs/en/hooks#premodelswitch).
2008 
2009```typescript theme={null}
2010type PreModelSwitchHookInput = BaseHookInput & {
2011 hook_event_name: "PreModelSwitch";
2012 from_model: string;
2013 to_model: string;
2014 requested_model: string | null;
2015 source: "command" | "picker" | "sdk";
2016 context_tokens: number;
2017 prompt_cache_warm: boolean;
2018 cache_ttl: "5m" | "1h";
2019 estimated_cache_write_usd: number;
2020 pricing: "configured" | "catalog" | "default";
2021};
2022```
2023 
2024#### `PostModelSwitchHookInput`
2025 
2026Fires after the session's model changes. It carries the same fields as `PreModelSwitchHookInput`, with two more `source` values. See [PostModelSwitch](/docs/en/hooks#postmodelswitch).
2027 
2028```typescript theme={null}
2029type PostModelSwitchHookInput = BaseHookInput & {
2030 hook_event_name: "PostModelSwitch";
2031 from_model: string;
2032 to_model: string;
2033 requested_model: string | null;
2034 source: "command" | "picker" | "sdk" | "auto" | "resume";
2035 context_tokens: number;
2036 prompt_cache_warm: boolean;
2037 cache_ttl: "5m" | "1h";
2038 estimated_cache_write_usd: number;
2039 pricing: "configured" | "catalog" | "default";
2040};
2041```
2042 
20012043#### `PermissionRequestHookInput`
20022044 
20032045```typescript theme={null}
from line 2295
22532295 additionalContext?: string;
22542296 }
22552297 | {
2298 hookEventName: "PreModelSwitch";
2299 /**
2300 * Same contract as PreToolUse: "allow" proceeds, "deny" cancels
2301 * the switch, "ask" asks the user to confirm. Only /model in an
2302 * interactive session shows that prompt; every other surface,
2303 * set_model requests included, treats "ask" as a refusal.
2304 */
2305 permissionDecision?: "allow" | "deny" | "ask";
2306 permissionDecisionReason?: string;
2307 }
2308 | {
2309 hookEventName: "PostModelSwitch";
2310 /** Reaches the model with the next request the new model serves. */
2311 additionalContext?: string;
2312 }
2313 | {
22562314 hookEventName: "SubagentStart";
22572315 additionalContext?: string;
22582316 }
from line 3686
36283686<Note>
36293687 On TypeScript Agent SDK 0.3.233 and later, the following restriction applies.
36303688 
3631 The following tools aren't available on Opus 4.8, Sonnet 5, Fable 5, Mythos 5, or later versions of those families unless you opt in:
3632 
3633 * `TodoWrite`
3634 * `TaskCreate`
3635 * `TaskGet`
3636 * `TaskUpdate`
3637 * `TaskList`
3638 
3639 On other models, Claude Code provides the Task tools by default and `TodoWrite` only when you set `CLAUDE_CODE_ENABLE_TASKS=0`.
3640 
3641 See [Model availability](/docs/en/agent-sdk/todo-tracking#model-availability) to opt in.
3642</Note>
3643 
3644### TaskCreate
3645 
3646**Tool name:** `TaskCreate`
3647 
3648```typescript theme={null}
3649type TaskCreateOutput = {
3650 task: {
3651 id: string;
3652 subject: string;
3653 };
3654};
3655```
3656 
3657Returns the created task with its assigned ID.
3658 
3659### TaskUpdate
3660 
3661**Tool name:** `TaskUpdate`
3662 
3663```typescript theme={null}
3664type TaskUpdateOutput = {
3665 success: boolean;
3666 taskId: string;
3667 updatedFields: string[];
3668 error?: string;
3669 statusChange?: {
3670 from: string;
3671 to: string;
3672 };
3673};
3674```
3675 
3676Returns the update result, including which fields changed.
3677 
3678### TaskGet
3679 
3680**Tool name:** `TaskGet`
3681 
3682```typescript theme={null}
3683type TaskGetOutput = {
3684 task: {
3685 id: string;
3686 subject: string;
3687 description: string;
3688 status: "pending" | "in_progress" | "completed";
3689 blocks: string[];
3690 blockedBy: string[];
3691 } | null;
3692};
3693```
3694 
3695Returns the full task record, or `null` when the ID is not found.
3696 
3697### TaskList
3698 
3699**Tool name:** `TaskList`
3700 
3701```typescript theme={null}
3702type TaskListOutput = {
3703 tasks: Array<{
3704 id: string;
3705 subject: string;
3706 status: "pending" | "in_progress" | "completed";
3707 owner?: string;
3708 blockedBy: string[];
3709 }>;
3710};
3711```
3712 
3713Returns a snapshot of all tasks in the current list.
3714 
3715### ExitPlanMode
3716 
3717**Tool name:** `ExitPlanMode`
3718 
3719```typescript theme={null}
3720type ExitPlanModeOutput = {
3721 plan: string | null;
3722 isAgent: boolean;
3723 filePath?: string;
3724 hasTaskTool?: boolean;
3725 planWasEdited?: boolean;
3726 awaitingLeaderApproval?: boolean;
3727 requestId?: string;
3728};
3729```
3730 
3731Returns the plan state after exiting plan mode.
3732 
3733### ListMcpResources
3734 
3735**Tool name:** `ListMcpResourcesTool`
3736 
3737```typescript theme={null}
3738type ListMcpResourcesOutput = Array<{
3739 uri: string;
3740 name: string;
3741 mimeType?: string;
3742 description?: string;
3743 server: str
3689 The following tools aren't available on Opus 4.8, Sonnet 5, Fable 5, Mythos 5, or la
Feedback