Skip to content

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

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
Contributor

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
Contributor

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
Contributor

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
Contributor

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
Contributor

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