From deepagents-skills
Guides write_todos tool usage for task planning, decomposition into subtasks, progress tracking, debugging, and visualization in Deep Agents.
npx claudepluginhub lubu-labs/langchain-agent-skills --plugin langgraph-skillsThis skill uses the workspace's default tool permissions.
Master the `write_todos` tool for effective task planning and decomposition in Deep Agents.
Guides Next.js Cache Components and Partial Prerendering (PPR) with cacheComponents enabled. Implements 'use cache', cacheLife(), cacheTag(), revalidateTag(), static/dynamic optimization, and cache debugging.
Guides building MCP servers enabling LLMs to interact with external services via tools. Covers best practices, TypeScript/Node (MCP SDK), Python (FastMCP).
Generates original PNG/PDF visual art via design philosophy manifestos for posters, graphics, and static designs on user request.
Master the write_todos tool for effective task planning and decomposition in Deep Agents.
| Use write_todos | Execute Directly |
|---|---|
| ✅ Complex multi-step tasks (3-6 steps) | ✅ Simple 1-2 step queries |
| ✅ Tasks requiring user approval first | ✅ Single tool calls |
| ✅ Long-running workflows needing progress tracking | ✅ Quick information lookups |
| ✅ Tasks where planning adds clarity | ✅ Straightforward API calls |
Decision rule: If you'd benefit from showing the user "Here's my plan..." before starting, use write_todos.
from deepagents import create_deep_agent
# TodoListMiddleware is included by default in create_deep_agent
agent = create_deep_agent(
model="anthropic:claude-sonnet-4-5-20250929",
tools=[search_tool, summarize_tool],
system_prompt="You are a research assistant. Use write_todos for multi-step tasks."
)
# Agent workflow:
# 1. Call write_todos with initial plan
# 2. Ask user: "Does this plan look good?"
# 3. User approves → start executing
# 4. Update the todo list as work progresses
# 5. Keep todos aligned with the current plan and execution state
Example todo creation:
# Agent calls write_todos internally:
{
"name": "write_todos",
"arguments": {
"todos": [
{"content": "Search for papers on LLM agents", "status": "pending"},
{"content": "Read and extract findings from top 5 papers", "status": "pending"},
{"content": "Identify common themes", "status": "pending"},
{"content": "Write summary report", "status": "pending"}
]
}
}
{
"content": "Task description (clear, actionable)",
"status": "pending" | "in_progress" | "completed"
}
Full-list updates: Treat each write_todos call as a full state update and include all active todos.
Per-turn discipline: Prefer one write_todos update per model turn to avoid conflicting plan changes.
Best granularity: Keep lists to 3-6 items maximum (avoid over-fragmentation).
Deep Agents documentation describes write_todos as the built-in interface for todo planning/tracking.
Keep todo state accurate by rewriting the list with updated statuses as execution progresses.
pending → in_progress → completed
Best practices:
"status": "pending" for newly planned work."in_progress" when starting work on a todo."completed" when finished (don't delete - keeps context).Typical workflow:
# Step 1: Create initial plan (all pending)
write_todos([
{"content": "Research topic", "status": "pending"},
{"content": "Write summary", "status": "pending"}
])
# Step 2: Ask user approval
# User: "Yes, proceed"
# Step 3: Start first task
write_todos([
{"content": "Research topic", "status": "in_progress"},
{"content": "Write summary", "status": "pending"}
])
# Step 4: Complete first task, start second
write_todos([
{"content": "Research topic", "status": "completed"},
{"content": "Write summary", "status": "in_progress"}
])
# Step 5: Finish all tasks
write_todos([
{"content": "Research topic", "status": "completed"},
{"content": "Write summary", "status": "completed"}
])
| Task Type | Pattern | Example Todos |
|---|---|---|
| Research | gather → synthesize → report | Search docs, Read examples, Analyze patterns, Synthesize findings |
| Coding | design → implement → test | Design API, Implement endpoints, Write tests, Test end-to-end |
| Analysis | collect → process → analyze | Collect data, Process traces, Analyze patterns, Visualize results |
| Document Processing | read → extract → transform | Read files, Extract key info, Transform format, Output result |
For detailed patterns with code examples, see references/todo-patterns.md.
Symptom: Todo stuck in in_progress, agent loops or gets confused.
Causes & fixes:
Symptom: Agent creates todos but doesn't follow them.
Causes & fixes:
Symptom: 10+ todos, hard to track, agent overwhelmed.
Causes & fixes:
references/todo-patterns.md).Symptom: Agent loses track of what's been done.
Causes & fixes:
FilesystemBackend or StoreBackend for long sessions.write_todos whenever status changes or scope shifts.MemoryMiddleware for long-term context.Use the included script to parse LangSmith traces and visualize todo progression:
# Export trace from LangSmith (download JSON)
# Then run:
uv run skills/deepagents-planning-todos/scripts/visualize_todos.py trace.json
# Show Mermaid diagram:
uv run skills/deepagents-planning-todos/scripts/visualize_todos.py trace.json --format mermaid
# Show full timeline:
uv run skills/deepagents-planning-todos/scripts/visualize_todos.py trace.json --show-timeline
Output example:
Todo Timeline for trace abc123:
Initial Plan (Step 1):
⏳ [pending] Search for papers on LLM agents
⏳ [pending] Read and extract findings
⏳ [pending] Identify common themes
⏳ [pending] Write summary report
Final State:
✅ [completed] Search for papers on LLM agents
✅ [completed] Read and extract findings
✅ [completed] Identify common themes
✅ [completed] Write summary report
References (detailed patterns):
references/todo-patterns.md: Task-specific patterns with code examplesExamples (working code):
assets/examples/todo-driven-agent/: Research agent demonstrating full workflowExample structures (templates):
assets/todo-structures/research-todos.json: Research task breakdownassets/todo-structures/coding-todos.json: Coding task breakdownExternal docs: