From 135596a0dcdc161634f3d7a2259e2e3b4e445e37 Mon Sep 17 00:00:00 2001 From: lucasgomide Date: Tue, 1 Apr 2025 18:34:12 -0300 Subject: [PATCH] chore: add warning messages about the deprecation of UserMemory --- docs/concepts/memory.mdx | 3 ++- src/crewai/memory/user/user_memory.py | 11 ++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/docs/concepts/memory.mdx b/docs/concepts/memory.mdx index b2f03669d..5066db6ed 100644 --- a/docs/concepts/memory.mdx +++ b/docs/concepts/memory.mdx @@ -18,7 +18,8 @@ reason, and learn from past interactions. | **Long-Term Memory** | Preserves valuable insights and learnings from past executions, allowing agents to build and refine their knowledge over time. | | **Entity Memory** | Captures and organizes information about entities (people, places, concepts) encountered during tasks, facilitating deeper understanding and relationship mapping. Uses `RAG` for storing entity information. | | **Contextual Memory**| Maintains the context of interactions by combining `ShortTermMemory`, `LongTermMemory`, and `EntityMemory`, aiding in the coherence and relevance of agent responses over a sequence of tasks or a conversation. | -| **User Memory** | Stores user-specific information and preferences, enhancing personalization and user experience. | +| **External Memory** | Enables integration with external memory systems and providers (like Mem0), allowing for specialized memory storage and retrieval across different applications. Supports custom storage implementations for flexible memory management. | +| **User Memory** | ⚠️ **DEPRECATED**: This component is deprecated and will be removed in a future version. Please use [External Memory](#using-external-memory) instead. | ## How Memory Systems Empower Agents diff --git a/src/crewai/memory/user/user_memory.py b/src/crewai/memory/user/user_memory.py index 1c710bb69..1baebee1d 100644 --- a/src/crewai/memory/user/user_memory.py +++ b/src/crewai/memory/user/user_memory.py @@ -1,3 +1,4 @@ +import warnings from typing import Any, Dict, Optional from crewai.memory.memory import Memory @@ -12,6 +13,12 @@ class UserMemory(Memory): """ def __init__(self, crew=None): + warnings.warn( + "UserMemory is deprecated and will be removed in a future version. " + "Please use ExternalMemory instead.", + DeprecationWarning, + stacklevel=2, + ) try: from crewai.memory.storage.mem0_storage import Mem0Storage except ImportError: @@ -48,6 +55,4 @@ class UserMemory(Memory): try: self.storage.reset() except Exception as e: - raise Exception( - f"An error occurred while resetting the user memory: {e}" - ) + raise Exception(f"An error occurred while resetting the user memory: {e}")