Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Dec 7, 2025

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:

  • New OpenMemoryStorage class implementing the Storage interface
  • Registration of "openmemory" provider in ExternalMemory
  • Optional dependency openmemory-py>=1.0.0
  • Comprehensive unit tests with mocked OpenMemory SDK

Configuration options supported: path, tier (fast/smart/deep/hybrid), embeddings, user_id.

Usage Example

from crewai.memory.external.external_memory import ExternalMemory

embedder_config = {
    "provider": "openmemory",
    "config": {
        "path": "/path/to/memory.sqlite",  # optional, defaults to CREWAI_STORAGE_DIR
        "tier": "fast",                     # fast, smart, deep, or hybrid
        "embeddings": {"provider": "synthetic"},
        "user_id": "my_user",               # optional, for namespacing
    },
}

storage = ExternalMemory.create_storage(crew, embedder_config)

Review & Testing Checklist for Human

  • Verify OpenMemory SDK API compatibility: The implementation assumes add(content, userId=..., tags=..., metadata=...) and query(query, k=..., filters=...) signatures based on SDK documentation. Test with actual openmemory-py package to confirm.
  • Check metadata mutation in save(): Line 87 does metadata.pop("tags", None) which mutates the input dict - verify this is acceptable behavior or if a copy should be made.
  • Validate search result normalization: The search() method normalizes results assuming OpenMemory returns dicts with "content" or "memory" fields - confirm this matches actual SDK behavior.
  • Test reset() behavior: The reset deletes the SQLite file and reinitializes - verify this works correctly with the real SDK.

Recommended test plan: Install openmemory-py, create an ExternalMemory with provider: "openmemory", and verify save/search/reset operations work end-to-end.

Notes

  • All tests use mocks since the real OpenMemory SDK wasn't available in the test environment
  • The implementation only supports mode="local" (no remote mode yet)
  • Search results return a list of dicts with content, optional score, and metadata fields

Link to Devin run: https://app.devin.ai/sessions/49cdb1ae10014912a0b2bf6e679a28eb
Requested by: João (joao@crewai.com)

This adds OpenMemory as a pluggable storage backend for CrewAI memory,
following the existing Mem0Storage pattern.

Changes:
- Add OpenMemoryStorage class implementing the Storage interface
- Register OpenMemory provider in ExternalMemory
- Add openmemory-py as optional dependency
- Add comprehensive tests for OpenMemory integration

Closes #4039

Co-Authored-By: João <joao@crewai.com>
@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Co-Authored-By: João <joao@crewai.com>
@devin-ai-integration
Copy link
Contributor Author

Closing due to inactivity for more than 7 days. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant