Skip to main content
These data types are the atomic building blocks of the MemMachine SDK. They define how individual events (Episode) are recorded and how memory instances are securely isolated for different conversations (MemoryContext).

ContentType (Enum)

class ContentType(Enum)
This enumeration specifies the format of the data stored within an Episode’s content field.
MemberValueDescription
STRING"string"The content is a standard text string.
This design allows for future expansion to support other data formats like vector embeddings or image metadata without changing the core episode structure.

Episode Objects

@dataclass(kw_only=True)
class Episode
An Episode represents a single, atomic event or piece of data in the memory system (e.g., a user message, an agent’s internal thought). The use of @dataclass(kw_only=True) means all fields must be specified using keyword arguments when you create an Episode instance.
FieldTypeDescription
uuidUUIDA unique identifier for this specific episode.
episode_typestrThe category of event (e.g., 'message', 'thought', 'action').
content_typeContentTypeThe type of the data stored in the content field.
contentAnyThe actual data of the episode.
timestampdatetimeThe date and time when the episode occurred.
group_idstrIdentifier for the larger conversation group.
session_idstrIdentifier for the specific session this episode belongs to.
producer_idstrThe ID of the user or agent that created this episode.
produced_for_id`strNone`The ID of the intended recipient, if any.
user_metadata`JSONValueNone`A dictionary for any additional, custom metadata in a JSON-compatible format.

MemoryContext Objects

@dataclass
class MemoryContext
The MemoryContext is used by the EpisodicMemoryManager to define the unique identifier for a memory instance. It ensures that memory access is isolated to the correct conversation.
FieldTypeDescription
group_idstrThe identifier for the group context.
agent_idset[str]A set of agent identifiers for the context.
user_idset[str]A set of user identifiers for the context.
session_idstrThe identifier for the session context.

Special Behavior for Isolation

The MemoryContext implements custom equality (__eq__) and hashing (__hash__) methods. A memory context is considered equal to another if and only if their group_id and session_id match. This ensures that the manager correctly uses these two fields as the primary lookup key for active memory instances, regardless of how the agent and user sets are structured.

SessionInfo Objects

@dataclass
class SessionInfo
The SessionInfo holds all the persistent metadata about a single conversation session. This is retrieved from the SessionManager when an existing memory instance is opened.
FieldTypeDescription
group_idstrThe identifier for the group conversation.
session_idstrThe unique string identifier for the session.
agent_idslist[str]A list of agent IDs participating in the session.
user_idslist[str]A list of user IDs participating in the session.
configurationdictA dictionary containing any custom configuration for this session.

GroupConfiguration Objects

@dataclass
class GroupConfiguration
The GroupConfiguration holds persistent metadata about a multi-session conversation group.
FieldTypeDescription
group_idstrThe unique identifier for the group.
agent_listlist[str]A list of agent IDs that belong to the group.
user_listlist[str]A list of user IDs that belong to the group.
configurationdictA dictionary containing any custom configuration for the group.