MemorySync
Getting Started

Quickstart

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

Prerequisites

  • A MemorySync account (sign up here).
  • An API key from the dashboard. A key created while a project is selected is locked to that project. For an organization-wide key, copy the project ID from the project menu in the header (proj_ plus 16 hexadecimal characters).
  • Python 3.9+, Node.js 18+, or cURL.

Installation

1
Install MemorySync
pip install memorysync
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.get("MEMORYSYNC_PROJECT_ID") or None,
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.get("MEMORYSYNC_PROJECT_ID") or None,
end_user_id="user-123",
)
memory = client.add(
"The user prefers concise answers and dark mode.",
source="chat",
metadata={'conversation_id':'conv-42'},
)

MemorySync stores this as 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.get("MEMORYSYNC_PROJECT_ID") or None,
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?