跳至正文
OpenAgentSkill
浏览已开放 · 目录记录日期 2026-11-21 · 自动更新和账户服务暂时关闭。
搜索与研究

deepagents-planning-todos

Use the write_todos tool effectively for task planning and decomposition in Deep Agents. Use when users want to (1) implement task planning with write_todos, (2) break down complex tasks into subtasks, (3) track agent progress through todos, (4) debug why todos aren't completing, (5) design todo structures for different task types (research, coding, analysis), (6) understand todo status lifecycle and best practices, or (7) visualize todo progression from LangSmith traces.

soba-labs · 已有 AI 审核记录

安装与使用

运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。

npx skills add soba-labs/langchain-agent-skills --skill deepagents-planning-todos

技能说明


name: deepagents-planning-todos description: Use the write_todos tool effectively for task planning and decomposition in Deep Agents. Use when users want to (1) implement task planning with write_todos, (2) break down complex tasks into subtasks, (3) track agent progress through todos, (4) debug why todos aren't completing, (5) design todo structures for different task types (research, coding, analysis), (6) understand todo status lifecycle and best practices, or (7) visualize todo progression from LangSmith traces.

Deep Agents Planning and Todos

Master the write_todos tool for effective task planning and decomposition in Deep Agents.

Use This Skill When

  • You need to break down complex multi-step tasks (3+ steps) into trackable subtasks.
  • You want to show users the plan before executing (user approval workflow).
  • You're debugging why todos aren't completing as expected.
  • You need patterns for different task types (research, coding, analysis, document processing).
  • You want to visualize todo progression from LangSmith traces.

When To Use write_todos

Use write_todosExecute 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.

Quick Start

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"}
    ]
  }
}

Todo Structure and API

Two-Field Structure

{
  "content": "Task description (clear, actionable)",
  "status": "pending" | "in_progress" | "completed"
}

Key Constraints

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

Tooling Note

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.

Status Lifecycle

pending → in_progress → completed

Best practices:

  1. Create todos with "status": "pending" for newly planned work.
  2. Update to "in_progress" when starting work on a todo.
  3. Mark "completed" when finished (don't delete - keeps context).
  4. For interactive workflows, ask user approval ("Does this plan look good?") before starting execution.

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"}
])

Todo Patterns By Task Type

Quick Reference

Task TypePatternExample Todos
Researchgather → synthesize → reportSearch docs, Read examples, Analyze patterns, Synthesize findings
Codingdesign → implement → testDesign API, Implement endpoints, Write tests, Test end-to-end
Analysiscollect → process → analyzeCollect data, Process traces, Analyze patterns, Visualize results
Document Processingread → extract → transformRead files, Extract key info, Transform format, Output result

For detailed patterns with code examples, see references/todo-patterns.md.

Best Practices

✅ DO

  • Granularity: Keep lists to 3-6 items max (clear milestones, not micro-tasks).
  • Naming: Use clear, action-oriented descriptions ("Search for X", "Analyze Y").
  • User interaction: Always ask approval before executing plan.
  • Status updates: Update promptly as items complete (don't skip status transitions).
  • Context management: Use with filesystem tools for complex workflows.

⚠️ DON'T

  • Over-fragment: Avoid 10+ todos (too granular, hard to track).
  • Vague descriptions: "Do research" → "Search LangChain docs for Deep Agents overview".
  • Skip approval: Don't start executing without user confirmation.
  • Forget updates: Always update status when transitioning tasks.
  • Drop existing context: Include existing active items when rewriting todos.

Troubleshooting

Todo Not Completing

**Sym

阅读完整来源 ↗