Feature: Episodic agent memory layer via Dakera alongside R2R document retrieval
R2R is a production-ready RAG system with excellent document retrieval and knowledge graphs. This proposes Dakera (https://dakera.ai) as a complementary episodic memory layer — storing and recalling agent interaction history separately from document knowledge.
Problem: R2R's GraphRAG handles document-level knowledge brilliantly, but agent interaction memory (what was discussed, what was concluded, user preferences, past queries) is a separate concern. Document retrieval doesn't model 'I asked this user about X last week and they said Y.'
Proposed: DakeraMemoryLayer as an optional middleware in R2R's pipeline:
from dakera import DakeraClient
class DakeraMemoryLayer: def init(self, base_url='http://localhost:3300', api_key=''): self._client = DakeraClient(base_url=base_url, api_key=api_key)
async def pre_retrieval(self, query: str, user_id: str) -> str:
# Recall episodic context before document retrieval
response = self._client.recall(agent_id=user_id, query=query, top_k=3)
if response and response.memories:
context = '\n'.join(f'- {m.content}' for m in response.memories)
return f'Prior context:\n{context}\n\nQuery: {query}'
return query
async def post_generation(self, query: str, answer: str, user_id: str) -> None:
# Store the Q&A exchange for future recall
self._client.store_memory(
agent_id=user_id,
content=f'Q: {query}\nA: {answer}',
session_id=user_id,
)Setup: docker run -d -p 3300:3300 -e DAKERA_API_KEY=demo ghcr.io/dakera-ai/dakera:latest / pip install dakera
Integration point: py/core/pipelines/ — add DakeraMemoryLayer as an optional middleware step.
Happy to open a PR.
Source: SciPhi-AI/R2R