What is Letta?
Letta (formerly MemGPT) gives AI agents persistent memory and the ability to manage context across long conversations. Agents can read/write to their own memory, enabling true long-term relationships and self-improvement.
Step 1: Install Letta
# Install Letta
pip install letta
# Configure
letta configure
Step 2: Create an Agent
from letta import create_client
client = create_client()
# Create agent with memory
agent = client.create_agent(
name="assistant",
memory_human="My name is Jackie",
memory_persona="You are a helpful assistant"
)
# Chat
response = client.send_message(
agent_id=agent.id,
message="Remember my favorite color is blue",
role="user"
)
# Later, ask about memory
response = client.send_message(
agent_id=agent.id,
message="What's my favorite color?",
role="user"
)
# Will respond: "Your favorite color is blue"
🎉 Letta is Ready!
You can now build AI agents with persistent memory. Explore more tools in the AI Toolkit.