Skip to content

Memory System

Sentinel uses adapters to handle long-term memory.

sentinel_core.interfaces.BaseMemoryStore

Bases: ABC

The blueprint for memory (Neo4j, Mem0, Postgres).

Source code in sentinel_core\interfaces.py
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
class BaseMemoryStore(ABC):
    """
    The blueprint for memory (Neo4j, Mem0, Postgres).
    """

    @abstractmethod
    async def save(self, key: str, value: Dict[str, Any]) -> bool:
        """
        Save data. 'Dict[str, Any]' means a dictionary where keys are strings
        and values can be anything (text, numbers, lists).
        """
        pass

    @abstractmethod
    async def retrieve(self, key: str) -> Optional[Dict[str, Any]]:
        """
        Get data back. Returns a Dictionary or None if nothing is found.
        """
        pass

retrieve(key) abstractmethod async

Get data back. Returns a Dictionary or None if nothing is found.

Source code in sentinel_core\interfaces.py
34
35
36
37
38
39
@abstractmethod
async def retrieve(self, key: str) -> Optional[Dict[str, Any]]:
    """
    Get data back. Returns a Dictionary or None if nothing is found.
    """
    pass

save(key, value) abstractmethod async

Save data. 'Dict[str, Any]' means a dictionary where keys are strings and values can be anything (text, numbers, lists).

Source code in sentinel_core\interfaces.py
26
27
28
29
30
31
32
@abstractmethod
async def save(self, key: str, value: Dict[str, Any]) -> bool:
    """
    Save data. 'Dict[str, Any]' means a dictionary where keys are strings
    and values can be anything (text, numbers, lists).
    """
    pass