Skip to content

Conversation

@Amnah199
Copy link
Contributor

@Amnah199 Amnah199 commented Oct 28, 2025

Related Issues

  • partially fixes - #219

Proposed Changes:

  • This PR integrates mem0 as a memory store in Haystack, supporting basic add, retrieve, and delete operations.
  • It updates the memory_agents.Agent class to enable retrieving and persisting long-term conversational context.

Key Changes

  • Added memory support to memory_agents.Agent.
  • Before each execution, relevant memories are fetched from Mem0MemoryStore using the latest user message as the query.
  • Retrieved memories are injected into the conversation as [MEMORY #n] ChatMessage objects.
  • When memories exist, the system prompt is updated to tell the LLM that [MEMORY] messages represent long-term context.
  • After each run, new user and assistant messages are saved to the memory store.
  • Memory is optional; agents behave normally when memory_store=None.

How did you test it?

  • Unit and Integration Tests
  • Tested locally with examples

Notes for the reviewer

Support for Memory.from_config will be revised in a separate PR as it has a slightly different implementation than mem0 MemoryClient.
https://docs.mem0.ai/platform/platform-vs-oss

Checklist

@coveralls
Copy link

coveralls commented Oct 28, 2025

Pull Request Test Coverage Report for Build 20066169239

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 94 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-2.2%) to 71.082%

Files with Coverage Reduction New Missed Lines %
components/agents/agent.py 94 53.88%
Totals Coverage Status
Change from base Build 20012634360: -2.2%
Covered Lines: 1288
Relevant Lines: 1812

💛 - Coveralls

@Amnah199 Amnah199 marked this pull request as ready for review December 3, 2025 11:54
@Amnah199 Amnah199 requested a review from a team as a code owner December 3, 2025 11:54
@Amnah199 Amnah199 requested review from mpangrazzi and sjrl and removed request for a team and mpangrazzi December 3, 2025 11:54
Co-authored-by: Sebastian Husch Lee <10526848+sjrl@users.noreply.github.com>
@Amnah199 Amnah199 requested a review from sjrl December 9, 2025 14:08
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.

5 participants