Events

todo

{ type: "todo", todos }

The plan changed. It arrives whenever todo_write runs, with the whole list — never a change to apply.

the whole list3 statusesone in_progress
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

Fields

{
  type: "todo",
  todos: [
    { content: "Read the four notes",      status: "completed" },
    { content: "List what is unfinished",  status: "in_progress" },
    { content: "Suggest an order",         status: "pending" }
  ]
}
{
    "type": "todo",
    "todos": [
        {"content": "Read the four notes",     "status": "completed"},
        {"content": "List what is unfinished", "status": "in_progress"},
        {"content": "Suggest an order",        "status": "pending"},
    ],
}
contentstring

The step, in the agent's own words.

statusstring

pending · in_progress · completed. Anything else becomes pending.

Replace, never merge

The list is sent whole each time

The tool takes the complete list and the event carries the complete list. Treat it as a replacement: trying to reconcile it with what you held will drift the moment the agent reorders or rewords a step.

let plan = [];

onEvent: (e) => {
  if (e.type === "todo") { plan = e.todos; render(plan); }
};
plan = []

def on_event(event):
    global plan
    if event["type"] == "todo":
        plan = event["todos"]
        render(plan)

Exactly one in progress

The agent is instructed to keep one item in_progress and to mark items completed as it goes. An interface can rely on that for a « current step » line, while tolerating a moment with none — between finishing one and starting the next.

When a plan exists at all

The agent is told to write one for a task of five or more steps, and not to write one below that — a two-line list costs a turn and helps no one. So a short task legitimately emits no todo at all.

It survives the run

The final list is on result.todos and on the done event. In a session it is kept, so reopening brings the plan back.

A subagent's events arrive here too

They carry parentId — the identifier of the task call that started them — and agent, its name. Their own id is prefixed with the task's, so two runs never collide. Test parentId before treating an event as the main run's.