Skip to content

Commit 3c6b2f4

Browse files
fenilfalduDwij1704dot-agi
authored
Added Mem0 Instrumentation (#1027)
* Implement concurrent.futures instrumentation for OpenTelemetry context propagation * ruff checks :) * ruff check again :( * damn ruff +_+ * heck ruff again * Added Mem0 and Concurrent Futures Instrumentation(for testing pr is already raised for that) * ruff checks * why ruff again :( * ah! here we go again * updated the constants * constants update * refactor the instrumentation with utlity instrumentation * code cleanup * added v2 docs * removed the utility instrumentation from mem0 * v2 docs added * ruff checks * Delete examples/mem0/mem0_memory_basic_example.py * ruff checks again * Format mem0_memory_basic_example.py * code cleanup * add "Example" to Title * some doc changes --------- Co-authored-by: Dwij <[email protected]> Co-authored-by: Pratyush Shukla <[email protected]>
1 parent 56989ae commit 3c6b2f4

File tree

16 files changed

+2825
-1
lines changed

16 files changed

+2825
-1
lines changed

agentops/instrumentation/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ class InstrumentorConfig(TypedDict):
6767
"min_version": "0.1.0",
6868
"package_name": "google-genai", # Actual pip package name
6969
},
70+
"mem0": {
71+
"module_name": "agentops.instrumentation.mem0",
72+
"class_name": "Mem0Instrumentor",
73+
"min_version": "0.1.0",
74+
"package_name": "mem0ai",
75+
},
7076
}
7177

7278
# Configuration for utility instrumentors
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
"""Mem0 instrumentation library for AgentOps.
2+
3+
This package provides instrumentation for the Mem0 memory management system,
4+
capturing telemetry data for memory operations.
5+
"""
6+
7+
import logging
8+
9+
# Import memory operation wrappers
10+
from .memory import (
11+
mem0_add_wrapper,
12+
mem0_search_wrapper,
13+
mem0_get_all_wrapper,
14+
mem0_get_wrapper,
15+
mem0_delete_wrapper,
16+
mem0_update_wrapper,
17+
mem0_delete_all_wrapper,
18+
mem0_history_wrapper,
19+
)
20+
21+
22+
def get_version() -> str:
23+
try:
24+
from importlib.metadata import version
25+
26+
return version("mem0ai")
27+
except ImportError:
28+
logger.debug("Could not find Mem0 SDK version")
29+
return "unknown"
30+
31+
32+
LIBRARY_NAME = "agentops.instrumentation.mem0"
33+
LIBRARY_VERSION = "1.0.0"
34+
35+
logger = logging.getLogger(__name__)
36+
37+
# Import after defining constants to avoid circular imports
38+
from agentops.instrumentation.mem0.instrumentor import Mem0Instrumentor # noqa: E402
39+
40+
__all__ = [
41+
"LIBRARY_NAME",
42+
"LIBRARY_VERSION",
43+
"Mem0Instrumentor",
44+
# Memory operation wrappers
45+
"mem0_add_wrapper",
46+
"mem0_search_wrapper",
47+
"mem0_get_all_wrapper",
48+
"mem0_get_wrapper",
49+
"mem0_delete_wrapper",
50+
"mem0_update_wrapper",
51+
"mem0_delete_all_wrapper",
52+
"mem0_history_wrapper",
53+
]

0 commit comments

Comments
 (0)