Working through this module?0 of 19 done
Module 07 · Page 8 of 20 · 9 sections

Memory in Agentic AI

Short-term, long-term, episodic and semantic memory, and how they fit together around an agent.

7.1

What is Memory in Agentic AI?

  • Memory allows an agent to store, retrieve and use past information to make better decisions.
  • It helps the agent maintain context across multiple interactions.
  • Without memory, the agent behaves like a stateless system and forgets previous conversation and actions.
  • Memory is essential for long-term goals, personalization and complex multi-step tasks.
7.2

Why Memory is Important?

  • Helps in maintaining conversation context.
  • Improves decision making with past knowledge.
  • Allows personalization and user preferences.
  • Useful for long-running tasks and autonomous agents.
  • Reduces repetitive questions and improves efficiency.
7.3

Types of Memory

TypeDescriptionExamplesUse cases
Short-term memoryStores recent conversation information in current sessionChat history, recent user inputMaintaining context in a single conversation
Long-term memoryStores important information for future useUser preferences, domain knowledgePersonalization, continuous learning
Episodic memoryStores past events and experiencesPrevious tasks, actions taken, resultsLearning from past interactions
Semantic memoryStores factual knowledge and world informationCompany info, general knowledgeAnswering factual questions, RAG
7.4

Memory Architecture

User Query
AgentLLM + tools
Short-term MemoryConversation history
Long-term MemoryVector store / database
Episodic MemoryEvents / actions
Semantic MemoryKnowledge base / RAG
ToolsAPIs, database, web, etc.
Response to User
The agent reads from and writes to every memory type through one layer.
7.5

Short-term Memory (Conversation Memory)

  • Stores recent messages in the current session.
  • Helps the agent understand the immediate context.
  • Usually implemented as a sliding window of last N messages.
  • Example: keep last 5–10 user and assistant messages.
UserWhat is the weather in Goa?
AssistantGoa is sunny with 30°C.
UserWhat about tomorrow?
AssistantTomorrow it will be 28°C.
UserSuggest some hotels there.
Kept in short-term memory: the last 5 messages. “Tomorrow” and “there” only resolve because of them.
7.6

Long-term Memory (Vector Store)

  • Stores important information for future use.
  • Implemented using vector databases (e.g. Pinecone, Qdrant).
  • Converts text to embeddings and stores in a vector store.
  • Retrieves relevant information using semantic search.
TextImportant info
Embedding Modele.g. OpenAI
Vector StorePinecone / Qdrant
Retrieve relevant contextSimilarity search
Relevant Info for Agent
7.7

Episodic Memory (Event Memory)

  • Stores past actions, events and experiences.
  • Helps agent learn from previous interactions.
  • Useful for long-running tasks and autonomous agents.
  • Example: remembering that user booked a flight last week.
EventBooked flight to Goa
Date12 Oct 2024
DetailsFrom Delhi to Goa, 2 tickets
EventAsked for hotel suggestion
Date12 Oct 2024
DetailsLooking for beachside hotels
7.8

Semantic Memory (Knowledge Base)

  • Stores general knowledge and domain-specific information.
  • Often implemented using RAG (Retrieval-Augmented Generation).
  • Retrieves relevant documents and provides accurate responses.
  • Example: company policies, product documentation.
User Query
Retrieve relevant documents (RAG)
LLM
Answer with knowledge
Knowledge BaseCompany docs, PDFs, websites
7.9

Key Takeaways

  1. 1Memory is essential for building intelligent and autonomous agents.
  2. 2Different types of memory serve different purposes.
  3. 3Short-term memory handles immediate context, long-term memory stores important knowledge, episodic memory stores past events and semantic memory stores factual knowledge.
  4. 4Vector databases and RAG are commonly used for long-term memory.
  5. 5Good memory design significantly improves agent performance.