You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On the [models that don't get the task-tracking tools](/docs/en/agent-sdk/todo-tracking#model-availability), Claude Code provides `TaskCreate` and `TaskUpdate` only when you opt in.
153
+
152
154
Beyond built-in tools, you can:
153
155
154
156
***Connect external services** with [MCP servers](/docs/en/agent-sdk/mcp) (databases, browsers, APIs)
Copy file name to clipboardExpand all lines: docs/agent-sdk/python.md
+11-1Lines changed: 11 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2846,7 +2846,17 @@ When Monitor runs a command, it follows the same permission rules as Bash; a Web
2846
2846
**Tool name:**`TodoWrite`
2847
2847
2848
2848
<Note>
2849
-
As of Claude Code v2.1.142, `TodoWrite`is disabled by default. Use `TaskCreate`, `TaskGet`, `TaskUpdate`, and`TaskList` instead. See [Migrate to Task tools](/docs/en/agent-sdk/todo-tracking#migrate-to-task-tools) to update your monitoring code, or set `CLAUDE_CODE_ENABLE_TASKS=0` to revert to `TodoWrite`.
2849
+
On Python Agent SDK0.2.139 and later, 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:
2850
+
2851
+
*`TodoWrite`
2852
+
*`TaskCreate`
2853
+
*`TaskGet`
2854
+
*`TaskUpdate`
2855
+
*`TaskList`
2856
+
2857
+
On other models, Claude Code provides the Task tools by default and`TodoWrite` only when you set`CLAUDE_CODE_ENABLE_TASKS=0`.
2858
+
2859
+
See [Model availability](/docs/en/agent-sdk/todo-tracking#model-availability) to opt in and [Migrate to Task tools](/docs/en/agent-sdk/todo-tracking#migrate-to-task-tools) to update your monitoring code.
Copy file name to clipboardExpand all lines: docs/agent-sdk/todo-tracking.md
+35-13Lines changed: 35 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,9 +9,25 @@
9
9
The Claude Agent SDK includes built-in todo functionality that helps organize complex workflows and keep users informed about task progression.
10
10
11
11
<Note>
12
-
As of TypeScript Agent SDK 0.3.142 and Claude Code v2.1.142, sessions use the structured Task tools `TaskCreate`, `TaskUpdate`, `TaskGet`, and `TaskList` instead of `TodoWrite`. The Python SDK gets this change from the Claude Code CLI it launches, not from the Python package version: the switch applies once that CLI — the copy bundled inside the pip package, or one you point to with `cli_path` — is v2.1.142 or later. See [Migrate to Task tools](#migrate-to-task-tools) for how monitoring code changes. The examples on this page set `CLAUDE_CODE_ENABLE_TASKS=0` to keep showing `TodoWrite` for sessions that have not migrated yet.
12
+
On TypeScript Agent SDK 0.3.233 and later, or Python Agent SDK 0.2.139 and later, 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:
13
+
14
+
*`TodoWrite`
15
+
*`TaskCreate`
16
+
*`TaskGet`
17
+
*`TaskUpdate`
18
+
*`TaskList`
19
+
20
+
On other models, Claude Code provides the Task tools by default and `TodoWrite` only when you set `CLAUDE_CODE_ENABLE_TASKS=0`.
13
21
</Note>
14
22
23
+
### Model availability
24
+
25
+
On the [models that don't get the task-tracking tools](/docs/en/tools-reference#task-tool-availability), you see no `tool_use` blocks for them in the message stream unless you opt in. If you point `cli_path` in Python or `pathToClaudeCodeExecutable` in TypeScript at your own Claude Code install, you get whichever tools that install provides. To get the same tools as on other models, do one of the following:
26
+
27
+
* Name one of the tools in the [`allowedTools`](/docs/en/agent-sdk/permissions#allow-and-deny-rules) option, `allowed_tools` in Python
28
+
* List the tools in the `tools` option, which restricts the session's built-in tools to the ones it names. Include the tools you want alongside the other built-in tools you use
29
+
* Set `CLAUDE_CODE_ENABLE_TODO_TOOLS=1` in the `env` option, as the examples on this page do. In TypeScript, `env` replaces the subprocess environment, so spread `...process.env` to keep inherited variables. In Python, `env` is merged on top of the inherited environment
30
+
15
31
### Todo Lifecycle
16
32
17
33
Claude moves each todo through a predictable lifecycle:
@@ -52,8 +68,9 @@ See [Handle the result](/docs/en/agent-sdk/agent-loop#handle-the-result) for the
52
68
forawait (const message ofquery({
53
69
prompt: "Optimize my React app performance and track progress with todos",
54
70
// Re-enable TodoWrite, which this example monitors. Without it, the SDK uses
55
-
// Task tools instead and these tool_use blocks never appear.
@@ -241,7 +259,7 @@ See [Handle the result](/docs/en/agent-sdk/agent-loop#handle-the-result) for the
241
259
242
260
## Migrate to Task tools
243
261
244
-
The Task tools split the single `TodoWrite` call into `TaskCreate` for each new item and `TaskUpdate` for each status change, with `TaskList` and `TaskGet` available for the model to read back the current list. Your monitoring code still inspects `tool_use` blocks in the assistant stream, but maintains a map keyed by task ID instead of replacing the whole list on every call. The Task tools are the default as of TypeScript Agent SDK 0.3.142 and Claude Code v2.1.142, so no `options.env` change is needed.
262
+
The Task tools split the single `TodoWrite` call into `TaskCreate` for each new item and `TaskUpdate` for each status change, with `TaskList` and `TaskGet` available for the model to read back the current list. Your monitoring code still inspects `tool_use` blocks in the assistant stream, but maintains a map keyed by task ID instead of replacing the whole list on every call.
@@ -250,7 +268,9 @@ The Task tools split the single `TodoWrite` call into `TaskCreate` for each new
250
268
| Item shape: `{ content, status, activeForm }`|`TaskCreate` input: `{ subject, description, activeForm?, metadata? }`. `TaskUpdate` input: `{ taskId, status?, subject?, description?, activeForm?, addBlocks?, addBlockedBy?, owner?, metadata? }`. `status` is `"pending"`, `"in_progress"`, or `"completed"`; set `status: "deleted"` to delete |
251
269
| Render `block.input.todos` directly | Accumulate items across calls, or read a snapshot from a `TaskList` tool result |
252
270
253
-
The assigned task ID is not in the `TaskCreate` input. It comes back in the matching `tool_result` as `{ task: { id, subject } }`, so capture it from the result block to key your map. The following example shows the minimal change to the [Monitoring Todo Changes](#monitoring-todo-changes) loop. It reads only `tool_use` inputs and skips capturing IDs from `tool_result` blocks. To render a complete list, watch for a `TaskList` tool result in the stream or accumulate `TaskCreate` results and `TaskUpdate` inputs into a map.
271
+
The assigned task ID is not in the `TaskCreate` input. It comes back in the matching `tool_result` as `{ task: { id, subject } }`, so capture it from the result block to key your map.
272
+
273
+
The following example shows the minimal change to the [Monitoring Todo Changes](#monitoring-todo-changes) loop. It leaves `CLAUDE_CODE_ENABLE_TASKS` unset, because the Task tools are the default, and sets only `CLAUDE_CODE_ENABLE_TODO_TOOLS=1`, the [opt-in](#model-availability) for the models that otherwise don't get the tools. It reads only `tool_use` inputs and skips capturing IDs from `tool_result` blocks. To render a complete list, watch for a `TaskList` tool result in the stream or accumulate `TaskCreate` results and `TaskUpdate` inputs into a map.
254
274
255
275
The streamed `tool_use` input is the raw shape the model emitted. Claude Code repairs some close-but-incorrect key names before execution, mapping `id` or `task_id` to `taskId` and `active_form` to `activeForm`, but that repair is not reflected in the stream. Read `TaskUpdate` input fields defensively, as the samples below do, rather than assuming the canonical name is always present.
256
276
@@ -261,7 +281,8 @@ The streamed `tool_use` input is the raw shape the model emitted. Claude Code re
261
281
try {
262
282
forawait (const message ofquery({
263
283
prompt: "Optimize my React app performance and track progress with todos",
264
-
options: { maxTurns: 15 },
284
+
// Keeps the Task tools on models where Claude Code otherwise doesn't provide them.
Copy file name to clipboardExpand all lines: docs/agent-sdk/typescript.md
+22-2Lines changed: 22 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2520,7 +2520,17 @@ type TodoWriteInput = {
2520
2520
Creates and manages a structured task list for tracking progress.
2521
2521
2522
2522
<Note>
2523
-
As of TypeScript Agent SDK 0.3.142, `TodoWrite` is disabled by default. Use `TaskCreate`, `TaskGet`, `TaskUpdate`, and `TaskList` instead. See [Migrate to Task tools](/docs/en/agent-sdk/todo-tracking#migrate-to-task-tools) to update your monitoring code, or set `CLAUDE_CODE_ENABLE_TASKS=0` to revert to `TodoWrite`.
2523
+
On TypeScript Agent SDK 0.3.233 and later, 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:
2524
+
2525
+
* `TodoWrite`
2526
+
* `TaskCreate`
2527
+
* `TaskGet`
2528
+
* `TaskUpdate`
2529
+
* `TaskList`
2530
+
2531
+
On other models, Claude Code provides the Task tools by default and `TodoWrite` only when you set `CLAUDE_CODE_ENABLE_TASKS=0`.
2532
+
2533
+
See [Model availability](/docs/en/agent-sdk/todo-tracking#model-availability) to opt in and [Migrate to Task tools](/docs/en/agent-sdk/todo-tracking#migrate-to-task-tools) to update your monitoring code.
2524
2534
</Note>
2525
2535
2526
2536
### TaskCreate
@@ -3435,7 +3445,17 @@ type TodoWriteOutput = {
3435
3445
Returns the previous and updated task lists.
3436
3446
3437
3447
<Note>
3438
-
As of TypeScript Agent SDK 0.3.142, `TodoWrite` is disabled by default. Use `TaskCreate`, `TaskGet`, `TaskUpdate`, and `TaskList` instead. See [Migrate to Task tools](/docs/en/agent-sdk/todo-tracking#migrate-to-task-tools) to update your monitoring code, or set `CLAUDE_CODE_ENABLE_TASKS=0` to revert to `TodoWrite`.
3448
+
On TypeScript Agent SDK 0.3.233 and later, 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:
3449
+
3450
+
* `TodoWrite`
3451
+
* `TaskCreate`
3452
+
* `TaskGet`
3453
+
* `TaskUpdate`
3454
+
* `TaskList`
3455
+
3456
+
On other models, Claude Code provides the Task tools by default and `TodoWrite` only when you set `CLAUDE_CODE_ENABLE_TASKS=0`.
3457
+
3458
+
See [Model availability](/docs/en/agent-sdk/todo-tracking#model-availability) to opt in and [Migrate to Task tools](/docs/en/agent-sdk/todo-tracking#migrate-to-task-tools) to update your monitoring code.
Copy file name to clipboardExpand all lines: docs/agent-teams.md
+10-8Lines changed: 10 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,13 +39,13 @@ Both agent teams and [subagents](/docs/en/sub-agents) let you parallelize work,
39
39
<imgsrc="https://mintcdn.com/claude-code/nsvRFSDNfpSU5nT7/images/subagents-vs-agent-teams-dark.png?fit=max&auto=format&n=nsvRFSDNfpSU5nT7&q=85&s=d573a037540f2ada6a9ae7d8285b46fd"className="hidden dark:block"alt="Diagram comparing subagent and agent team architectures. Subagents are spawned by the main agent, do work, and report results back. Agent teams coordinate through a shared task list, with teammates communicating directly with each other."width="4245"height="1615"data-path="images/subagents-vs-agent-teams-dark.png" />
|**Context**| Own context window; results return to the caller | Own context window; fully independent |
45
+
|**Communication**| Report results back to the main agent only | Teammates message each other directly |
46
+
|**Coordination**| Main agent manages all work |Self-coordination through messages, plus a shared task list for [agents that have the Task tools](/docs/en/tools-reference#task-tool-availability)|
47
+
|**Best for**| Focused tasks where only the result matters | Complex work requiring discussion and collaboration |
48
+
|**Token cost**| Lower: results summarized back to main context | Higher: each teammate is a separate Claude instance |
49
49
50
50
Use subagents when you need quick, focused workers that report back. Use agent teams when teammates need to share findings, challenge each other, and coordinate on their own.
51
51
@@ -179,6 +179,8 @@ A teammate's model and fast mode are fixed when it spawns, so `/model` and `/fas
179
179
180
180
The shared task list coordinates work across the team. The lead creates tasks and teammates work through them. Tasks have three states: pending, in progress, and completed. Tasks can also depend on other tasks: a pending task with unresolved dependencies cannot be claimed until those dependencies are completed.
181
181
182
+
Agents [without the Task tools](/docs/en/tools-reference#task-tool-availability) coordinate through messages instead of the shared task list.
183
+
182
184
The lead can assign tasks explicitly, or teammates can self-claim:
183
185
184
186
***Lead assigns**: tell the lead which task to give to which teammate
@@ -258,7 +260,7 @@ To use a subagent definition, mention it by name when asking Claude to spawn the
258
260
Spawn a teammate using the security-reviewer agent type to audit the auth module.
259
261
```
260
262
261
-
The teammate honors that definition's `tools` allowlist and `model`, and the definition's body is appended to the teammate's system prompt as additional instructions rather than replacing it. Team coordination tools such as `SendMessage`and the task management tools are always available to a teammate even when `tools` restricts other tools.
263
+
The teammate honors that definition's `tools` allowlist and `model`, and the definition's body is appended to the teammate's system prompt as additional instructions rather than replacing it. For an in-process teammate, Claude Code adds `SendMessage`to that allowlist. In a [session that has the Task tools](/docs/en/tools-reference#task-tool-availability), Claude Code adds `TaskCreate`, `TaskGet`, `TaskList`, and `TaskUpdate` to it too.
262
264
263
265
<Note>
264
266
The `skills` and `mcpServers` frontmatter fields in a subagent definition are not applied when that definition runs as a teammate. Teammates load skills and MCP servers from your project and user settings, the same as a regular session.
0 commit comments