Skip to content

Conversation

@marklysze
Copy link
Collaborator

Why are these changes needed?

Fixed response.cost returning 0 in a group chat by recalculating cost to include ALL agents.

The issue was that initiate_chat() only gathered usage from [last_agent, manager], missing other participating agents.

Added cost recalculation in both initiate_group_chat() and a_initiate_group_chat() using gather_usage_summary() with all agents from the group chat manager's groupchat.agents.

Please note that this does not do nested cost calculations, only the agents associated with the top-level group chat.

Related issue number

N/A

Checks

@joggrbot
Copy link
Contributor

joggrbot bot commented Dec 22, 2025

📝 Documentation Analysis

All docs are up to date! 🎉


✅ Latest commit analyzed: d676781 | Powered by Joggr

@marklysze marklysze changed the title fix: Group chats didn't include costs from all agents fix: Group chats should include costs from all agents Dec 22, 2025
@marklysze marklysze changed the title fix: Group chats should include costs from all agents fix: Group chats to include costs from all agents Dec 22, 2025
@marklysze marklysze requested a review from SirEntropy December 26, 2025 18:57
@priyansh4320 priyansh4320 self-requested a review January 7, 2026 13:59
Copy link
Collaborator

@priyansh4320 priyansh4320 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @marklysze, this is great.

Copy link
Collaborator

@SirEntropy SirEntropy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@priyansh4320 priyansh4320 added this pull request to the merge queue Jan 8, 2026
Merged via the queue into main with commit edb6324 Jan 8, 2026
19 checks passed
@priyansh4320 priyansh4320 deleted the fix/group-chat-cost-tracking-v2 branch January 8, 2026 14:29
@codecov
Copy link

codecov bot commented Jan 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
autogen/agentchat/group/multi_agent_chat.py 39.81% <100.00%> (+8.74%) ⬆️

... and 22 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants