Package that adds a memory layer to AI agents and assistants, enabling persistent context and real-time knowledge management.
Project description
Sinapsis Mem0
Persistent memory for AI agents: store, retrieve, and manage context across conversations and workflows.
🐍 Installation • 🚀 Features • 📚 Usage example • 📙 Documentation • 🔍 License
The sinapsis-mem0 module adds short and long-term memory to AI agents, enabling dynamic context recall, personalized interactions, and seamless knowledge retention across sessions.
🐍 Installation
Install using your package manager of choice. We encourage the use of uv
Example with uv:
uv pip install sinapsis-mem0 --extra-index-url https://pypi.sinapsis.tech
or with raw pip:
pip install sinapsis-mem0 --extra-index-url https://pypi.sinapsis.tech
[!IMPORTANT] Templates may require extra dependencies. For development, we recommend installing the package with all the optional dependencies:
with uv:
uv pip install sinapsis-mem0[all] --extra-index-url https://pypi.sinapsis.tech
or with raw pip:
pip install sinapsis-mem0[all] --extra-index-url https://pypi.sinapsis.tech
🚀 Features
The templates include the possibility to extend the AI agents with memory persistence using Memory or MemoryClient. Using the client version requires setting the API Key as:
export MEM0_API_KEY="your-api-key-here"
You can check the documentation for the managed client version or for the self hosted open-source version for more details on how to set them up.
Templates Supported
- Mem0Add: Ingests and structures AI interactions (prompts or responses) into Mem0’s memory format. Supports both discrete facts and full conversation histories.
- Mem0Delete: Removes memories, either selectively (by ID) or in bulk (e.g., all data for a user/agent).
- Mem0Get: Retrieves stored memories, from individual entries to entire conversation histories.
- Mem0Reset: Clears memory storage completely or within a defined scope (user/agent/run).
- Mem0Search: Dynamically fetches and injects relevant memories into prompts, with configurable formatting.
🌍 General Attributes
These attributes apply to all the available templates:
use_managed(bool, required): If True, use the managed Mem0 API (MemoryClient), else the self-hosted infrastructure will be used through theMemoryclass.memory_config(dict, optional): Parameters to configure eitherMemoryClientorMemory, depending on the value ofuse_managed.
➕ Mem0Add Attributes
add_kwargs(dict, optional): Dictionary of parameters to pass toMemoryClientorMemoryaddmethod. Common keys includeuser_idoragent_id.generic_key(str, required): Key used to retrieve original prompts from the container's generic data field.
🗑️ Mem0Delete Attributes
delete_all(bool, optional): If True, performs a complete memory wipe for the specified scope (agent, run or user). If False, performs targeted deletion based onmemory_id. Defaults toFalse.delete_kwargs(dict, required): Parameters for the deletion operation. Depending on the type of deletion, this may includeuser_id,agent_id, ormemory_id.
📥 Mem0Get Attributes
get_all(bool, optional): If True, retrieves all memories for the given context (e.g., user, agent, or run). If False, retrieves a specific memory using parameters likememory_id. Defaults toFalse.get_kwargs(dict, required): Additional parameters to pass to the memory retrieval method. Can include fields such asuser_id,agent_id, ormemory_id, depending on the attributes chosen.
🔎 Mem0Search Attributes
enclosure(Literal["plain", "bracket", "dashed", "xml"], optional): Determines how relevant memories are injected into the prompt before the user query. Defaults toplainwhich injects no special section or title, just memories and query.search_kwargs(dict, required): Additional parameters to pass to the memory search method. Can include fields such asuser_id,top_k, orthreshold, depending on the attributes chosen.
[!TIP] Use CLI command
sinapsis info --all-template-namesto show a list with all the available Template names installed with Sinapsis Mem0.
[!TIP] Use CLI command
sinapsis info --example-template-config TEMPLATE_NAMEto produce an example Agent config for the Template specified in TEMPLATE_NAME.
For example, for Mem0Search use sinapsis info --example-template-config Mem0Search to produce the following example config:
agent:
name: my_test_agent
templates:
- template_name: InputTemplate
class_name: InputTemplate
attributes: {}
- template_name: Mem0Search
class_name: Mem0Search
template_input: InputTemplate
attributes:
use_managed: false
memory_config: '`replace_me:dict[str, typing.Any]`'
search_kwargs: '`replace_me:dict[str, typing.Any]`'
enclosure: plain
📚 Usage example
The following agent retrieves all memories for the given user_id and run_id from the Mem0 Platform.
Config
agent:
name: retriever_agent
description: Agent that retrieves all memories from Mem0 platform.
templates:
- template_name: InputTemplate
class_name: InputTemplate
attributes: {}
- template_name: Mem0Get
class_name: Mem0Get
template_input: InputTemplate
attributes:
use_managed: true
memory_config:
host: null
org_id: null
project_id: null
get_all: true
get_kwargs:
user_id: my_user
run_id: test
📙 Documentation
Documentation for this and other sinapsis packages is available on the sinapsis website
Tutorials for different projects within sinapsis are available at sinapsis tutorials page
🔍 License
This project is licensed under the AGPLv3 license, which encourages open collaboration and sharing. For more details, please refer to the LICENSE file.
For commercial use, please refer to our official Sinapsis website for information on obtaining a commercial license.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sinapsis_mem0-0.1.0.tar.gz.
File metadata
- Download URL: sinapsis_mem0-0.1.0.tar.gz
- Upload date:
- Size: 23.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bcf8e9462332d5a4fe5716d5a4544cb8e77b7842a8a6635386e785e3b8973a66
|
|
| MD5 |
889e7c46571092e8f3f27eb61472d0f7
|
|
| BLAKE2b-256 |
374021dc9113d3a03e529fd45186f8c18f6eb02f58d8ed551fdccb3f5dc6e440
|
File details
Details for the file sinapsis_mem0-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sinapsis_mem0-0.1.0-py3-none-any.whl
- Upload date:
- Size: 25.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2edc98f971385b461a2eca1a92178c19d5ca0173eddedffbd840f8b137c8235
|
|
| MD5 |
caf3a6e94b3ff2398745fac1191dafcb
|
|
| BLAKE2b-256 |
4c36ab592d33d109a9e9afd8d3645917358f07226c9e5546bd53c5ae736f94bd
|