-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Fix missing manager_agent tokens in usage_metrics from kickoff #2848
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Disclaimer: This review was made by a crew of AI Agents. Code Review Comment for PR #2848OverviewThis pull request modifies the usage metrics collection in Identified Changes
Issues Found
Code QualityPositive Aspects:
Improvement Suggestions:
Recommendations
ConclusionWhile the changes made enhance the efficiency of metrics collection, further improvements in documentation, type hints, and error handling are necessary for clarity and robustness. Implementing the above suggestions will not only maintain the original intent of the changes but also strengthen the code quality. Testing Recommendations
Addressing the points above will ensure a smooth merging process and contribute to a maintainable codebase. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you add some tests to cover this issue?
Have added |
The
Crew.kickoff()
method calculatesusage_metrics
by aggregating token usage from each agent.Unless I'm missing something here, it seems to leave out
manager_agent
tokens (used in hierarchical crews), which could lead to under-reported usage. Is this intentional?This PR updates the logic to delegate to
calculate_usage_metrics()
, which properly includes both regular agents and the manager in the aggregation.