OmniscioGuidesAgent SDK todo tracking
Claude Agent SDK todo tracking: reading task progress
Opt a session into todo tracking only when your application reads the tool calls, either to log activity or to draw its own progress display. On newer models Claude tracks multi-step work without writing a list at all.
This page owns the task-tracking tools in an Agent SDK app. The SDK overview owns the first agent, and the Claude Code todo list guide owns the same feature in the terminal.
Sources read November 26, 2026. By the Omniscio team. Updated .
Which models have the task tools
These tools are available by default only on Claude Opus 4.7, Claude Sonnet 4.6, Claude Haiku 4.5 and earlier models: TodoWrite, TaskCreate, TaskGet, TaskUpdate and TaskList. On every other model, including model IDs Claude Code does not recognize, they are not there unless you opt in. Wherever they are available, Claude Code provides the four Task tools, or TodoWrite instead when you set CLAUDE_CODE_ENABLE_TASKS=0.
That default set applies in Claude Code v2.1.268 and later, which the TypeScript Agent SDK bundles from v0.3.268. If you point pathToClaudeCodeExecutable or cli_path at your own install, you get that install's tools under its own defaults.
Three ways to opt in
- Name one of the tools in
allowedTools(TypeScript) orallowed_tools(Python). - List the tools in the
toolsoption, which restricts the session's built-in tools to the ones it names, so include every other built-in tool you use. - Set
CLAUDE_CODE_ENABLE_TODO_TOOLS=1in theenvoption.
The last one has a platform difference worth knowing: 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.
options: {
maxTurns: 15,
permissionMode: "acceptEdits",
env: { ...process.env, CLAUDE_CODE_ENABLE_TODO_TOOLS: "1" }
}The lifecycle of a todo
- Created. Claude adds the todo as
pendingwhen it identifies a task. - Activated. Claude sets it to
in_progresswhen it starts the work. - Completed. Claude marks it completed when the task finishes successfully.
- Removed. Claude deletes a todo it no longer needs by setting
status: "deleted"in aTaskUpdatecall.
Claude creates todos for most multi-step work: tasks needing three or more distinct actions, user-provided task lists with several items, longer operations that benefit from progress tracking, and explicit requests. It may skip them for a very short or single-step request.
Read the stream
Todo activity is not a system message. It appears as tool_use blocks in assistant messages, so you iterate the message content and filter by block type. The task system messages, such as SDKTaskNotificationMessage, report background tasks such as backgrounded commands and subagents instead.
if (message.type !== "assistant") continue;
for (const block of message.message.content) {
if (block.type !== "tool_use") continue;
if (block.name === "TaskCreate") {
console.log(`+ ${(block.input as { subject: string }).subject}`);
} else if (block.name === "TaskUpdate") {
const input = block.input as {
taskId?: string; id?: string; task_id?: string; status?: string;
};
const taskId = input.taskId ?? input.id ?? input.task_id;
if (taskId && input.status) console.log(` ${taskId} -> ${input.status}`);
}
}Read the keys defensively. The streamed 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.
A log built this way cannot match updates back to creates: the TaskCreate input carries no ID, so the + line prints only the subject.
Render progress with real task IDs
To keep a map of tasks keyed by ID, take the ID from the tool result rather than the call. Claude Code delivers each tool's structured output on the user message that carries its tool_result block, in the tool_use_result field. For TaskCreate that object is TaskCreateOutput, shaped { task: { id, subject } }, in TypeScript and a plain dict of the same shape in Python. Pair each tool_result block with its tool_use call by tool_use_id and read task.id from the paired message.
const pending = new Map<string, { subject: string }>();
const tasks = new Map<string, { subject: string; status: string }>();
if (message.type === "assistant") {
for (const block of message.message.content) {
if (block.type === "tool_use" && block.name === "TaskCreate") {
pending.set(block.id, { subject: (block.input as { subject: string }).subject });
}
}
}
if (message.type === "user") {
for (const block of message.message.content) {
if (block.type !== "tool_result") continue;
const create = pending.get(block.tool_use_id);
if (!create) continue;
pending.delete(block.tool_use_id);
const out = message.tool_use_result as { task?: { id: string } };
if (out?.task?.id) tasks.set(out.task.id, { ...create, status: "pending" });
}
}In Python the same pairing reads a ToolResultBlock and the message's tool_use_result dict.
With that map you can count completed and in-progress items and show each active item's activeForm label in place of its subject. Claude can read the list back with TaskList and one task's full details with TaskGet.
The examples on Anthropic's page all use permissionMode: "acceptEdits", a turn limit on the query, and a try/catch, because a single-shot query() throws after yielding an error_max_turns result. Check the result's subtype to detect that ending.
Sources
Every line on this page rests on this page of Anthropic's documentation, read on the date beside it.
- Track todos, for model availability, the opt-in routes, the lifecycle, when Claude creates todos, the message-stream shape, defensive key reading and pairing results for IDs. Read November 26, 2026.
No SDK session was run for this page. Every option name, tool name and version floor is transcribed from that page.
Common questions
Why do I see no todo tool calls in my Agent SDK session?
The task tools are on by default only on Claude Opus 4.7, Sonnet 4.6, Haiku 4.5 and earlier models. On every other model, including model IDs Claude Code does not recognize, opt in by naming a tool in allowedTools, listing the tools in the tools option, or setting CLAUDE_CODE_ENABLE_TODO_TOOLS=1 in env.
What replaced TodoWrite in the Agent SDK?
Claude Code provides the four Task tools, TaskCreate, TaskGet, TaskUpdate and TaskList. Setting CLAUDE_CODE_ENABLE_TASKS=0 gives TodoWrite instead. The default set applies in Claude Code v2.1.268 and later, which the TypeScript Agent SDK bundles from v0.3.268.
How do I get the ID of a task Claude created?
The TaskCreate input has no ID. Claude Code delivers the tool's structured output on the user message that carries its tool_result, in the tool_use_result field, and the tracker pairs each tool_result with its tool_use by tool_use_id and reads task.id from there.
How does a todo disappear from the list?
Claude deletes a todo it no longer needs by sending a TaskUpdate call with status set to deleted. The other three status values are pending, in_progress and completed.
Is todo activity a system message?
No. Todo activity arrives as tool_use blocks in assistant messages. The task system messages, such as SDKTaskNotificationMessage, report background tasks such as backgrounded commands and subagents instead.
Every session, one window
Omniscio runs several agent sessions side by side in one window, each with its own context and its own diff view. Any model, any harness: Claude Code, Codex, OpenCode, Devin, Pi, and Hermes all supported.