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
Source§fn clone(&self) -> UsageSummary
fn clone(&self) -> UsageSummary
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more