# Storing & Retrieving Memory

### **Overview**

Memorylake enables storing, retrieving and managing conversational memory by associating user queries and responses with specific sessions. This allows AI-driven applications to recall past interactions and provide context-aware responses.

***

### **Method: `short_memory_create()`**

The `short_memory_create()` method stores a memory instance for a specific user. Each memory entry contains:

* **User UUID**: Identifies the user.
* **Memory Context**: Defines the scope of memory storage (e.g., chatbot session).
* **Memory Data**: Stores the user’s query, AI-generated response, timestamp, and cache expiration time.

Example Method

```python
user_uuid = "user123"
memory_context = {
    "context_entity_id": "chatbot",
    "context_id": "session1",
    "memory_id": "msg001"
}
memory = {
    "query_text": "Hello!",
    "response_text": "Hi there! How can I help you?",
    "time": "2025-02-05T12:00:00Z",
    "cache_ttl": 3600
}

response = memory_lake.short_memory_create(user_uuid, memory_context, memory)
print(response)
```

### Retrieving Memory <a href="#retrieving-memory" id="retrieving-memory"></a>

You can retrieve memory using the `short_memory_read` method. This method supports:

```python
response = memory_lake.short_memory_read(user_uuid, memory_context)
print(response)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.groclake.ai/lakes/agent-management-and-deployment/memorylake/editor-3.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
