Todo/task planning toolset for pydantic-ai agents
Project description
pydantic-ai-todo
Looking for a complete agent framework? Check out pydantic-deep - a full-featured deep agent framework with planning, subagents, and skills system built on pydantic-ai.
Need file storage or Docker sandbox? Check out pydantic-ai-backend - file storage and sandbox backends that work with any pydantic-ai agent.
Want a full-stack template? Check out fastapi-fullstack - production-ready AI/LLM application template with FastAPI, Next.js, and pydantic-deep integration.
Todo/task planning toolset for pydantic-ai agents.
This library was extracted from pydantic-deep to provide standalone task planning for any pydantic-ai agent without requiring the full framework.
Provides read_todos and write_todos tools that help AI agents track and manage tasks during a session.
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
# Create an agent with todo capabilities
agent = Agent(
"openai:gpt-4.1",
toolsets=[create_todo_toolset()],
)
# Run the agent
result = await agent.run("Create a todo list for building a website")
Usage with Storage Access
If you need to access the todos after the agent runs:
from pydantic_ai import Agent
from pydantic_ai_todo import create_todo_toolset, TodoStorage
# Create storage and toolset
storage = TodoStorage()
toolset = create_todo_toolset(storage=storage)
agent = Agent("openai:gpt-4.1", toolsets=[toolset])
# Run the agent
result = await agent.run("Plan the implementation of a REST API")
# Access todos directly
for todo in storage.todos:
print(f"[{todo.status}] {todo.content}")
Custom Storage
You can implement custom storage (e.g., for persistence):
import json
from pydantic_ai_todo import create_todo_toolset, TodoStorageProtocol, Todo
class RedisTodoStorage:
"""Store todos in Redis."""
def __init__(self, redis_client):
self._redis = redis_client
@property
def todos(self) -> list[Todo]:
data = self._redis.get("todos")
if not data:
return []
return [Todo(**t) for t in json.loads(data)]
@todos.setter
def todos(self, value: list[Todo]) -> None:
self._redis.set("todos", json.dumps([t.model_dump() for t in value]))
# Use with agent
storage = RedisTodoStorage(redis.Redis())
agent = Agent("openai:gpt-4.1", toolsets=[create_todo_toolset(storage)])
System Prompt Integration
Include current todos in the system prompt:
from pydantic_ai_todo import get_todo_system_prompt, TodoStorage
storage = TodoStorage()
# ... agent populates todos ...
# Generate system prompt section with current todos
prompt_section = get_todo_system_prompt(storage)
API Reference
create_todo_toolset(storage=None, *, id=None)
Creates a todo toolset with read_todos and write_todos tools.
Parameters:
storage: OptionalTodoStorageProtocolimplementation. Defaults to in-memoryTodoStorage.id: Optional unique ID for the toolset.
Returns: FunctionToolset[Any]
get_todo_system_prompt(storage=None)
Generates a system prompt section for task management.
Parameters:
storage: Optional storage to read current todos from.
Returns: str - System prompt with optional current todos section.
Todo
Pydantic model for a todo item.
class Todo(BaseModel):
content: str # Task description in imperative form
status: Literal["pending", "in_progress", "completed"]
active_form: str # Present continuous form (e.g., "Implementing...")
TodoStorage
Default in-memory storage implementation.
storage = TodoStorage()
storage.todos = [Todo(...), Todo(...)]
print(storage.todos)
TodoStorageProtocol
Protocol for custom storage implementations. Must have a todos property with getter and setter.
Related Projects
- pydantic-ai - The foundation: Agent framework by Pydantic
- pydantic-deep - Full agent framework (uses this library)
- pydantic-ai-backend - File storage and sandbox backends
- fastapi-fullstack - Full-stack AI app template
License
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.2.tar.gz.
File metadata
- Download URL: pydantic_ai_todo-0.1.2.tar.gz
- Upload date:
- Size: 192.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60e22338c973e86fea15d6d2dfeaa2e091a397257f000daad013ba58c6bb75ba
|
|
| MD5 |
bcba0d091498fd188c53544504011be2
|
|
| BLAKE2b-256 |
d4964218f8bb50f66e246983267bf0348ce217038fdf9bf070ec0a2077961d06
|
Provenance
The following attestation bundles were made for pydantic_ai_todo-0.1.2.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.2.tar.gz -
Subject digest:
60e22338c973e86fea15d6d2dfeaa2e091a397257f000daad013ba58c6bb75ba - Sigstore transparency entry: 832455209
- Sigstore integration time:
-
Permalink:
vstorm-co/pydantic-ai-todo@02fdc65dd86e657feaecb8bc8f330e7fcd2ba7b6 -
Branch / Tag:
refs/tags/0.1.2 - Owner: https://github.com/vstorm-co
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@02fdc65dd86e657feaecb8bc8f330e7fcd2ba7b6 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pydantic_ai_todo-0.1.2-py3-none-any.whl.
File metadata
- Download URL: pydantic_ai_todo-0.1.2-py3-none-any.whl
- Upload date:
- Size: 9.1 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 |
94ea2c5ef24f23eb3db734afb8659d7b60beb9441feadd1a537dafe27d18c070
|
|
| MD5 |
2242435126f1dee9d1be6d19e38449c7
|
|
| BLAKE2b-256 |
c2cd21936e6c91adf2fb269fa2916fec596493ab7e0169489014bcb672b6edcd
|
Provenance
The following attestation bundles were made for pydantic_ai_todo-0.1.2-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.2-py3-none-any.whl -
Subject digest:
94ea2c5ef24f23eb3db734afb8659d7b60beb9441feadd1a537dafe27d18c070 - Sigstore transparency entry: 832455211
- Sigstore integration time:
-
Permalink:
vstorm-co/pydantic-ai-todo@02fdc65dd86e657feaecb8bc8f330e7fcd2ba7b6 -
Branch / Tag:
refs/tags/0.1.2 - Owner: https://github.com/vstorm-co
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@02fdc65dd86e657feaecb8bc8f330e7fcd2ba7b6 -
Trigger Event:
release
-
Statement type: