Agent Metrics • Rust AI Agent SDK
AgentMetrics: Agent metrics for reporting.
AgentMetrics
Defined in the protocols module.
Rust AI Agent SDK
Agent metrics for reporting.
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#8B0000', 'primaryTextColor': '#fff', 'primaryBorderColor': '#710101', 'lineColor': '#189AB4', 'secondaryColor': '#189AB4', 'tertiaryColor': '#fff' }}}%%
graph LR
input["Input Data"] --> agent["Agent: AgentMetrics"]
agent --> output["Output Result"]
style agent fill:#8B0000,color:#fff
style input fill:#8B0000,color:#fff
style output fill:#8B0000,color:#fffFields
| Name | Type | Description |
|---|---|---|
requests | u64 | Number of requests processed |
errors | u64 | Number of errors |
avg_response_time_ms | f64 | Average response time in ms |
tokens_used | u64 | Token usage |
custom | HashMap<String | Custom metrics |
Methods
new
fn new() -> SelfCreate new metrics
custom
fn custom(mut self, key: impl Into<String>, value: f64) -> SelfAdd a custom metric
Parameters:
| Name | Type |
|---|---|
key | impl Into<String> |
value | f64 |
Source
View on GitHubpraisonai/src/protocols/mod.rs at line 321