Skip to content

.NET: Python: suggestion - add clear_messages() method to ChatMessageStoreProtocol #1712

@anguzo

Description

@anguzo

Explnation:

The ChatMessageStoreProtocol currently defines methods for adding and listing messages, but lacks a method to clear/delete all messages. This is needed for common use cases like:

  • User-initiated conversation resets
  • Cleaning up test data
  • Implementing privacy/data retention policies
  • Starting fresh conversations in chat applications

Proposed Solution:

Add the following method to ChatMessageStoreProtocol:

async def clear_messages(self) -> None:
    """
    Clear all messages from the message store.
    
    This method should remove all persisted messages, allowing
    the conversation to start fresh.
    """
    ...

Workaround:

Currently using an extended protocol in my codebase:

@runtime_checkable
class ExtendedChatMessageStoreProtocol(ChatMessageStoreProtocol, Protocol):
    async def clear_messages(self) -> None: ...

Metadata

Metadata

Labels

.NETagent memoryRelated to agentic memorypythonv1.0Features being tracked for the version 1.0 GA

Type

Projects

Status

Planned

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions