MemGPT / Letta
Stateful agent framework formerly known as MemGPT. Renamed to Letta in September 2024. PyPI package moved from memgpt to letta. Two packages: letta (full server runtime) and letta-client (API client only). Agents are server-side persistent resources, not in-process Python objects.
Warnings
- breaking pip install memgpt is abandoned. Package renamed to letta in September 2024. All memgpt.* imports fail.
- breaking Letta agents are server-side resources, not in-process Python objects. You cannot instantiate an agent locally without a running Letta server.
- breaking Old memgpt API patterns (create_client(), Agent(), memgpt.run()) do not exist in the letta package. Architecture changed completely.
- gotcha letta (full package) and letta-client are different packages with different APIs. Most application code only needs letta-client.
- gotcha MemGPT as a term now refers only to the research paper's agent design pattern, not the framework. Searching 'MemGPT Python' returns a mix of abandoned pymemgpt, transition-era letta 0.x, and current letta-client code — all incompatible.
Install
-
pip install letta-client -
pip install letta -
docker run -v ~/.letta/.persist/pgdata:/var/lib/postgresql/data -p 8283:8283 -e OPENAI_API_KEY=your_key letta/letta:latest
Imports
- Letta
from letta_client import Letta
- Letta (server)
from letta import create_client
Quickstart
from letta_client import Letta
import os
client = Letta(api_key=os.getenv("LETTA_API_KEY"))
agent = client.agents.create(
model="openai/gpt-4o",
memory_blocks=[
{"label": "human", "value": "Name: Alice"},
{"label": "persona", "value": "I am a helpful assistant."}
]
)
response = client.agents.messages.create(
agent.id,
input="Hello, remember my name."
)
print(response.messages[0].content)