Letta (formerly MemGPT) is an open-source framework and runtime for building stateful AI agents with persistent, self-editing memory. Drawing inspiration from traditional operating system memory hierarchies, Letta enables LLMs to function as operating systems that manage their own context windows through virtual memory paging, tool calls, and archival search.
graph TD
subgraph "In-Context Working Memory"
SystemPrompt[System Instructions & Persona]
CoreMemory[Core Memory Block<br/>Persona & Human Profile]
ConversationQueue[Active FIFO Context Queue]
end
subgraph "External Persistent Storage (Out-of-Context)"
RecallStorage[(Recall Storage<br/>Full conversation history database)]
ArchivalStorage[(Archival Storage<br/>Vector-indexed factual database)]
end
CoreMemory <-->|core_memory_append / replace| Agent[LLM Agent Loop]
Agent <-->|conversation_search| RecallStorage
Agent <-->|archival_memory_insert / search| ArchivalStorage
Standard LLMs face a fundamental tradeoff: they are limited by context window sizes and forget everything once a session closes. Letta resolves this via a multi-tiered memory architecture:
core_memory_append, core_memory_replace).conversation_search).archival_memory_insert) and perform semantic searches (archival_memory_search).letta-code, an interactive CLI, and an open-source desktop interface (letta-oss-ui).Install the Letta CLI:
npm i -g @letta-ai/letta-code
Start the Letta server and run a persistent agent:
letta run