pub struct SubAgentMetrics {
pub total_llm_calls: u32,
pub total_tool_calls: u32,
pub total_input_tokens: u64,
pub total_output_tokens: u64,
pub total_llm_elapsed_ms: u64,
pub total_tool_elapsed_ms: u64,
pub llm_elapsed_ms_per_call: Vec<u64>,
}Expand description
子 Agent(SubAgent / Teammate)的 metrics 累加器
每个子 Agent loop 内部累加,Main agent loop 结束时读取并合并到 SessionMetrics。
使用 Arc<Mutex<SubAgentMetrics>> 实现多 Agent 并发安全写入。
Fields§
§total_llm_calls: u32LLM API 调用次数
total_tool_calls: u32工具调用次数
total_input_tokens: u64输入 token 总数
total_output_tokens: u64输出 token 总数
total_llm_elapsed_ms: u64LLM 调用总耗时(毫秒)
total_tool_elapsed_ms: u64工具执行总耗时(毫秒)
llm_elapsed_ms_per_call: Vec<u64>每次非流式 LLM 调用的耗时(等同于整次调用耗时,非流式无 TTFT 概念)
Trait Implementations§
Source§impl Clone for SubAgentMetrics
impl Clone for SubAgentMetrics
Source§fn clone(&self) -> SubAgentMetrics
fn clone(&self) -> SubAgentMetrics
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SubAgentMetrics
impl Debug for SubAgentMetrics
Source§impl Default for SubAgentMetrics
impl Default for SubAgentMetrics
Source§fn default() -> SubAgentMetrics
fn default() -> SubAgentMetrics
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for SubAgentMetrics
impl<'de> Deserialize<'de> for SubAgentMetrics
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for SubAgentMetrics
impl RefUnwindSafe for SubAgentMetrics
impl Send for SubAgentMetrics
impl Sync for SubAgentMetrics
impl Unpin for SubAgentMetrics
impl UnsafeUnpin for SubAgentMetrics
impl UnwindSafe for SubAgentMetrics
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.