Manage memories
You can retrieve and delete individual memories using their ID.
All examples below use a connected client
See Connect to Engram for how to instantiate one.
import os
from engram import EngramClient
client = EngramClient(api_key=os.environ["ENGRAM_API_KEY"])
Get a memory
Retrieve a single memory by its ID.
memory = client.memories.get(
memory_id,
user_id=test_user_id,
group="default",
)
print(memory.content)
print(memory.topic)
Query parameters
| Parameter | Type | Description |
|---|---|---|
user_id | string | User scope (required if the topic is user-scoped) |
group | string | The memory group name (defaults to default) |
Response
{
"id": "memory-uuid",
"project_id": "project-uuid",
"user_id": "user-uuid",
"content": "The user prefers dark mode.",
"topic": "UserKnowledge",
"group": "default",
"properties": { "conversation_id": "abc-123" },
"created_at": "2025-01-01T00:00:00Z",
"updated_at": "2025-01-01T00:00:00Z"
}
Delete a memory
Remove a memory permanently by its ID.
client.memories.delete(
memory_id,
user_id=test_user_id,
group="default",
)
The query parameters are the same as for the get request. You must provide the correct scoping parameters to identify the memory.
warning
Deleting a memory is permanent and cannot be undone.
Questions and feedback
If you have any questions or feedback, let us know in the user forum.
