Memory for AI Applications
Learn to design and implement memory systems for AI applications that combine short term and long term memory using MongoDB, LangGraph, and vector search so your agents can persist context, personalize behavior, and maintain reliable state across sessions. Build and wire up checkpointers, semantic caching, and MongoDB Vector Search with Voyage AI to store and retrieve user specific facts safely across threads and users, giving you production ready agents that truly remember while keeping data isolated and secure.
|
Upon completion of the Memory for AI Applications skill and skill check, you will earn a Credly Badge that you are able to share with your network. |
Learning Objectives

Understand Memory and Memory Systems in AI Applications
Explain why AI applications require memory systems and distinguish between short-term memory (conversation context within a session) and long-term memory (persistent knowledge across sessions), including appropriate use cases for each type.

Implement Memory in an AI Application
Design and implement both short-term and long-term memory using MongoDB as the memory store to maintain conversational context, improve response coherence, and enable AI applications to remember user preferences and past interactions across multiple sessions.

Explain MongoDB's Advantages for AI Agent Memory
Explain the advantages of MongoDB’s unified platform for reducing architectural complexity in AI memory storage and retrieval.
Who is this Course Good for?
If you are a developer, data engineer, or AI practitioner who is already building with LLMs but struggling to make your agents remember users, conversations, and context in a reliable way, this Memory for AI Applications with MongoDB skill is for you. It is designed for people who are comfortable reading and writing code and want to go beyond stateless chatbots to build production-ready AI agents with short-term and long-term memory using MongoDB, LangGraph, and vector search.
By the end of the course, you will know how to design and implement memory systems that persist across sessions, personalize behavior, and keep user data isolated and secure in multi-user environments. Once you complete the skill check, you will earn a Memory for AI Applications with MongoDB digital badge that you can share on LinkedIn and across your professional network as proof of your ability to design and implement memory systems for AI agents with MongoDB.
What to Expect in this Course
You will start by stripping the concept of memory in AI applications down to basics: what a memory unit is, how it differs from the text an LLM sees in a single API call, and why relying on context windows alone leads to stateless, forgetful systems. You will contrast file-system based persistence with database-backed memory, and see why databases are required once you move beyond prototypes and single-user demos.
From there, you will dive into short-term memory. You will learn how working memory acts as the agent’s scratchpad for active reasoning, how semantic caching speeds up repeated queries by matching on meaning rather than exact strings, and how both show up in use cases like coding assistants, analytical workflows, and conversational agents. You will also see why MongoDB’s flexible document model and unified platform make it a strong choice for managing conversation state and semantic caches in production.
Once you understand the concepts, you will build a short-term memory system step by step. Using LangGraph and MongoDB, you will:
- Configure a MongoDB checkpointer that automatically creates and manages the
checkpointsand checkpoint_writes collections for conversation state and action logs. - Wire that checkpointer into a LangGraph agent so that every interaction is persisted, enabling retries, resumable conversations, and durable state across restarts.
- Implement thread isolation using
user_idandthread_id, proving that one user can maintain multiple independent conversations while remaining fully separated from other users.
In the second half of the course, you shift to long-term memory. You will first map out the conceptual landscape: episodic memory for specific interactions, semantic memory for general knowledge, procedural memory for learned workflows, and shared memory as a collaborative layer across users or agents. Through concrete examples such as a corporate travel assistant, you will see how these memory types combine to create adaptive systems that personalize behavior over time.
You will then implement long-term memory with MongoDB Vector Search and LangGraph:
- Configure a Voyage AI embedding model and a 1024-dimensional vector index in MongoDB for semantic retrieval.
- Create a
MongoDBStorethat unifies embeddings and metadata in a single collection. - Build
save_memoryandretrieve_memoriestools that automatically store and query user memories, keyed by a namespace pattern such as ("user",user_id,"memories") to guarantee isolation. - Demonstrate cross-thread persistence (an agent recalling a user’s details in a new conversation) and strict separation of data between users like Sarah and Mike.
Throughout the course, you will connect each concept back to real AI application patterns: customer support agents, recommendation systems, analytical copilots, and multi-agent workflows that need to coordinate over shared knowledge while protecting individual user data. The result is a complete mental model and working reference implementation you can adapt to your own AI projects.
Summary of the Course
After completing this course, you will be able to:
- Define memory units in AI applications and articulate how they extend LLM context windows into persistent agent memory systems.
- Use a time, scope, and influence framework to decide what should live in short-term versus long-term memory.
- Explain how working memory and semantic caching support coherent conversations, multi-step reasoning, and efficient reuse of responses.
- Compare file systems and databases as short-term memory backends and justify when MongoDB’s document model and unified platform are the better choice.
- Implement short-term memory with LangGraph and MongoDB, including checkpointers, conversation state persistence, thread isolation, and recovery after restarts.
- Describe and apply episodic, semantic, procedural, and shared long-term memory to design adaptive agents that learn from past interactions and shared knowledge bases.
- Create and integrate memory tools that store and retrieve user-specific facts across threads while maintaining strict user isolation through well-designed namespaces.
- Combine short-term and long-term memory systems to build MongoDB-backed AI agents that truly remember, adapt to their users, and are ready for real-world production workloads.
Daniel Curran | Senior Software Engineer
Daniel is a Senior Software Engineer at MongoDB. Before joining MongoDB, he worked as an Instructional Designer and Content Developer specialising in technical content for a host of international clients. Daniel's goal is to remove obstacles so learners can feel confident on their journey to become masters of MongoDB.
Manuel Fontan Garcia | Senior Technologist
Manuel is a Senior Technologist on the Curriculum team at MongoDB. Previously he was a Senior Technical Services Engineer in the Core team at MongoDB. In between Manuel worked as a database reliability engineer at Slack for a little over 2 years and then for Cognite until he re-joined MongoDB. With over 15 years experience in software development and distributed systems, he is naturally curious and holds a Telecommunications Engineering MSc from Vigo University (Spain) and a Free and Open Source Software MSc from Rey Juan Carlos University (Spain).
Parker Faucher | University Curriculum Engineer
Parker is a Curriculum Engineer on the Education team at MongoDB. Prior to joining MongoDB, he helped maintain a world class developer bootcamp that was offered in multiple universities. He is a self taught developer who loves being able to give back to the community that has helped him so much.
Sequoyha Pelletier | Senior Technologist
Sequoyha Pelletier is a Senior Technologist at MongoDB, bringing over 15 years of experience in technical curriculum development and delivery. Before joining MongoDB, he worked in the Worldwide Support team for DataStax, eventually leading the curriculum team for new hire onboarding. Sequoyha is extremely passionate about providing quality education for free to those in need and enjoys pushing the boundaries of what is considered "normal" practices with delivering educational content.
That's more than just good service. It's a relationship built on memory.
Without that same ability to remember, your AI application is stuck in a digital groundhog day, forgetting who you are the moment a session ends. Hi. I'm Aaron, I'm a curriculum engineer at MongoDB. In this skill for memory for AI applications with MongoDB, we're going to break that cycle by focusing on how memory works across AI applications, not just chatbots.
You'll see how solid memory patterns let you move beyond simple, forgetful chatbots and start building truly intelligent agents that learn, adapt, and actually get to know their users over time. We're going to start by stripping things back to the basics to understand what memory actually means in AI applications and why it's important.
I'll show you why an LLM's context window might seem like a convenient place to dump everything, but in practice, it drives up costs and latency. It can even increase hallucinations.
Building a real memory layer including agent memory systems changes the game. From there, we'll get our hands dirty with the technical side of things using LangGraph and MongoDB.
I'll walk you through how to handle the immediate short term memory. This is the stuff an agent needs to remember to get through a single conversation and we manage that using things like checkpoints. After that, we'll move into the real powerhouse, which is long term memory. You'll learn how to use the MongoDBStore to save information across different days, weeks, or even months, allowing your agent to recall personal details or past decisions just like that barista at the coffee shop. We'll also dive into the how of retrieval. This involves using semantic search so your agent doesn't just store data but actually understands which memories are relevant to the conversation happening right now. We'll even touch on advanced topics like how multiple agents can share a brain through shared memory and how to keep that memory clean and organized so it doesn't become a cluttered mess of old data.
By the end of this skill, you'll know how to design memory for AI applications and use it to build agents that build a history with their users. So if you're ready to stop building tools to forget and start building agents that remember, Let's get into it. Once you've learned this content, you'll be ready to apply your new skills by earning the memory for AI applications with MongoDB skill badge. It's more than a digital badge you can share on LinkedIn. It's proof of your ability to design and implement memory systems for AI applications using MongoDB, moving beyond basic chat interfaces to build agents that maintain state and user context over time.

