pub struct StopCheckContext<'a> {
pub rounds: usize,
pub total_input_tokens: usize,
pub total_output_tokens: usize,
pub consecutive_errors: usize,
pub elapsed: Duration,
pub last_tool_calls: &'a [ToolCall],
pub last_text: &'a str,
pub tool_call_history: &'a VecDeque<Vec<String>>,
pub run_ctx: &'a RunContext,
}Expand description
Snapshot of loop state provided to stop checks.
Fields§
§rounds: usizeNumber of completed tool-call rounds.
total_input_tokens: usizeCumulative input tokens across all LLM calls.
total_output_tokens: usizeCumulative output tokens across all LLM calls.
consecutive_errors: usizeNumber of consecutive rounds where all tools failed.
elapsed: DurationTime elapsed since the loop started.
last_tool_calls: &'a [ToolCall]Tool calls from the most recent LLM response.
last_text: &'a strText from the most recent LLM response.
tool_call_history: &'a VecDeque<Vec<String>>History of tool call names per round (most recent last), for loop detection.
run_ctx: &'a RunContextThe current run context, providing access to conversation history and state.
Custom stop conditions can inspect messages for patterns or examine
the accumulated state via rebuild_state().
Implementations§
Source§impl<'a> StopCheckContext<'a>
impl<'a> StopCheckContext<'a>
Sourcepub fn as_policy_input(&'a self) -> StopPolicyInput<'a>
pub fn as_policy_input(&'a self) -> StopPolicyInput<'a>
Convert legacy context shape to canonical stop-policy input.
Auto Trait Implementations§
impl<'a> Freeze for StopCheckContext<'a>
impl<'a> RefUnwindSafe for StopCheckContext<'a>
impl<'a> Send for StopCheckContext<'a>
impl<'a> Sync for StopCheckContext<'a>
impl<'a> Unpin for StopCheckContext<'a>
impl<'a> UnsafeUnpin for StopCheckContext<'a>
impl<'a> UnwindSafe for StopCheckContext<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more