pub struct UsageSummary {
pub model_requests: u32,
pub reported_model_requests: u32,
pub input_tokens: u64,
pub output_tokens: u64,
pub cached_input_tokens: Option<u64>,
pub reasoning_output_tokens: Option<u64>,
pub peak_input_tokens: u64,
pub credits: Option<u64>,
pub tool_calls: u32,
pub window_truncations: u32,
pub trimmed_messages: u64,
}Expand description
Aggregated model and tool usage for one Agent run.
Fields§
§model_requests: u32Model requests attempted by Runtime.
reported_model_requests: u32Requests whose provider returned token accounting.
input_tokens: u64Aggregated input tokens.
output_tokens: u64Aggregated output tokens.
cached_input_tokens: Option<u64>Aggregated cached input tokens when any provider reported them.
reasoning_output_tokens: Option<u64>Aggregated reasoning output tokens when any provider reported them.
peak_input_tokens: u64Largest single-request input observed or estimated during the run.
credits: Option<u64>Aggregated provider-normalized billable credits when reported.
tool_calls: u32Tool calls requested by models.
window_truncations: u32Number of prompt-window truncations across the main loop and derived workflows.
trimmed_messages: u64Number of prompt messages removed by window truncation.
Implementations§
Source§impl UsageSummary
impl UsageSummary
Sourcepub fn record_model_attempt(&mut self)
pub fn record_model_attempt(&mut self)
Records that Runtime attempted one provider request.
Sourcepub fn record_usage(&mut self, usage: TokenUsage, reported: bool)
pub fn record_usage(&mut self, usage: TokenUsage, reported: bool)
Records normalized usage without incrementing the already-recorded attempt count.
Sourcepub fn record_model_request(&mut self, usage: Option<TokenUsage>)
pub fn record_model_request(&mut self, usage: Option<TokenUsage>)
Records one completed model request while preserving missing telemetry.
Sourcepub fn record_window_truncation(&mut self, removed_messages: usize)
pub fn record_window_truncation(&mut self, removed_messages: usize)
Records one deterministic prompt-history truncation.
Trait Implementations§
Source§impl Clone for UsageSummary
impl Clone for UsageSummary
impl Copy for UsageSummary
Source§impl Debug for UsageSummary
impl Debug for UsageSummary
Source§impl Default for UsageSummary
impl Default for UsageSummary
Source§impl<'de> Deserialize<'de> for UsageSummary
impl<'de> Deserialize<'de> for UsageSummary
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for UsageSummary
Source§impl PartialEq for UsageSummary
impl PartialEq for UsageSummary
Source§impl Serialize for UsageSummary
impl Serialize for UsageSummary
impl StructuralPartialEq for UsageSummary
Auto Trait Implementations§
impl Freeze for UsageSummary
impl RefUnwindSafe for UsageSummary
impl Send for UsageSummary
impl Sync for UsageSummary
impl Unpin for UsageSummary
impl UnsafeUnpin for UsageSummary
impl UnwindSafe for UsageSummary
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.