====== Letta ====== **Letta** (formerly MemGPT) is an open-source platform for building stateful AI agents with persistent, transparent long-term memory. With **21.7K GitHub stars**, Letta pioneered the memory-first approach to agent design, where agents maintain identity, learn from interactions, and improve across sessions rather than resetting to a blank state. {{tag>framework python agents memory stateful memgpt}} ===== Overview ===== Letta originated as MemGPT, a research project that introduced virtual context windows via memory tiers to overcome LLM context length limitations. In September 2024, MemGPT rebranded to Letta and expanded from a memory-augmented LLM prototype into a full platform for stateful agents. The core insight is that agents should have "lived experience" — storing interactions, building knowledge, and improving over time. Letta's architecture treats memory as the primary architectural concern, with agent reasoning built around persistent state rather than stateless prompt engineering. ===== Key Features ===== * **Persistent Memory** — Core memory (identity), archival memory (long-term facts), and recall mechanisms * **Stateful Agents** — Agents persist across sessions, learning without stateless resets * **Memory Transparency** — Inspectable, debuggable memory with version control (git-backed) * **Model Agnostic** — Works with OpenAI, Anthropic Claude, local models via dynamic provider listings * **Letta Code** — Memory-first coding agent, #1 on TerminalBench (model-agnostic open-source) * **Agent Development Environment (ADE)** — No-code UI for building and testing agents * **REST API & SDKs** — Python and TypeScript SDKs, Vercel AI SDK provider * **Tool Integrations** — Composio, LangChain, CrewAI tool support * **Subagents & Skills** — Hierarchical agent composition with shared skill repositories ===== Architecture ===== Letta's memory-first architecture structures agents around a persistent state layer: graph TD A[LLM Reasoning Core: Observe - Reason - Act - Store] --> B[Core Memory: Identity / Goals / Context] A --> C[Archival Memory: Vector-stored Episodic and Semantic Facts] A --> D[Recall / Insertion Functions: Fetch and Prioritize] B --> E[Tools and Integrations] C --> E D --> E E --> F[Terminal] E --> G[Git] E --> H[Composio / LangChain] ===== Code Example ===== Creating a stateful agent with persistent memory using Letta: from letta import create_client # Connect to Letta server client = create_client() # Create an agent with persistent memory agent = client.create_agent( name="research_assistant", system=( "You are a research assistant with persistent memory. " "Remember all interactions and build knowledge over time. " "Use your archival memory to store important facts." ), memory_human="User is a machine learning researcher.", memory_persona="I am a helpful research assistant that remembers everything.", ) # Chat with the agent — it remembers across sessions response = client.send_message( agent_id=agent.id, message="I'm working on a paper about transformer architectures.", ) print(response.messages) # Later session — agent remembers the context response = client.send_message( agent_id=agent.id, message="What was I working on?", ) # Agent recalls: "You mentioned working on a paper about transformer architectures" print(response.messages) ===== Memory System ===== ^ Component ^ Description ^ Use Case ^ | **Core Memory** | Fixed-size, always-in-context self-knowledge | Identity, goals, behavioral anchoring | | **Archival Memory** | Vector-stored episodic/semantic facts | Long-term recall, knowledge accumulation | | **Recall Functions** | Fetch/prioritize memories before LLM calls | Context optimization, relevance scoring | Letta Filesystem achieves **74.0%** on the LoCoMo benchmark via simple file-based histories, demonstrating that effective long-term memory does not require complex architectures. ===== Evolution from MemGPT ===== * **2023** — MemGPT paper introduces virtual context windows via memory tiers * **Sep 2024** — Rebranded to Letta, expanded to full agent platform * **Oct 2024** — v0.4-0.5: Composio/LangChain/CrewAI tools, dynamic LLM providers * **Dec 2025** — Letta Code: stateful coding agent, #1 on TerminalBench * **Mar 2026** — Next phase: git-backed memory, subagents, cross-provider deployment ===== References ===== * [[https://github.com/letta-ai/letta|GitHub Repository]] * [[https://www.letta.com|Official Website]] * [[https://docs.letta.com|Documentation]] * [[https://github.com/letta-ai/letta-code|Letta Code]] ===== See Also ===== * [[langchain]] — General LLM framework (tool integration) * [[agno]] — High-performance agent runtime * [[pydantic_ai]] — Type-safe agent framework