pub struct TaskLoopContext {
pub session_id: String,
pub items: Vec<TaskLoopItem>,
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,
pub task_list_dirty: bool,
}Expand description
TaskList 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<TaskLoopItem>Task items with execution tracking
active_item_id: Option<String>Currently active task 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
task_list_dirty: boolSet when the Task tool structurally rewrites the list, cleared once an
evaluation has been spawned for that change. This is the single signal that
gates async task evaluation to actual Task-tool writes, instead of firing
every round of tool activity (which bumps version without changing the plan).
Implementations§
Source§impl TaskLoopContext
impl TaskLoopContext
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 task 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
Source§impl TaskLoopContext
impl TaskLoopContext
Sourcepub fn from_session(session: &Session) -> Option<Self>
pub fn from_session(session: &Session) -> Option<Self>
Create TaskLoopContext from the session’s task list.
Sourcepub fn to_task_list_with_title(&self, title: impl Into<String>) -> TaskList
pub fn to_task_list_with_title(&self, title: impl Into<String>) -> TaskList
Clone into a TaskList, preserving the provided title.
Sourcepub fn into_task_list(self) -> TaskList
pub fn into_task_list(self) -> TaskList
Convert back to TaskList for persistence.
Sourcepub fn into_task_list_with_title(self, title: impl Into<String>) -> TaskList
pub fn into_task_list_with_title(self, title: impl Into<String>) -> TaskList
Convert back to TaskList for persistence with an explicit title.
Source§impl TaskLoopContext
impl TaskLoopContext
Sourcepub fn format_for_prompt(&self) -> String
pub fn format_for_prompt(&self) -> String
Generate context for prompt injection
Source§impl TaskLoopContext
impl TaskLoopContext
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 task item.
Sourcepub fn set_active_item(&mut self, item_id: &str)
pub fn set_active_item(&mut self, item_id: &str)
Set active task item
Moves the previous active item back to pending and activates a new item.
Sourcepub fn update_item_status(&mut self, item_id: &str, status: TaskItemStatus)
pub fn update_item_status(&mut self, item_id: &str, status: TaskItemStatus)
Update item status manually
Sourcepub fn apply_evaluated_update(
&mut self,
item_id: &str,
status: TaskItemStatus,
notes: Option<&str>,
evidence: Option<&str>,
blocker: Option<&str>,
) -> bool
pub fn apply_evaluated_update( &mut self, item_id: &str, status: TaskItemStatus, notes: Option<&str>, evidence: Option<&str>, blocker: Option<&str>, ) -> bool
Apply an evaluated task update and report whether it changed the context.
pub fn append_structured_feedback( &mut self, item_id: &str, evidence: Option<&str>, blocker: Option<&str>, )
Source§impl TaskLoopContext
impl TaskLoopContext
Sourcepub fn is_all_completed(&self) -> bool
pub fn is_all_completed(&self) -> bool
Check if all items are completed
Trait Implementations§
Source§impl Clone for TaskLoopContext
impl Clone for TaskLoopContext
Source§fn clone(&self) -> TaskLoopContext
fn clone(&self) -> TaskLoopContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more