Skip to content

nodestep.middleware.todolist

TodoListMiddleware, which gives the model a to-do list per thread.

See Built-in middleware.

Middleware

TodoListMiddleware

Give the model a todo list per thread, kept in this instance's memory.

Subclass of Middleware.

The list is not part of the graph state: a state store, history, fork and other processes do not see it. Without a state store, a run without thread_id= gets a generated thread and so an empty list.

Methods

items_for(thread_id)

Return the todo list of a thread.

items_for(thread_id) -> list[TodoItem]

Parameters
thread_idstr
Returns
list[TodoItem]

The stored list itself; changing it changes the thread's todos.

tools()

Return the read_todos and write_todos tools of this instance.

tools() -> tuple[Tool, ...]

Items

TodoItem

TodoItem(*, task, state=TodoItemState.PENDING)

A todo item with its task and state.

Attributes
taskstr
stateTodoItemState

TodoItemState

Progress state of a todo item.

Attributes
PENDING

"pending", the state of a new item.

IN_PROGRESS

"in_progress".

COMPLETED

"completed".

BLOCKED

"blocked".

CANCELLED

"cancelled".

FAILED

"failed".

TodoListSnapshot

TodoListSnapshot(*, items)

The current todo list.

Attributes
itemslist[TodoItem]

Errors

TodoListMiddlewareError

Raised when the todo tools run without a thread id.

Subclass of NodestepError.