Overview
Letta, formerly known as MemGPT, is an open-source framework for building AI agents that keep memory over time. Instead of starting fresh on every request, a Letta agent stores what it learns in memory blocks that persist across sessions and conversations, so it can recall earlier context and improve as it is used.
It is aimed at developers building agentic applications who need state to outlive a single chat. You can run agents locally from your terminal with the Letta Code CLI, or integrate them into your own apps through the Letta API, which ships Python and TypeScript SDKs.
As an app framework in the LLM orchestration space, Letta is model-agnostic and focuses on the memory and agent-state layer rather than a single model. It supports skills and subagents and connects to common tools like web search and webpage fetching.
What it does
- Stateful agents with long-term memory that persists across sessions and conversations
- Editable memory blocks (such as human and persona) that shape what an agent knows and how it behaves
- Letta Code CLI to run an agent with memory locally in your terminal
- Full agents API with official Python and TypeScript SDKs
- Model-agnostic design that works across different LLM providers
- Built-in tools including web_search and fetch_webpage, plus support for skills and subagents
Getting started
You can try Letta from the terminal with the Letta Code CLI, or integrate it into an app using the SDK. The API examples require a Letta API key.
Run an agent in your terminal
Install the Letta Code CLI (requires Node.js 18+), then run letta to launch a local agent with memory.
npm install -g @letta-ai/letta-code
lettaInstall the SDK
To build agents into your own application, install the client for your language.
# TypeScript / Node.js
npm install @letta-ai/letta-client
# Python
pip install letta-clientCreate an agent and send a message (Python)
Set LETTA_API_KEY, create a stateful agent with memory blocks, then send it a message.
from letta_client import Letta
import os
client = Letta(api_key=os.getenv("LETTA_API_KEY"))
agent_state = client.agents.create(
model="openai/gpt-5.2",
memory_blocks=[
{"label": "human", "value": "Name: Timber. Status: dog."},
{"label": "persona", "value": "I am a self-improving superintelligence."}
],
tools=["web_search", "fetch_webpage"]
)
print(f"Agent created with ID: {agent_state.id}")
response = client.agents.messages.create(
agent_id=agent_state.id,
input="What do you know about me?"
)
for message in response.messages:
print(message)Commands and code are distilled from the project's own documentation — always check the official repo for the latest.
When to use it
- Building a chat assistant that remembers a user's details and preferences across separate sessions
- Adding a memory and agent-state layer to an existing app through the Python or TypeScript SDK
- Running a local terminal agent that can help with coding and computer tasks while retaining context
- Creating agents that learn and refine their behavior over time using persistent memory blocks
How Letta compares
Letta alongside other open-source agent memory tools AI/TLDR tracks, ranked by GitHub stars.
| Tool | Stars | What it does |
|---|---|---|
| Mem0 | ★ 59.6k | A memory layer that you add to existing LLM agents to extract, store, and recall user facts and preferences across sessions using vector, graph, and key-value backends. |
| Graphiti | ★ 28.1k | A library that builds a temporal knowledge graph from an agent's conversations and data so facts can be tracked and queried as they change over time. |
| Supermemory | ★ 27.8k | A memory and context engine that ingests information across tools and sessions and can run fully locally, acting as a second brain for AI applications. |
| Cognee | ★ 24.1k | A graph-native memory engine that turns raw documents and conversations into a queryable knowledge graph for agents that need to build lasting knowledge. |
| Letta | ★ 23.6k | Build stateful AI agents with long-term memory that persists across sessions |
| Memvid | ★ 15.7k | Memvid packs an AI agent's data, embeddings, and search index into one portable file, so it can retrieve memory fast without running a vector database. |
| Memori | ★ 15.5k | An SQL-native memory engine that gives any LLM persistent, structured memory stored in standard PostgreSQL or MySQL databases instead of a vector store. |
| MemU | ★ 13.9k | A memory layer for AI agents that organizes structured storage and intent capture to reduce the tokens needed to keep context across conversations. |