How to Add Memory to RAG Applications and AI Agents