AgentOps Memory Observability
Memory operations as first-class spans in AgentOps: the first SDK-level tracing instrumentor shipped by any memory vendor. One line after agentops.init() and every add, recall, query, and forget appears in your AgentOps traces — with memory content excluded by default. Install opentelemetry-instrumentation-memorysync from PyPI.
One line of setup
pip install opentelemetry-instrumentation-memorysync agentops
agentops.init() registers AgentOps as the global OpenTelemetry tracer provider, and this package emits standard OTel spans through it — so the pairing needs no adapter, no plugin, and no AgentOps-specific code. The same instrumentor works unchanged with Respan, Traceloop, Langfuse, or a plain OTLP collector.
| Operation | Span | Key attributes |
|---|---|---|
add / bulk_add / summarize | memorysync.add … | memory_id, status (stored/skipped), skip reason |
query / retrieve / recall / search_routed | memorysync.query … | k, results_count, score min/max/avg, context_chars, server latency |
add_turn | memorysync.add_turn | tenant/user/session ids, already_exists idempotency signal |
forget | memorysync.forget | selector (ids/filters), ids_count, deleted_count, dry_run |
get / update / history / feedback / list_memories | memorysync.get … | memory_id, updated field NAMES (never values), result counts |
Privacy: content is never recorded by default
Memory content is customer data. By default the spans carry counts, identifiers, scores, and latencies — never memory text, query text, or recalled context. Opt in explicitly with instrument_memorysync(capture_content=True) or MEMORYSYNC_OTEL_CAPTURE_CONTENT=true; even then input is truncated to 500 characters and at most 5 result texts of 200 characters each are recorded.
- Instrumentation can never break the app. Attribute extraction is fully guarded; results and exceptions pass through untouched; spans always end.
- Full sync/async parity — both
MemorySyncClientandAsyncMemorySyncClient, all fourteen operations (the incumbent wrapper skipshistoryon cloud clients). - Errors are first-class: failed calls produce ERROR spans with
error.typeand the HTTP status, and the original exception is re-raised unchanged. - Idempotent lifecycle: double-instrument is a no-op;
uninstrument_memorysync()restores the original methods. - A
memorysync.client.operation.durationhistogram is recorded per call for latency dashboards.
Supported versions
| Surface | Requires | Verified on |
|---|---|---|
opentelemetry-instrumentation-memorysync 1.0.0 | Python 3.9+; opentelemetry-api 1.20+; memorysync 1.8+ | 21 CI checks: the REAL memorysync SDK over production response shapes with the OTel in-memory exporter — sync/async parity, privacy default, byte-identical pass-through, error spans, lifecycle, the late-binding provider seam — plus agentops installed at latest with seam drift alarms pinning the global-tracer-provider contract |