feat: add OpenMemory as optional memory backend #4040
Closed
+4,719
−4,136
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements OpenMemory as a pluggable storage backend for CrewAI memory, addressing issue #4039. OpenMemory is a local-first persistent memory engine for AI applications.
The implementation follows the existing Mem0Storage pattern and includes:
OpenMemoryStorageclass implementing theStorageinterfaceExternalMemoryopenmemory-py>=1.0.0Configuration options supported:
path,tier(fast/smart/deep/hybrid),embeddings,user_id.Usage Example
Review & Testing Checklist for Human
add(content, userId=..., tags=..., metadata=...)andquery(query, k=..., filters=...)signatures based on SDK documentation. Test with actualopenmemory-pypackage to confirm.save(): Line 87 doesmetadata.pop("tags", None)which mutates the input dict - verify this is acceptable behavior or if a copy should be made.search()method normalizes results assuming OpenMemory returns dicts with "content" or "memory" fields - confirm this matches actual SDK behavior.Recommended test plan: Install
openmemory-py, create anExternalMemorywithprovider: "openmemory", and verify save/search/reset operations work end-to-end.Notes
mode="local"(no remote mode yet)content, optionalscore, andmetadatafieldsLink to Devin run: https://app.devin.ai/sessions/49cdb1ae10014912a0b2bf6e679a28eb
Requested by: João (joao@crewai.com)