MCPcopy
hub / github.com/letta-ai/letta

github.com/letta-ai/letta @0.16.8 sqlite

repository ↗ · DeepWiki ↗ · release 0.16.8 ↗
8,936 symbols 49,425 edges 881 files 5,351 documented · 60%
README

Letta (formerly MemGPT)

Build AI with advanced memory that can learn and self-improve over time.

  • Letta Code: run agents locally in your terminal
  • Letta API: build agents into your applications

Get started in the CLI

Requires Node.js 18+

  1. Install the Letta Code CLI tool: npm install -g @letta-ai/letta-code
  2. Run letta in your terminal to launch an agent with memory running on your local computer

When running the CLI tool, your agent help you code and do any task you can do on your computer.

Letta Code supports skills and subagents, and bundles pre-built skills/subagents for advanced memory and continual learning. Letta is fully model-agnostic, though we recommend Opus 4.5 and GPT-5.2 for best performance (see our model leaderboard for our rankings).

Get started with the Letta API

Use the Letta API to integrate stateful agents into your own applications. Letta has a full-featured agents API, and a Python and Typescript SDK (view our API reference).

Installation

TypeScript / Node.js:

npm install @letta-ai/letta-client

Python:

pip install letta-client

Hello World example

Below is a quick example of creating a stateful agent and sending it a message (requires a Letta API key). See the full quickstart guide for complete documentation.

TypeScript:

import Letta from "@letta-ai/letta-client";

const client = new Letta({ apiKey: process.env.LETTA_API_KEY });

// Create your agent
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);

// Send your agent a message
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"))

# Create your agent
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}")

# Send your agent a message
response = client.agents.messages.create(
    agent_id=agent_state.id,
    input="What do you know about me?"
)

for message in response.messages:
    print(message)

Contributing

Letta is an open source project built by over a hundred contributors from around the world. There are many ways to get involved in the Letta OSS project!


Legal notices: By using Letta and related Letta services (such as the Letta endpoint or hosted service), you are agreeing to our privacy policy and terms of service.

Extension points exported contracts — how you extend this code

TaskObserver (Interface)
(no doc)
tests/data/task_manager.java

Core symbols most depended-on inside this repo

get
called by 1561
letta/data_sources/redis_client.py
create
called by 549
letta/orm/archive.py
async_session
called by 404
letta/server/db.py
execute
called by 402
letta/services/tool_executor/tool_executor_base.py
error
called by 344
letta/server/rest_api/interface.py
default_config
called by 337
letta/schemas/llm_config.py
model_dump
called by 268
letta/schemas/tool.py
get_actor_or_default_async
called by 238
letta/services/user_manager.py

Shape

Function 4,184
Method 3,302
Class 1,141
Route 301
Struct 4
Enum 3
Interface 1

Languages

Python99%
Java1%
Go1%
TypeScript1%

Modules by API surface

tests/test_managers.py438 symbols
letta/server/rest_api/routers/v1/agents.py128 symbols
tests/managers/test_tool_manager.py102 symbols
letta/schemas/providers.py101 symbols
letta/errors.py94 symbols
tests/test_agent_serialization_v2.py91 symbols
tests/integration_test_async_tool_sandbox.py81 symbols
letta/services/agent_manager.py74 symbols
tests/integration_test_conversations_sdk.py73 symbols
tests/test_tool_rule_solver.py70 symbols
tests/test_sdk_client.py70 symbols
letta/data_sources/redis_client.py70 symbols

Dependencies from manifests, versioned

@types/node24.1.0 · 1×
typescript5.8.3 · 1×
Pygments2.19.1 · 1×
annotated-types0.7.0 · 1×
anyio4.9.0 · 1×
certifi2025.4.26 · 1×
click8.1.8 · 1×
h110.16.0 · 1×
httpcore1.0.9 · 1×
httpx0.28.1 · 1×
httpx-sse0.4.0 · 1×
idna3.10 · 1×

Datastores touched

dbDatabase · 1 repos

For agents

$ claude mcp add letta \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact