pub struct TodoLoopContext {
pub session_id: String,
pub items: Vec<TodoLoopItem>,
pub active_item_id: Option<String>,
pub current_round: u32,
pub max_rounds: u32,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
pub version: u64,
}Expand description
TodoList context for Agent Loop
Acts as a first-class citizen in the agent loop, tracking task progress throughout the entire conversation lifecycle.
Fields§
§session_id: StringSession ID
items: Vec<TodoLoopItem>Todo items with execution tracking
active_item_id: Option<String>Currently active todo item ID
current_round: u32Current round number
max_rounds: u32Maximum rounds allowed
created_at: DateTime<Utc>Creation timestamp
updated_at: DateTime<Utc>Last update timestamp
version: u64Version number for conflict detection
Implementations§
Source§impl TodoLoopContext
impl TodoLoopContext
Sourcepub fn from_session(session: &Session) -> Option<Self>
pub fn from_session(session: &Session) -> Option<Self>
Create TodoLoopContext from Session’s TodoList
Sourcepub fn track_tool_execution(
&mut self,
tool_name: &str,
result: &ToolResult,
round: u32,
)
pub fn track_tool_execution( &mut self, tool_name: &str, result: &ToolResult, round: u32, )
Track tool execution
Records a tool call and associates it with the active todo item.
Sourcepub fn set_active_item(&mut self, item_id: &str)
pub fn set_active_item(&mut self, item_id: &str)
Set active todo item
Marks the previous active item as completed and activates a new item.
Sourcepub fn update_item_status(&mut self, item_id: &str, status: TodoItemStatus)
pub fn update_item_status(&mut self, item_id: &str, status: TodoItemStatus)
Update item status manually
Sourcepub fn is_all_completed(&self) -> bool
pub fn is_all_completed(&self) -> bool
Check if all items are completed
Sourcepub fn format_for_prompt(&self) -> String
pub fn format_for_prompt(&self) -> String
Generate context for prompt injection
Sourcepub fn into_todo_list(self) -> TodoList
pub fn into_todo_list(self) -> TodoList
Convert back to TodoList for persistence
Sourcepub fn auto_match_tool_to_item(&mut self, tool_name: &str)
pub fn auto_match_tool_to_item(&mut self, tool_name: &str)
Auto-match tool to todo item based on keywords
Sourcepub fn auto_update_status(&mut self, tool_name: &str, result: &ToolResult)
pub fn auto_update_status(&mut self, tool_name: &str, result: &ToolResult)
Auto-update status based on tool execution result
Trait Implementations§
Source§impl Clone for TodoLoopContext
impl Clone for TodoLoopContext
Source§fn clone(&self) -> TodoLoopContext
fn clone(&self) -> TodoLoopContext
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more