Nous.Tools.TodoTools (nous v0.13.3)
View SourceBuilt-in tools for task tracking and progress management.
TodoTools allows AI agents to break down complex tasks, track progress,
and maintain focus on multi-step operations. Todos are automatically
injected into the system prompt when enable_todos: true.
Setup
Enable todos when creating an agent:
agent = Nous.new("lmstudio:qwen3-vl-4b-thinking-mlx",
instructions: "You are a helpful assistant",
enable_todos: true, # Enable todo tracking
tools: [
&TodoTools.add_todo/2,
&TodoTools.update_todo/2,
&TodoTools.complete_todo/2,
&TodoTools.list_todos/2
]
)Initial todos (optional):
{:ok, result} = Nous.run(agent, "Build a REST API",
deps: %{todos: []} # Start with empty todo list
)How It Works
- Todos are stored in
ctx.deps.todos - Tools return
__update_context__to update the todo list - AgentRunner merges updates back into context
- Before each model request, todos are injected into system prompt
- AI sees current progress and can self-organize
Example
# AI receives complex task
{:ok, r1} = Nous.run(agent, "Analyze codebase and create report")
# AI breaks it down:
# - Calls add_todo("Read all source files")
# - Calls add_todo("Analyze dependencies")
# - Calls add_todo("Write report")
# AI starts working:
# - Calls update_todo(id: 1, status: "in_progress")
# - Reads files...
# - Calls complete_todo(id: 1)
# System prompt automatically shows:
# ✅ Completed (1): Read all source files
# ⏳ In Progress (0):
# 📝 Pending (2): Analyze dependencies, Write report
Summary
Functions
Add a new todo item.
Mark a todo as completed.
Delete a todo item.
List all todos with optional filtering.
Update an existing todo item.
Functions
Add a new todo item.
Arguments
- text: The todo description (required)
- status: Initial status - "pending", "in_progress", or "completed" (default: "pending")
- priority: Priority level - "low", "medium", "high" (default: "medium")
Returns
- success: true/false
- todo: The created todo item
- todos: Updated full todo list
- update_context: Context updates for AgentRunner
Mark a todo as completed.
Arguments
- id: Todo ID (required)
Returns
- success: true/false
- todo: The completed todo item
- todos: Updated full todo list
- update_context: Context updates for AgentRunner
Delete a todo item.
Arguments
- id: Todo ID (required)
Returns
- success: true/false
- todos: Updated full todo list
- update_context: Context updates for AgentRunner
List all todos with optional filtering.
Arguments
- status: Filter by status - "pending", "in_progress", "completed" (optional)
- priority: Filter by priority - "low", "medium", "high" (optional)
Returns
- success: true
- todos: Filtered todo list
- total: Total number of todos
- by_status: Count by status
Update an existing todo item.
Arguments
- id: Todo ID (required)
- text: New text (optional)
- status: New status - "pending", "in_progress", "completed" (optional)
- priority: New priority - "low", "medium", "high" (optional)
Returns
- success: true/false
- todo: The updated todo item
- todos: Updated full todo list
- update_context: Context updates for AgentRunner