Python: feat: Support custom ChatHistory in GroupChatOrchestration#12912
Closed
angangwa wants to merge 3 commits into
Closed
Python: feat: Support custom ChatHistory in GroupChatOrchestration#12912angangwa wants to merge 3 commits into
angangwa wants to merge 3 commits into
Conversation
Author
|
@microsoft-github-policy-service agree company="Microsoft" |
Enable GroupChatOrchestration to accept ChatHistoryReducer instances for context management in multi-agent conversations. - Add GroupChatHistorySyncMessage for history synchronization - Support chat_history parameter in GroupChatManagerActor and GroupChatOrchestration - Implement async/sync handling for reducers with add_message_async - Add 10ms delay to resolve race condition in concurrent message handlers - Maintain backward compatibility with existing ChatHistory usage
4a82a8f to
e562bc1
Compare
Collaborator
Author
|
Hi @moonbox3 , imagine this will take time to triage, but when there:
For context, we have a use-case where the Group Chat makes sequential progress and saves progress in memory for a large task that easily uses up a million token within a few minutes. We are looking for a way to progress - any workarounds appreciated. |
Author
|
Closing as this likely needs a well thought out approach that works for all orchestration patterns. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Motivation and Context
This change addresses Issue #12911 - "Group Chat Orchestration Does Not Expose Chat History for Custom Reducer Integration".
Why is this change required?
Currently,
GroupChatOrchestrationcreates its own internalChatHistoryinstance that cannot be customized or accessed externally. This prevents users from leveragingChatHistoryReducerimplementations (likeChatHistoryTruncationReducerandChatHistorySummarizationReducer) for automatic memory management in group chat scenarios.What problem does it solve?
ChatHistoryimplementations for specific use casesWhat scenario does it contribute to?
ChatHistoryReducersubclassesFixes: #12911
Description
This PR adds support for custom
ChatHistoryinstances inGroupChatOrchestrationwhile maintaining backward compatibility.Welcome any feedback and happy to change approach. First-time contribution!
Example Usage:
Current Understanding of GroupChat Architecture
GroupChatOrchestration works with multiple components:
Currently, the manager creates its own internal ChatHistory that agents can't access directly.
Implementation Approach
High-Level Flow:
ChatHistoryReducer(or regularChatHistory) toGroupChatOrchestrationconstructorGroupChatHistorySyncMessageWhy This Approach:
Issues discovered while trying to build this
add_message_async()to triggerauto_reduce, but regularChatHistoryonly hasadd_message(). Added dynamic method detection to handle both cases.asyncio.gather()for concurrent message handling, causing agents to sometimes read empty caches before history sync completes. Had to add a small delay after sync messages to ensure proper ordering.Testing
Note on future improvements
.invoke()for further analysisContribution Checklist