Todo/task planning toolset for pydantic-ai agents
Project description
Todo Toolset for Pydantic AI
Task Planning and Tracking for AI Agents
Subtasks & Dependencies — hierarchical task management • PostgreSQL Storage — persistent multi-tenant tasks • Event System — webhooks and callbacks
Todo Toolset for Pydantic AI adds task planning capabilities to any Pydantic AI agent. Your agent can create, track, and complete tasks with full support for subtasks, dependencies, and persistent storage.
Full framework? Check out Pydantic Deep Agents — complete agent framework with planning, filesystem, subagents, and skills.
Use Cases
| What You Want to Build | How Todo Toolset Helps |
|---|---|
| AI Coding Assistant | Break down complex features into trackable tasks |
| Project Manager Bot | Create hierarchical task structures with dependencies |
| Research Agent | Track investigation progress across multiple topics |
| Workflow Automation | React to task completion with webhooks and callbacks |
| Multi-User App | Session-based PostgreSQL storage for each user |
Installation
pip install pydantic-ai-todo
Or with uv:
uv add pydantic-ai-todo
Quick Start
from pydantic_ai import Agent
from pydantic_ai_todo import create_todo_toolset
agent = Agent(
"openai:gpt-4o",
toolsets=[create_todo_toolset()],
)
result = await agent.run("Create a todo list for building a REST API")
That's it. Your agent can now:
- ✅ Create tasks —
add_todo,write_todos - ✅ Track progress —
read_todos,update_todo_status - ✅ Manage hierarchy — subtasks and dependencies
- ✅ Persist state — PostgreSQL multi-tenant storage
Available Tools
| Tool | Description |
|---|---|
read_todos |
List all tasks (supports hierarchical view) |
write_todos |
Bulk write/update tasks |
add_todo |
Add a single task |
update_todo_status |
Update task status by ID |
remove_todo |
Delete task by ID |
add_subtask* |
Create child task |
set_dependency* |
Link tasks with dependency |
get_available_tasks* |
List tasks ready to work on |
*Available when enable_subtasks=True
Storage Backends
In-Memory (Default)
from pydantic_ai_todo import create_todo_toolset, TodoStorage
storage = TodoStorage()
toolset = create_todo_toolset(storage=storage)
# Access todos directly after agent runs
for todo in storage.todos:
print(f"[{todo.status}] {todo.content}")
Async Memory
from pydantic_ai_todo import create_todo_toolset, AsyncMemoryStorage
storage = AsyncMemoryStorage()
toolset = create_todo_toolset(async_storage=storage)
# Async access
todos = await storage.get_todos()
PostgreSQL
from pydantic_ai_todo import create_storage, create_todo_toolset
storage = create_storage(
"postgres",
connection_string="postgresql://user:pass@localhost/db",
session_id="user-123", # Multi-tenancy
)
await storage.initialize()
toolset = create_todo_toolset(async_storage=storage)
Task Hierarchy
Enable subtasks for complex task management:
toolset = create_todo_toolset(
async_storage=storage,
enable_subtasks=True,
)
# Agent can now:
# - add_subtask(parent_id, content) — create child tasks
# - set_dependency(task_id, depends_on_id) — link tasks
# - get_available_tasks() — list tasks ready to work on
Dependencies include automatic cycle detection — no infinite loops possible.
Event System
React to task changes:
from pydantic_ai_todo import TodoEventEmitter, AsyncMemoryStorage
emitter = TodoEventEmitter()
@emitter.on_completed
async def notify_completed(event):
print(f"Task done: {event.todo.content}")
# Send webhook, update UI, etc.
@emitter.on_created
async def notify_created(event):
print(f"New task: {event.todo.content}")
storage = AsyncMemoryStorage(event_emitter=emitter)
toolset = create_todo_toolset(async_storage=storage)
API Reference
Factory Functions
| Function | Description |
|---|---|
create_todo_toolset() |
Create toolset with todo tools |
create_storage(backend, **options) |
Factory for storage backends |
get_todo_system_prompt() |
Generate system prompt with current todos |
Models
| Model | Description |
|---|---|
Todo |
Task with id, content, status, parent_id, depends_on |
TodoItem |
Input model for write_todos |
TodoEvent |
Event data with type, todo, timestamp |
TodoEventType |
CREATED, UPDATED, STATUS_CHANGED, DELETED, COMPLETED |
Storage Classes
| Class | Description |
|---|---|
TodoStorage |
Sync in-memory storage |
AsyncMemoryStorage |
Async in-memory with CRUD |
AsyncPostgresStorage |
PostgreSQL with multi-tenancy |
TodoEventEmitter |
Event emitter for callbacks |
Related Projects
| Package | Description |
|---|---|
| Pydantic Deep Agents | Full agent framework (uses this library) |
| pydantic-ai-backend | File storage and Docker sandbox |
| subagents-pydantic-ai | Multi-agent orchestration |
| summarization-pydantic-ai | Context management |
| pydantic-ai | The foundation — agent framework by Pydantic |
Contributing
git clone https://github.com/vstorm-co/pydantic-ai-todo.git
cd pydantic-ai-todo
make install
make test # 100% coverage required
License
MIT — see LICENSE
Built with ❤️ by vstorm-co
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pydantic_ai_todo-0.1.6.tar.gz.
File metadata
- Download URL: pydantic_ai_todo-0.1.6.tar.gz
- Upload date:
- Size: 94.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d6fcf2b875c13b0a2843a10a37d38a3f1cd9b43266419cf51b39e613d791467b
|
|
| MD5 |
d15e8542d4c9d977b04d8a48c3b7b71b
|
|
| BLAKE2b-256 |
067f3c5463d7b6170d332d917077e821294422e7da1d674546a1e86eda56987c
|
Provenance
The following attestation bundles were made for pydantic_ai_todo-0.1.6.tar.gz:
Publisher:
publish.yml on vstorm-co/pydantic-ai-todo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pydantic_ai_todo-0.1.6.tar.gz -
Subject digest:
d6fcf2b875c13b0a2843a10a37d38a3f1cd9b43266419cf51b39e613d791467b - Sigstore transparency entry: 908480987
- Sigstore integration time:
-
Permalink:
vstorm-co/pydantic-ai-todo@09e0cf15329f7afcc79fd22e8f09959f8c71298c -
Branch / Tag:
refs/tags/0.1.6 - Owner: https://github.com/vstorm-co
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@09e0cf15329f7afcc79fd22e8f09959f8c71298c -
Trigger Event:
release
-
Statement type:
File details
Details for the file pydantic_ai_todo-0.1.6-py3-none-any.whl.
File metadata
- Download URL: pydantic_ai_todo-0.1.6-py3-none-any.whl
- Upload date:
- Size: 19.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8bed7a5ecf27fa957786261f88f01855cb3d2fc112c98fe24c76ec503d93743f
|
|
| MD5 |
f579ed0d059f4222f6208fe7a380230c
|
|
| BLAKE2b-256 |
e6705c059f9af91a84efce962bcb1c7f0506d015fbc242c36cc8def5d4b79d53
|
Provenance
The following attestation bundles were made for pydantic_ai_todo-0.1.6-py3-none-any.whl:
Publisher:
publish.yml on vstorm-co/pydantic-ai-todo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pydantic_ai_todo-0.1.6-py3-none-any.whl -
Subject digest:
8bed7a5ecf27fa957786261f88f01855cb3d2fc112c98fe24c76ec503d93743f - Sigstore transparency entry: 908480989
- Sigstore integration time:
-
Permalink:
vstorm-co/pydantic-ai-todo@09e0cf15329f7afcc79fd22e8f09959f8c71298c -
Branch / Tag:
refs/tags/0.1.6 - Owner: https://github.com/vstorm-co
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@09e0cf15329f7afcc79fd22e8f09959f8c71298c -
Trigger Event:
release
-
Statement type: