pub struct UtilityContext {
pub tool_calls_this_turn: usize,
pub tokens_consumed: usize,
pub token_budget: usize,
pub user_requested: bool,
pub mandated_retry: bool,
}Expand description
Context required to compute utility — provided by the agent loop.
Fields§
§tool_calls_this_turn: usizeNumber of tool calls already dispatched in the current LLM turn.
tokens_consumed: usizeTokens consumed so far in this turn.
token_budget: usizeToken budget for the current turn. 0 = budget unknown (cost component treated as 0).
user_requested: boolTrue when the user explicitly requested tool invocation — either via a /tool slash
command or when the user message contains an unambiguous tool-invocation phrase detected
by has_explicit_tool_request. Must NOT be set from LLM call content or tool outputs.
mandated_retry: boolTrue when this exact call is the mandated retry the Retrieve rule itself asked for:
the same (tool_id, params) call was vetoed by rule 8 earlier this turn, and the
injected system hint explicitly instructed the LLM to call it again with the same
arguments. Set via UtilityScorer::take_mandated_retry.
When true, recommend_action must not re-veto the retry through the redundancy
(Respond) rule — doing so fabricates a rejection despite the model correctly
complying with the gate’s own hint, stalling tools like find_path/list_directory
in a doomed Retrieve-then-redundant-Respond cycle (#5719).
Trait Implementations§
Source§impl Clone for UtilityContext
impl Clone for UtilityContext
Source§fn clone(&self) -> UtilityContext
fn clone(&self) -> UtilityContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for UtilityContext
impl RefUnwindSafe for UtilityContext
impl Send for UtilityContext
impl Sync for UtilityContext
impl Unpin for UtilityContext
impl UnsafeUnpin for UtilityContext
impl UnwindSafe for UtilityContext
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request