[BREAKING] Python: Standardize orchestration outputs as list of ChatMessage. Allow agent as group chat manager.#2291
Conversation
…tions to group chat prompt manager
There was a problem hiding this comment.
Pull Request Overview
This PR standardizes orchestration outputs in the Python agent framework to consistently return list[ChatMessage] instead of a single ChatMessage. Previously, group chat and magentic orchestrations returned a single message while other orchestrations (sequential, concurrent, handoff) returned lists, creating inconsistency. The PR also adds the ability to configure ChatOptions for the group chat prompt-based manager, allowing fine-tuned control over LLM parameters like temperature and seed for reproducible manager decisions.
Key changes:
- Group chat and magentic orchestrations now yield the full conversation history as
list[ChatMessage]instead of just the final message - Added
chat_optionsparameter toGroupChatBuilder.set_prompt_based_manager()and_PromptBasedGroupChatManager - Updated all tests and samples to handle the new list output format
Reviewed Changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| python/uv.lock | Version bump for ag-ui package |
| python/samples/semantic-kernel-migration/orchestrations/group_chat.py | Updated to handle both list and single message outputs for migration compatibility |
| python/samples/getting_started/workflows/orchestration/group_chat_with_chat_options.py | New sample demonstrating ChatOptions configuration for prompt-based manager |
| python/samples/getting_started/workflows/orchestration/group_chat_simple_selector.py | Updated to iterate over full conversation list instead of single message |
| python/samples/getting_started/workflows/orchestration/group_chat_prompt_based_manager.py | Updated to display full conversation history instead of single response |
| python/samples/getting_started/workflows/README.md | Added entry for new ChatOptions sample |
| python/packages/core/tests/workflow/test_magentic.py | Updated assertions to expect list output and verify conversation structure |
| python/packages/core/tests/workflow/test_group_chat.py | Updated test expectations for list outputs and added test for chat_options passthrough |
| python/packages/core/agent_framework/_workflows/_magentic.py | Changed output type from ChatMessage to list[ChatMessage], yields full conversation with final answer |
| python/packages/core/agent_framework/_workflows/_group_chat.py | Added chat_options support to prompt manager, changed yield_output to return full conversation list |
python/samples/getting_started/workflows/orchestration/group_chat_with_chat_options.py
Outdated
Show resolved
Hide resolved
python/samples/semantic-kernel-migration/orchestrations/group_chat.py
Outdated
Show resolved
Hide resolved
python/samples/getting_started/workflows/orchestration/group_chat_philosophical_debate.py
Outdated
Show resolved
Hide resolved
eavanvalkenburg
left a comment
There was a problem hiding this comment.
Approved with one small comment on the add_manager method
python/samples/getting_started/workflows/orchestration/group_chat_agent_manager.py
Show resolved
Hide resolved
…essage. Allow agent as group chat manager. (microsoft#2291) * Standardize orchestration outputs as list of chatmessage. Add chat options to group chat prompt manager * refactor group chat * Improve group chat manager * README Update * Cleanup * Add comment * More cleanup * Standardize termination condition for group chat * Improvements on termination logic * Fix tests * Fix new line * PR feedback * Update ChatKit based on OpenAI type change * Raise error if response format is not expected type * Only one starting executor required. Add tests. * Add magentic start executor test
Motivation and Context
Currently there is a divergence in the types returned from some orchestrations - for example, group chat/magentic return a ChatMessage versus others (sequential, concurrent, handoff) return a list[ChatMessage]. To standardize, also to what an agent can return, we're adjusting the output for group chat/magentic to be a list[ChatMessage].
Additionally, for a group chat, when configuring a manager, allow for the use of an Agent or an Executor. The underlying group chat architecture was refactored to allow for the agent / executor manager to actually be a node in the group chat graph in place of the previous PromptManager class.
Caution
This is a breaking change. Will hold this PR until after Ignite.
Description
Closes: #2272, #2228, #2350
Contribution Checklist