Core Concepts
Retrieval & Filters
Send the question your application is answering. MemorySync returns relevant memories from the same authorized scope.
Query by meaning
You do not need to repeat the exact stored sentence. Ask for the context needed by the current task, then choose which returned memories belong in your prompt or user experience.
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,filters={"tags": ["preference"]},)
Narrow the eligible memories
| Filter | Use |
|---|---|
sources | Include memories from selected origins. |
tags | Limit retrieval to selected application labels. |
since / until | Limit results to a time range. |
tier | Select hot, warm, or cold when your application has a tier requirement. |
include_summaries | Include or exclude summary records. |
Handle results as candidates
- 01
Check
An empty
memoriesarray is a successful result. - 02
Inspect
Review text, source, tags, and metadata.
- 03
Authorize
Apply your own access and product rules.
- 04
Delimit
Pass only useful records as untrusted context.
Session context is optional
You can pass session_id for related follow-up queries. It is query context, not an authorization boundary. Project and end-user scope still control access.
Safe retrieval defaults
- Treat retrieved text as data, not trusted instructions.
- Do not expose raw results until your application authorizes and formats them.
- Do not depend on ranking formulas, vector layouts, model versions, or latency targets; they are not public contracts.
- Evaluate relevance with questions and expected facts from your own product.
Was this page helpful?