Working through this module?
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.
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.
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.
Types of Memory
| Type | Description | Examples | Use cases |
|---|---|---|---|
| Short-term memory | Stores recent conversation information in current session | Chat history, recent user input | Maintaining context in a single conversation |
| Long-term memory | Stores important information for future use | User preferences, domain knowledge | Personalization, continuous learning |
| Episodic memory | Stores past events and experiences | Previous tasks, actions taken, results | Learning from past interactions |
| Semantic memory | Stores factual knowledge and world information | Company info, general knowledge | Answering factual questions, RAG |
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
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.
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
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
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
Key Takeaways
- 1Memory is essential for building intelligent and autonomous agents.
- 2Different types of memory serve different purposes.
- 3Short-term memory handles immediate context, long-term memory stores important knowledge, episodic memory stores past events and semantic memory stores factual knowledge.
- 4Vector databases and RAG are commonly used for long-term memory.
- 5Good memory design significantly improves agent performance.