Sagents.Todo (Sagents v0.8.0-rc.7)
Copy MarkdownTODO item structure for task tracking.
TODOs help agents break down complex tasks into manageable steps and track progress through multi-step workflows.
Status Values
:pending- Task not yet started:in_progress- Currently being worked on:completed- Task finished successfully:cancelled- Task no longer needed
Usage
# Create a new TODO
{:ok, todo} = Todo.new(%{
content: "Implement user authentication",
status: :pending
})
# Update status
{:ok, updated} = Todo.new(%{
id: todo.id,
content: todo.content,
status: :in_progress
})
Summary
Functions
Create a TODO from a map (for deserialization).
Create a new TODO item with validation.
Create a new TODO item, raising on error.
Convert a TODO struct to a map for serialization.
Types
Functions
Create a TODO from a map (for deserialization).
Examples
map = %{"id" => "123", "content" => "Task", "status" => "pending"}
{:ok, todo} = Todo.from_map(map)
Create a new TODO item with validation.
Generates a unique ID if not provided.
Examples
{:ok, todo} = Todo.new(%{content: "Write tests"})
{:ok, todo} = Todo.new(%{id: "custom-id", content: "Task", status: :completed})
Create a new TODO item, raising on error.
Examples
todo = Todo.new!(%{content: "Deploy to production"})
Convert a TODO struct to a map for serialization.
Examples
todo = Todo.new!(%{content: "Task"})
map = Todo.to_map(todo)
# => %{"id" => "...", "content" => "Task", "status" => "pending"}