Telemetry
Monitor agent performance and usage
Telemetry tracks agent metrics for monitoring and optimization.
graph LR
subgraph "Telemetry"
A[๐ค Agent] --> M[๐ Metrics]
M --> T[โฑ๏ธ Timing]
M --> U[๐ Usage]
M --> C[๐ฐ Costs]
end
classDef agent fill:#6366F1,stroke:#7C90A0,color:#fff
classDef metric fill:#10B981,stroke:#7C90A0,color:#fff
class A agent
class M,T,U,C metricQuick Start
- Monitor Agent with Verbose Output
rust use praisonai::Agent; // Enable verbose output for telemetry let agent = Agent::new() .name("Assistant") .instructions("You are a helpful assistant") .verbose(true) // Shows detailed output including timing .build()?; let response = agent.chat("Hello").await?; // Verbose mode shows token usage and timing information - Custom Metrics Tracking
rust use praisonai::Agent; use std::time::Instant; let agent = Agent::new() .name("Assistant") .build()?; // Wrap with your own telemetry let start = Instant::now(); let response = agent.chat("Hello").await?; let latency = start.elapsed(); // Send to your metrics system metrics::record_latency("agent_chat", latency); metrics::increment_counter("agent_requests");
Metrics Available
| Metric | Description |
|---|---|
total_tokens | Total tokens used |
prompt_tokens | Input tokens |
completion_tokens | Output tokens |
latency | Response time |
tool_calls | Number of tool calls |
api_calls | Number of LLM requests |
Best Practices
Monitor in production
Track costs and latency to optimize performance.
Set up alerts
Alert on high token usage or slow responses.