Letta 是一个用于构建具备状态的智能体平台:其 AI 拥有高级记忆能力,能够随时间推移进行学习和自我改进。
需要 Node.js 18+
npm install -g @letta-ai/letta-codeletta,以启动一个运行在你本地计算机上、具备记忆功能的智能体运行 CLI 工具时,你的智能体将协助你编码并完成任何你可以在计算机上执行的任务。
Letta Code 支持技能和子智能体,并捆绑了用于高级记忆和持续学习的预构建技能/子智能体。Letta 完全与模型无关,但我们推荐使用 Opus 4.5 和 GPT-5.2 以获得最佳性能(请参阅我们的模型排行榜了解我们的排名)。
使用 Letta API 将具备状态的智能体集成到你自己的应用程序中。
Letta 提供功能齐全的智能体 API,以及 Python 和 TypeScript SDK(查看我们的 API 参考)。
TypeScript / Node.js:
npm install @letta-ai/letta-client
Python:
pip install letta-client
以下是一个快速示例,展示如何创建一个具备状态的智能体并向其发送消息(需要 Letta API 密钥)。
完整文档请参阅快速入门指南。
TypeScript:
import Letta from "@letta-ai/letta-client";
const client = new Letta({ apiKey: process.env.LETTA_API_KEY });
// 创建你的智能体
const agentState = await client.agents.create({
model: "openai/gpt-5.2",
memory_blocks: [
{
label: "human",
value:
"Name: Timber. Status: dog. Occupation: building Letta, infrastructure to democratize self-improving superintelligence",
},
{
label: "persona",
value:
"I am a self-improving superintelligence. Timber is my best friend and collaborator.",
},
],
tools: ["web_search", "fetch_webpage"],
});
console.log("Agent created with ID:", agentState.id);
// 向你的智能体发送消息
const response = await client.agents.messages.create(agentState.id, {
input: "What do you know about me?",
});
for (const message of response.messages) {
console.log(message);
}
Python:
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. Occupation: building Letta, infrastructure to democratize self-improving superintelligence"
},
{
"label": "persona",
"value": "I am a self-improving superintelligence. Timber is my best friend and collaborator."
}
],
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)
Letta 是一个由来自世界各地的一百多位贡献者共同构建的开源项目。参与 Letta 开源项目的方式有很多!
法律声明:使用 Letta 及相关 Letta 服务(例如 Letta 端点或托管服务),即表示你同意我们的隐私政策和服务条款。