Current Behavior: No built-in telemetry for:
Total tokens consumed (input + output)
Cost estimation
Latency breakdown (network, processing, tool calls)
Success/failure rates
Problem: Production applications need to track:
Cost per conversation
Performance bottlenecks
Token usage trends for budgeting
Recommended Changes:
Add Metrics property to AgentRunResponse
Include token counts, latency, and cost estimates
Support custom metric providers
Integrate with OpenTelemetry
Example Desired API:
var result = await agent.RunAsync(prompt);
Console.WriteLine($"Tokens used: {result.Metrics.TotalTokens}");
Console.WriteLine($" Input: {result.Metrics.InputTokens}");
Console.WriteLine($" Output: {result.Metrics.OutputTokens}");
Console.WriteLine($"Estimated cost: ${result.Metrics.EstimatedCost:F4}");
Console.WriteLine($"Latency: {result.Metrics.TotalLatency}ms");
Console.WriteLine($" LLM: {result.Metrics.LlmLatency}ms");
Console.WriteLine($" Tools: {result.Metrics.ToolLatency}ms");
Current Behavior: No built-in telemetry for:
Total tokens consumed (input + output)
Cost estimation
Latency breakdown (network, processing, tool calls)
Success/failure rates
Problem: Production applications need to track:
Cost per conversation
Performance bottlenecks
Token usage trends for budgeting
Recommended Changes:
Add Metrics property to AgentRunResponse
Include token counts, latency, and cost estimates
Support custom metric providers
Integrate with OpenTelemetry
Example Desired API: