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 and project ID (open the dashboard).
- Python 3.9+, Node.js 18+, or cURL.
Installation
1
Install MemorySync
python -m pip install memorysync==1.9.2
2
Set your API key
import osfrom memorysync import MemorySyncClientclient = 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 osfrom memorysync import MemorySyncClientclient = 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 osfrom memorysync import MemorySyncClientclient = 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?