MemorySync
Getting Started

MemorySync Documentation

Build persistent, user-scoped context for AI applications. Start with one write and one retrieval, then move to the pattern that matches your product.

Start here

The three ideas to learn first

IdeaWhat it meansWhere to continue
MemoryDurable context your application can write and retrieve later.What is a Memory
ScopeOrganization, project, and end-user identifiers keep workloads separated.Multi-tenant Applications
RetrievalA natural-language query returns relevant memory for the same scope.Retrieval Pipeline

Your first useful result

The shortest successful path is: create a key, choose a project, identify an end user, write a useful fact, and query that fact back.

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'},
)
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)

Safe defaults

  • Keep API keys on your server and load them from environment variables.
  • Use a stable, non-sensitive external identifier for X-End-User-ID.
  • Store facts that improve future behavior—not complete prompts, secrets, or raw credentials.
  • Use separate projects or keys when workloads have different access boundaries.