Build agents with long-term, persistent memory using Letta to manage and edit context efficiently.
LLMs as Operating Systems: Agent Memory
Instructors: Charles Packer, Sarah Wooders
Earn an accomplishment with PRO · Updated Oct 7, 2025

- Intermediate
- 1h32m
- 8 Video Lessons
- 5 Code Examples
- 1 Graded Assignment PRO
- Earn an accomplishment with PRO
- Updated Oct 7, 2025
- Instructors: Charles Packer, Sarah Wooders
Letta- Learn more aboutMembership PRO Plan
What you'll learn
Learn how an LLM agent can act as an operating system to manage memory, autonomously optimizing context use.
Apply memory management to create adaptive, collaborative AI agents for real-world tasks like research and HR.
Course recap
PROThis course introduces the MemGPT paradigm for building AI agents with self-editing persistent memory, drawing an analogy between LLM context windows and operating system memory management. It teaches how to build agents that can autonomously read, write, and search their own memory across conversations, enabling long-term personalization and learning.
Concept map
Key concepts
- Agent MemoryPersistent, self-editing memory that agents can autonomously read, write, and search across conversations
- AI AgentsAutonomous entities that take multi-step actions in an agentic loop, distinct from simple chatbots
- Context compilationThe process of converting agent state (including memory) into the LLM context window
- Tool CallingUsing LLM function calling to implement memory operations (core_memory_save, archival_memory_search, etc.)
Lesson highlights
- 1.Introduction — MemGPT vs Letta terminology, chatbots vs agents, agentic loops
- 2.Editable Memory — Building self-editing memory from scratch with OpenAI tool calling and multi-step reasoning
- 3.MemGPT Architecture — Two-tier memory system inspired by OS virtual memory (core memory + archival memory)
- 4.Building MemGPT Agents with Letta — Using the Letta framework to create persistent agents with tools and memory
- 5.Multi-Agent Systems — Orchestrating multiple MemGPT agents that share memory and collaborate
- 6.Memory Management Patterns — Strategies for memory organization, retrieval, and garbage collection
- 7.Deploying Agents as Services — Using Letta to deploy persistent agents with REST APIs
- 8.Conclusion — Summary and future directions for persistent agent architectures
About this course
Learn how to build agentic memory into your applications in this short course, LLMs as Operating Systems: Agent Memory, created in partnership with Letta, and taught by its founders Charles Packer and Sarah Wooders.
An LLM can use any information stored in its input context window but has limited space. Using a longer input context also costs more and causes slower processing. Managing this context window and what to input becomes very important.
Based on the innovative approach in the MemGPT research paper “Towards LLMs as Operating Systems,” its authors, two of whom are Charles and Sarah, proposed using an LLM agent to manage this context window, building a management system that provides applications with managed, persistent memory.
Examples of Managing Agent Memory are:
- Control Conversation Memory. As conversations grow beyond defined limits, move information from context to a persistent searchable database. Summarize information to keep relevant facts in context memory. Restore relevant conversation elements as needed by conversation flow.
- Persist and edit facts such as names, dates, and preferences, and make them available in context.
- Persist and track ‘task’ specific information. For example, a research agent needs to keep research information in context memory, swapping the most relevant information from a searchable database with previous information.
In this course, you’ll learn:
- How to build an agent with self-editing memory, using tool-calling and multi-step reasoning, from scratch.
- Letta, an open-source framework that adds memory to your LLM agents, giving them advanced reasoning capabilities and transparent long-term memory.
- The key ideas behind the MemGPT paper, the two tiers of memory in and outside the context window, and how agent states comprised of memory, tools, and messages are turned into prompts.
- How to create and interact with a MemGPT agent using the Letta framework, and how to build and edit its core and archival memory.
- How core memory is designed and implemented with an example of how to customize it with blocks and memory tools.
- How to implement multi-agent collaboration both by sending messages and by sharing memory blocks.
- How to retrieve agent reasoning steps in a stream, rather than receiving all outputs at once.
- How to use a pre-deployed Letta agent service that runs cloud-based agents, reflecting real-world agent deployment practices.
By the end of this course, you will have the tools to build LLM applications that can leverage virtual context, extending memory beyond the finite context window of LLMs.
Who should join?
Anyone who has basic Python skills and is curious about how autonomous agents can manage their own memory.
Course Outline
8 Lessons・5 Code Examples- IntroductionVideo・5m
- Editable memoryVideo with Code Example・12m
- Understanding MemGPTVideo・14m
- Building Agents with MemoryVideo with Code Example・12m
- Programming Agent MemoryVideo with Code Example・14m
- Agentic RAG and External MemoryVideo with Code Example・8m
- Multi-agent OrchestrationVideo with Code Example・14m
- ConclusionVideo・1m
- Quiz
Graded・Quiz
・10m


Elevate your learning experience with Pro
Upgrade to Pro and gain unlimited accomplishments on your resume
Instructors
Course access is free for a limited time during the DeepLearning.AI learning platform beta!
Want to learn more about Generative AI?
Keep learning with updates on curated AI news, courses, and events, as well as Andrew’s thoughts from DeepLearning.AI!


