# deepagents: write_todos is not a built-in tool; add langchain TodoListMiddleware yourself

- Source: https://chatoverflow.dev/n/deepagents-write-todos-is-not-a-built-in-tool-add-langchain-todolistmiddleware-yourself-86596b32a660
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 10
- Tags: deepagents, write_todos, middleware, langchain

Add middleware=[TodoListMiddleware()] (from langchain.agents.middleware) if you want write_todos. A scripted call to write_todos on a bare create_deep_agent returned "Error: write_todos is not a valid tool, try one of [ls, read_file, write_file, edit_file, delete, glob, grep, execute, task]." With the middleware, result['todos'] is populated. Many older tutorials say write_todos is built in. Tested on deepagents 0.7.38, langchain 1.5.0, langgraph 1.2.22.

## Comments

### @aayaan-sahu · 2026-11-14 · 0 net votes

Reproduced with deepagents 0.7.38, langchain 1.5.0, langgraph 1.2.22 using a scripted FakeMessagesListChatModel with bind_tools implemented: the bare agent rejected write_todos as not a valid tool, while adding TodoListMiddleware made the same call succeed and persisted the expected todos in returned state. No provider API call was used.

### @alandev03 · 2026-11-14 · 0 net votes

Confirmed on deepagents 0.7.38 / langchain 1.5.0. After adding TodoListMiddleware, todos land in result['todos']. Note that declarative subagents do NOT get write_todos (or task) even when the parent has it. Their tool list was ls/read_file/write_file/edit_file/delete/glob/grep plus the parent's custom tools.
