# todo

Canonical URL: https://developers.iagenify.com/sdk/agent/events/todo/
Language: en

`{ type: "todo", todos }`

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

Status: the whole list · 3 statuses · one in_progress

## Fields {#fields}

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

| Name | Type | Requirement | Description |
| --- | --- | --- | --- |
| `content` | string |  | The step, in the agent's own words. |
| `status` | string |  | `pending` · `in_progress` · `completed`. Anything else becomes `pending`. |

## Replace, never merge {#replace}

> **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.

```javascript
let plan = [];

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

## Exactly one in progress {#convention}

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 {#when}

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 {#after}

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.

- [todo_write](/sdk/agent/tools/todo-write): The tool that produces it.
- [plan](/sdk/agent/modes/plan): The mode whose output is a plan.

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

```python
plan = []

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