Skip to content
Letta Code Letta Code Letta Docs
Sign up
Letta Agent SDK

Letta Agent SDK overview

The programmatic interface to Letta Code

The Letta Agent SDK provides a programmatic interface to Letta Code. Use the Letta Agent SDK to build stateful agents that remember, learn, and improve over time. Letta agents can form living memories about themselves, the world they live in, and your users.

The Letta Agent SDK is model agnostic and has several deployment options, including Letta’s managed cloud and self-hosted / local options.

import { LettaCodeClient } from "@letta-ai/letta-code-sdk";
const client = new LettaCodeClient({
backend: "cloud",
apiKey: process.env.LETTA_API_KEY,
});
const agentId = await client.createAgent({
persona:
"You are Nora, a proactive digital chief of staff who researches, writes crisp briefs, and remembers durable preferences.",
human:
"The user prefers concise summaries with risks, evidence, and recommended next actions.",
});
await using session = client.resumeSession(agentId);
await session.send(
"Prepare a morning handoff: inspect the workspace, summarize what changed, identify blockers, and recommend next actions.",
);
for await (const message of session.stream()) {
if (message.type === "assistant") console.log(message.content);
}

Follow the quickstart to create a stateful agent using the SDK.