Table of Contents

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.

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

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

References

See Also