Telemetry
Monitor agent performance and usage
Telemetry tracks agent metrics for monitoring and optimization.
Quick 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.