MemorySync
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 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,
filters={"tags": ["preference"]},
)

Narrow the eligible memories

FilterUse
sourcesInclude memories from selected origins.
tagsLimit retrieval to selected application labels.
since / untilLimit results to a time range.
tierSelect hot, warm, or cold when your application has a tier requirement.
include_summariesInclude or exclude summary records.

Handle results as candidates

Safe result path
  1. 01

    Check

    An empty memories array is a successful result.

  2. 02

    Inspect

    Review text, source, tags, and metadata.

  3. 03

    Authorize

    Apply your own access and product rules.

  4. 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.

Benchmarking Latency & Efficiency

When evaluating agent memory infrastructure, measure across a multi-hop pipeline under concurrent load rather than single-turn synthetic averages:

Benchmark DimensionMeasurement FocusProduction Target
Pipeline TracingSeparate embedding generation, vector retrieval, and post-filtering hops.A p95 inside your own latency budget, measured from where your app runs
Tail DistributionReport p50, p95, and p99 percentiles across 100+ concurrent iterations.Zero outlier spikes (>100ms jitter)
Token OverheadCompare scoped retrieved context tokens vs raw conversation history dumps.70%+ token reduction over full history
Multi-Turn RetentionEvaluate recall accuracy across 50+ turns with intervening distractor tasks.100% semantic recall without drift
  • Use high-resolution monotonic timers (time.perf_counter()) to isolate network transport from LLM generation time.
  • Benchmark both cold-start initialization and warm-path query latencies separately.
  • Validate multi-tenant isolation by ensuring scoped queries never leak memories across distinct project IDs or session boundaries.
Was this page helpful?