feat: 2602 agent workflow metrics 2 #3491
Open
+905
−17
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds workflow metrics tracking to the agent system to monitor performance and usage patterns. The implementation
tracks step execution, workflow completion times, and tool usage with proper telemetry integration.
The metrics provide visibility into agent behavior and can be queried using the telemetry system. Tool names are
normalized for consistency (knowledge_search becomes rag).
Closes #2602
Test Plan
Integration Test:
LLAMA_STACK_CONFIG="http://localhost:8321" python -m pytest tests/integration/agents/test_agent_metrics_integratio n.py::TestAgentMetricsIntegration::test_agent_metrics_end_to_end -v
validating:
Verifies metrics are properly collected and queryable, building on query functionality from #3074.
Please Note: Most of the code was reviewed in #2993 but we wanted to test the metrics using query_metrics from #3074 and I was focusing more on higher priory items. So I created this PR for easier reviews as commits were many and was not easy to follow.