> ## Documentation Index
> Fetch the complete documentation index at: https://docs.upsonic.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Planning

> Create and manage structured task lists for complex work

## Usage

DeepAgent uses the `write_todos` tool to create and manage structured task lists. The agent automatically uses this tool when tasks require 3+ steps or are non-trivial.

## Tool Signature

```python theme={null}
write_todos(todos: List[Dict[str, Any]]) -> str
```

**Todo Fields:**

* `content`: Description of the task
* `status`: One of `"pending"`, `"in_progress"`, `"completed"`, `"cancelled"`
* `id`: Unique identifier (string)

## Example

```python theme={null}
import asyncio
from upsonic.agent.deepagent import DeepAgent
from upsonic import Task

async def main():
    agent = DeepAgent(model="anthropic/claude-sonnet-4-5")
    
    task = Task(description="""
Create a complete web application with:
- User authentication system
- Product catalog with search
- Shopping cart functionality
- Payment processing

Plan the implementation, then execute all tasks.
Save each component to separate files in /app/ directory.
""")

    result = await agent.do_async(task)
    print(result)
    
    # Check the plan created
    plan = agent.get_current_plan()
    print(f"\nExecution Plan ({len(plan)} tasks):")
    for todo in plan:
        print(f"  [{todo['status']}] {todo['content']}")

asyncio.run(main())
```

## Key Points

* Minimum 2 todos required for initial plan
* Agent must update todos after each task completion
* Todos are stored per task instance
* Use `get_current_plan()` to access todos programmatically
