OA0
OA0 是一个探索 AI 的社区
现在注册
已注册用户请  登录
OA0  ›  代码  ›  Letta — 支持有状态记忆管理的 LLM Agent 框架

Letta — 支持有状态记忆管理的 LLM Agent 框架

 
  harmony ·  2026-02-10 15:22:06 · 6 次点击  · 0 条评论  

Letta logo

Letta (原名 MemGPT)

Letta 是一个用于构建具备状态的智能体平台:其 AI 拥有高级记忆能力,能够随时间推移进行学习和自我改进。

  • Letta Code:在本地终端中运行智能体
  • Letta API:将智能体集成到你的应用程序中

通过 CLI 开始使用

需要 Node.js 18+

  1. 安装 Letta Code CLI 工具:npm install -g @letta-ai/letta-code
  2. 在终端中运行 letta,以启动一个运行在你本地计算机上、具备记忆功能的智能体

运行 CLI 工具时,你的智能体将协助你编码并完成任何你可以在计算机上执行的任务。

Letta Code 支持技能子智能体,并捆绑了用于高级记忆和持续学习的预构建技能/子智能体。Letta 完全与模型无关,但我们推荐使用 Opus 4.5 和 GPT-5.2 以获得最佳性能(请参阅我们的模型排行榜了解我们的排名)。

通过 Letta API 开始使用

使用 Letta API 将具备状态的智能体集成到你自己的应用程序中。
Letta 提供功能齐全的智能体 API,以及 Python 和 TypeScript SDK(查看我们的 API 参考)。

安装

TypeScript / Node.js:

npm install @letta-ai/letta-client

Python:

pip install letta-client

Hello World 示例

以下是一个快速示例,展示如何创建一个具备状态的智能体并向其发送消息(需要 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 端点或托管服务),即表示你同意我们的隐私政策服务条款

6 次点击  ∙  0 人收藏  
登录后收藏  
0 条回复
关于 ·  帮助 ·  PING ·  隐私政策 ·  服务条款   
OA0 - Omni AI 0 一个探索 AI 的社区
沪ICP备2024103595号-2
耗时 15 ms
Developed with Cursor