MemorySync
Getting Started

Quickstart

Set up MemorySync, add your first memory, and search it in under five minutes.

Prerequisites

Installation

1
Install MemorySync
python -m pip install memorysync==1.9.2
2
Set your API key
import os
from memorysync import MemorySyncClient
client = MemorySyncClient(
api_key=os.environ["MEMORYSYNC_API_KEY"],
base_url="https://api.memorysync.io",
project_id=os.environ["MEMORYSYNC_PROJECT_ID"],
end_user_id="user-123",
)
3
Add a memory
import os
from memorysync import MemorySyncClient
client = MemorySyncClient(
api_key=os.environ["MEMORYSYNC_API_KEY"],
base_url="https://api.memorysync.io",
project_id=os.environ["MEMORYSYNC_PROJECT_ID"],
end_user_id="user-123",
)
memory = client.add(
"The user prefers concise answers and dark mode.",
source="chat",
metadata={'conversation_id':'conv-42'},
)

This stores a confirmed preference for user-123. Use your own stable, non-sensitive user identifier in production.

4
Search memories
import os
from memorysync import MemorySyncClient
client = MemorySyncClient(
api_key=os.environ["MEMORYSYNC_API_KEY"],
base_url="https://api.memorysync.io",
project_id=os.environ["MEMORYSYNC_PROJECT_ID"],
end_user_id="user-123",
)
result = client.query("How should I format the answer?", k=5)
for memory in result.memories:
print(memory.text)

What’s next?

Was this page helpful?