AsyncConversationStore#

Module: agent_framework.conversation

class agent_framework.conversation.AsyncConversationStore(*args, **kwargs)[source]#

Bases: Protocol

Async conversation persistence protocol.

Use for stores that perform I/O (Redis, database). Mirrors ConversationStore with async def methods.

async create(messages, *, metadata=None)[source]#

Create a new conversation and return its id.

Parameters:
  • messages (Sequence[dict[str, Any]])

  • metadata (dict[str, Any] | None)

Return type:

str

async get_messages(conversation_id)[source]#

Return all messages for a conversation.

Raises:

ConversationNotFoundError – If the id is unknown.

Parameters:

conversation_id (str)

Return type:

list[dict[str, Any]]

async append(conversation_id, messages)[source]#

Append messages to an existing conversation.

Raises:

ConversationNotFoundError – If the id is unknown.

Parameters:
  • conversation_id (str)

  • messages (Sequence[dict[str, Any]])

Return type:

None

async get_metadata(conversation_id)[source]#

Return the metadata dict for a conversation.

Raises:

ConversationNotFoundError – If the id is unknown.

Parameters:

conversation_id (str)

Return type:

dict[str, Any]

async delete(conversation_id)[source]#

Delete a conversation. No-op if the id is unknown.

Parameters:

conversation_id (str)

Return type:

None