# Letta — AI Agent Long-Term Memory Framework > Build AI agents with persistent memory using MemGPT architecture. Letta manages context windows automatically with tiered memory for stateful LLM applications. ## Install Save as a script file and run: ## Quick Use ```bash pip install letta letta server ``` ```python from letta import create_client client = create_client() agent = client.create_agent( name="my_agent", memory=client.create_block("You are a helpful assistant.", label="system"), ) response = agent.send_message("Remember: my favorite color is blue.") print(response.messages) ``` ## What is Letta? Letta (formerly MemGPT) is a framework for building AI agents with persistent, long-term memory. It solves the context window limitation by implementing a tiered memory architecture — core memory (always in context), recall memory (conversation history), and archival memory (unlimited storage). The agent manages its own memory, deciding what to remember and forget. **Answer-Ready**: Letta is an AI agent framework with persistent memory management. Uses tiered memory (core/recall/archival) to overcome context window limits. Formerly MemGPT. Agents self-manage memory across conversations. 12k+ GitHub stars. **Best for**: Developers building stateful AI agents that need to remember across sessions. **Works with**: OpenAI, Anthropic, local models via Ollama. **Setup time**: Under 3 minutes. ## Core Features ### 1. Tiered Memory Architecture | Memory Tier | Purpose | Size | |-------------|---------|------| | Core | Always in context, editable by agent | ~2K tokens | | Recall | Searchable conversation history | Unlimited | | Archival | Long-term knowledge storage | Unlimited | ### 2. Agent Self-Management ```python # Agent decides what to save agent.send_message("My meeting is at 3pm tomorrow with Sarah about the Q2 budget.") # Agent automatically stores this in archival memory ``` ### 3. Tool Use ```python from letta import tool @tool def search_web(query: str) -> str: "Search the web for information." # Your search implementation return results agent = client.create_agent(tools=[search_web]) ``` ### 4. REST API Server ```bash letta server --port 8283 # Full REST API for agent management # POST /v1/agents - Create agent # POST /v1/agents/{id}/messages - Send message ``` ## Use Cases | Use Case | How | |----------|-----| | Personal Assistant | Remember user preferences across sessions | | Customer Support | Track customer history and context | | Research Agent | Accumulate findings over long investigations | | Coding Companion | Remember codebase context and decisions | ## FAQ **Q: How does it differ from RAG?** A: RAG retrieves from static documents. Letta agents actively manage their own memory — writing, updating, and deleting memories as conversations evolve. **Q: Can I use local models?** A: Yes, supports Ollama, vLLM, and any OpenAI-compatible endpoint. **Q: Is it production-ready?** A: Yes, Letta Cloud offers managed hosting. Self-hosted server supports Docker deployment. ## Source & Thanks > Created by [Letta Team](https://github.com/letta-ai). Licensed under Apache 2.0. > > [letta-ai/letta](https://github.com/letta-ai/letta) — 12k+ stars ## 快速使用 ```bash pip install letta letta server ``` 三行代码创建具有持久记忆的 AI Agent。 ## 什么是 Letta? Letta(原 MemGPT)是构建具有长期记忆的 AI Agent 框架。通过分层记忆架构(核心/回忆/归档)突破上下文窗口限制,Agent 自主管理记忆。 **一句话总结**:AI Agent 长期记忆框架,分层记忆架构突破上下文限制,Agent 自主决定记住和遗忘,12k+ stars。 **适合人群**:需要跨会话记忆的 AI Agent 开发者。 ## 核心功能 ### 1. 分层记忆 核心记忆(始终在上下文中)、回忆记忆(对话历史)、归档记忆(无限存储)。 ### 2. Agent 自主管理 Agent 自动决定哪些信息存入长期记忆。 ### 3. 工具调用 支持自定义工具,Python 装饰器定义。 ### 4. REST API 内置服务器,完整 REST API 管理 Agent。 ## 常见问题 **Q: 和 RAG 有什么区别?** A: RAG 从静态文档检索,Letta Agent 主动管理自己的记忆。 **Q: 支持本地模型?** A: 支持 Ollama、vLLM 等。 ## 来源与致谢 > [letta-ai/letta](https://github.com/letta-ai/letta) — 12k+ stars, Apache 2.0 --- Source: https://tokrepo.com/en/workflows/4a18797f-d627-4282-952d-df53680a19f0 Author: Agent Toolkit