feat: Add MessageStore base class abstraction for message threads#7570
Open
Ricardo-M-L wants to merge 1 commit intomicrosoft:mainfrom
Open
feat: Add MessageStore base class abstraction for message threads#7570Ricardo-M-L wants to merge 1 commit intomicrosoft:mainfrom
Ricardo-M-L wants to merge 1 commit intomicrosoft:mainfrom
Conversation
Add a simple storage abstraction for message_thread in teams, with TTL policy support as a parameter for message expiration. - MessageStore abstract base class with standard CRUD operations (add, get, clear) plus save_state/load_state for persistence - InMemoryMessageStore concrete implementation (default, backwards compatible) with optional TTL-based message expiration - Integration into BaseGroupChatManager and all team implementations (RoundRobin, Selector, Swarm, MagenticOne, GraphFlow) - Configurable message store via team constructor parameter - Comprehensive test suite with 20 test cases Fixes microsoft#6227
Contributor
|
@Ricardo-M-L please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
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.
Summary
Adds a storage abstraction for
message_threadin teams, as proposed in #6227.MessageStoreabstract base class with standard async CRUD operations (add_messages,get_messages,clear) plussave_state/load_statefor persistenceInMemoryMessageStoreconcrete implementation — the default, fully backwards-compatible backend with optional TTL (time-to-live) based message expirationBaseGroupChatManagerand all team implementations (RoundRobin, Selector, Swarm, MagenticOne, GraphFlow) via an optionalmessage_storeconstructor parameter_message_threadremains accessible as a property that delegates to the underlying store; existing subclass code continues to work without changesKey design decisions
MessageStore(ttl=300)enables 5-minute message expiration;None(default) means no expirymessage_storeis provided, anInMemoryMessageStoreis created automatically, preserving identical behavior to the previousList-based storageMessageStoresubclasses (e.g., Redis, database-backed) by implementing 5 abstract methodsFixes #6227
Test plan
pytest python/packages/autogen-agentchat/tests/test_message_store.py— 20 test cases for MessageStore abstractionInMemoryMessageStorewith TTL correctly prunes expired messages🤖 Generated with Claude Code