Skip to content

feat: Add mem0 integration#3326

Merged
sjrl merged 50 commits into
mainfrom
add-mem0
May 21, 2026
Merged

feat: Add mem0 integration#3326
sjrl merged 50 commits into
mainfrom
add-mem0

Conversation

@sjrl
Copy link
Copy Markdown
Contributor

@sjrl sjrl commented May 18, 2026

Related Issues

Proposed Changes:

Add a Mem0 integration for Haystack.

This PR adds:

  • A Mem0MemoryStore which is meant to house all relevant methods for interacting with the Mem0 Memory client.
  • Two components that utilize the Mem0MemoryStore: Mem0MemoryRetriever and Mem0MemoryWriter. Very analogous to our Retriever and Writer components for Document Stores.
  • Two pre-made tools Mem0MemoryRetrieverTool and Mem0MemoryWriterTool that have configuration options.

I recommend checking out the two example files:

  • agent_memory.py to see how the tools can be used in practice
  • agent_memory_components.py to see how the components can be used in practice

How did you test it?

Added unit and integration tests.

Notes for the reviewer

This was initially based off of the Mem0 integration added in haystack-experimental.

Some notable differences are:

  • The addition of the components and tools.
  • The decision to not utilize a MemoryStore protocol for now. While also reviewing the Cognee integration it became apparent that trying to create a MemoryStore protocol that was generalizable between the two integrations was not easily possible and was providing more harm than good. Basically the concept of how to manage Memory is not yet standardized since its a very new concept so I believe it's better to create dedicated Retriever and Writer components to each memory store than trying to force a protocol to work.

Checklist

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 18, 2026

Coverage report (mem0)

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  integrations/mem0/src/haystack_integrations/components/retrievers/mem0
  retriever.py
  integrations/mem0/src/haystack_integrations/components/writers/mem0
  writer.py
  integrations/mem0/src/haystack_integrations/memory_stores/mem0
  errors.py
  filters.py 148-149
  memory_store.py
  integrations/mem0/src/haystack_integrations/tools/mem0
  retriever_tool.py
  writer_tool.py
Project Total  

This report was generated by python-coverage-comment-action

@socket-security
Copy link
Copy Markdown

socket-security Bot commented May 18, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedmem0ai@​2.0.299100100100100

View full report

@sjrl sjrl marked this pull request as ready for review May 19, 2026 11:53
@sjrl sjrl requested a review from a team as a code owner May 19, 2026 11:53
@sjrl sjrl requested review from bogdankostic and removed request for a team May 19, 2026 11:53
@sjrl sjrl self-assigned this May 19, 2026
Copy link
Copy Markdown
Contributor

@bogdankostic bogdankostic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking already good overall, just have some minor comments here and there.

Comment thread integrations/mem0/src/haystack_integrations/memory_stores/mem0/filters.py Outdated
Comment thread integrations/mem0/src/haystack_integrations/memory_stores/mem0/memory_store.py Outdated
Comment thread integrations/mem0/tests/test_retriever_tool.py Outdated
Comment thread integrations/mem0/tests/test_writer_tool.py Outdated
Comment thread integrations/mem0/pyproject.toml Outdated
Comment thread integrations/mem0/examples/agent_memory.py
sjrl and others added 2 commits May 20, 2026 15:52
…ers/mem0/retriever.py

Co-authored-by: bogdankostic <bogdankostic@web.de>
@sjrl sjrl requested a review from bogdankostic May 20, 2026 14:02
Copy link
Copy Markdown
Contributor

@bogdankostic bogdankostic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good!

@sjrl sjrl merged commit 9dd6b4d into main May 21, 2026
17 checks passed
@sjrl sjrl deleted the add-mem0 branch May 21, 2026 06:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration:mem0 topic:CI type:documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants