Agent memory vs RAG explained: RAG retrieves static docs, memory writes and updates what the agent learns. When to use …