Skip to content
Letta Platform Letta Platform Letta Docs
Sign up
V1 SDK (legacy)

Letta V1 SDK

Using the Letta V1 SDK to build stateful agents

There are two main ways to build stateful agents using Letta’s developer platform: the Letta Agent SDK and the Letta V1 SDK.

The Letta Agent SDK builds on top of the state-of-the-art Letta Code agent harness, which gives your agent the ability to use advanced computer-use tools, use skills, and call subagents. Agents running in the Letta Agent SDK have access to MemFS, our latest memory system which is git-tracked and leverages agent dreaming.

We recommend all new developers build on the Agent SDK to take advantage of the latest features.

The Agent SDK includes many powerful new features that allow you to build stateful agents that truly feel like persistent digital people or coworkers: MemFS and dreaming, self-modifying harness extensions (mods), native channel integrations (Slack, Telegram, and more), and intelligent pre-optimized toolsets for local computer use.

The Agent SDK also allows your to easily connect to both Letta’s agent cloud (Constellation) and your own self-hosted deployment. Note that the Agent SDK is currently only available in TypeScript.

FeatureV1 SDKV2 SDK (Agent SDK)
TypeScriptYesYes
PythonYesNo
Self-hosting optionNoYes
Server-side toolsYesNo (except web search)
SkillsNoYes
SubagentsNoYes
Mods / extensionsNoYes
Channels (Slack, Telegram, etc.)NoYes
MemFS / git-tracked memoryNo (memory blocks only)Yes
Pre-made bash toolsetsNoYes
Persistent filesystemNoYes
Most similar toOpenAI Responses APIClaude Agent SDK, Codex SDK, OpenCode SDK

Requires a Letta API key (free to create).

  1. Set your API key

    Get your Letta API key and set it as an environment variable:

    Terminal window
    export LETTA_API_KEY='your-api-key-here'
  2. Install the SDK

    Terminal window
    npm install @letta-ai/letta-client
  3. Create your code

    Save this as quickstart.ts:

    import Letta from "@letta-ai/letta-client";
    async function main() {
    const client = new Letta({ apiKey: process.env.LETTA_API_KEY });
    // Create a stateful agent
    const agent = await client.agents.create({
    model: "openai/gpt-4.1",
    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.",
    },
    ],
    });
    console.log("Agent created with ID:", agent.id);
    // Send a message
    const response = await client.agents.messages.create(agent.id, {
    input: "What do you know about me?",
    });
    for (const message of response.messages) {
    console.log(message);
    }
    }
    main().catch(console.error);
  4. Run your code

    Terminal window
    npx tsx quickstart.ts

    Example output:

    Agent created with ID: agent-abc123
    { message_type: 'reasoning_message', reasoning: 'Timber is asking what I know...' }
    { message_type: 'assistant_message', content: "I know you're Timber, a dog who's building Letta!" }