MemorySync
Getting Started

MemorySync Documentation

MemorySync is a memory API for AI applications: your agent writes what it learns about each user, and MemorySync returns the relevant parts later, ranked by meaning and scoped to that user. 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 writes to MemorySync and retrieves later.What is a Memory
ScopeIn MemorySync, organization, project, and end-user identifiers keep workloads separated.Multi-tenant Applications
RetrievalA natural-language query to MemorySync returns relevant memory for the same scope.Retrieval Pipeline

Your first useful result

The shortest path to a working MemorySync integration 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.
Was this page helpful?