Skip to content

Create a common abstraction for storing message threads in teams #6243

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

Closed
wants to merge 1 commit into from

Conversation

federicovilla55
Copy link
Contributor

Introduce MessageStore abstract base class for storing message thread in teams and MemoryMessageStore a memory (thread-safe) memory implementation of the abstract class that uses a timestamp-based time to live (TTL) to handle message expiration.

To Do to complete this PR:

  • Include such changes in all the group chat teams
  • Add tests for the added classes

Why are these changes needed?

Define correctly and rigorously how messages should be stored and handled in teams.

Related issue number

Closes #6227

Checks

Sorry, something went wrong.

Changes:
- Created a standard interface, `MessageStore`, for all message store implementations
- Created `MemoryMessageStore`, an in-memory implementation of the standard interface, that stores messages in a Python list with timestamps.

@property
@abstractmethod
def ttl(self) -> Optional[float]:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this should be in the concrete class not in the base class, something you can set as part of the constructor.

pass

@abstractmethod
async def add_messages(self, messages: List[BaseChatMessage]) -> None:
Copy link
Collaborator

Choose a reason for hiding this comment

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

It should be BaseChatMessage | BaseAgentEvent to be consistent with how message threads are implemented as list in BaseGroupChatManager.

from ...messages import BaseChatMessage


class MessageStore(ABC):
Copy link
Collaborator

Choose a reason for hiding this comment

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

It should have save_state and load_state methods to be used together with the agent classes.

Also, it should subclass Component to enable serializable component config.

Copy link
Collaborator

Choose a reason for hiding this comment

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

See example in autogen_core.mode_context.ChatCompletionContext.

@ekzhu
Copy link
Collaborator

ekzhu commented Apr 22, 2025

Work is happening in #6350

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.

Add MessageStore base class abstraction for storing message thread in teams
2 participants