Class Memory
Memory interface for managing episodic and profile memory.
This class provides methods for adding, searching, and managing memories
within a specific context (group, agent, user, session).
| Name | Type | Description | ||
|---|---|---|---|---|
client | MemMachineClient | - | ||
org_id | str | - | ||
project_id | str | - | ||
group_id | `str | None` | - | |
agent_id | `str | list[str] | None` | - |
user_id | `str | list[str] | None` | - |
session_id | `str | None` | - |
org_id
Get the org_id (read-only).
| Name | Type | Description |
|---|
project_id
Get the project_id (read-only).
| Name | Type | Description |
|---|
user_id
Get the user_id list (read-only).
| Name | Type | Description |
|---|
agent_id
Get the agent_id list (read-only).
| Name | Type | Description |
|---|
group_id
Get the group_id (read-only).
| Name | Type | Description |
|---|
session_id
Get the session_id (read-only).
| Name | Type | Description |
|---|
add
Add a memory episode.
| Name | Type | Description | |
|---|---|---|---|
content | str | The content to store in memory | |
role | str | Message role - “user”, “assistant”, or “system” (default: “user”) | |
producer | `str | None` | Who produced this content (defaults to first user_id) |
produced_for | `str | None` | Who this content is for (defaults to first agent_id) |
episode_type | str | Type of episode (default: “text”) - stored in metadata | |
metadata | `dict[str, Any] | None` | Additional metadata for the episode |
timeout | `int | None` | Request timeout in seconds (uses client default if not provided) |
search
Search for memories.
| Name | Type | Description | |
|---|---|---|---|
query | str | Search query string | |
limit | `int | None` | Maximum number of results to return |
filter_dict | `dict[str, Any] | None` | Additional filters for the search |
timeout | `int | None` | Request timeout in seconds (uses client default if not provided) |
get_context
Get the current memory context.
| Name | Type | Description |
|---|
mark_client_closed
Mark this memory instance as closed by its owning client.
| Name | Type | Description |
|---|

