Skip to content
Letta Platform Letta Platform Letta Docs
Sign up

Letta Code SDK migration guide

Migrate from the Claude Agent SDK to the Letta Code SDK

The Claude Agent SDK is query-based and does not expose a persistent agent entity; state lives in a session/thread resumed by session_id. Letta Code SDK is agent-based with persistent memory, and also supports multiple conversation threads per agent. The closest mental model depends on which Claude SDK interface you’re using.

V2 uses createSession / resumeSession with an explicit send() / stream() cycle per turn. This maps closely to Letta Code SDK.

Claude Agent SDK V2Letta Code SDK
unstable_v2_prompt(...)prompt(...)
unstable_v2_createSession(...)createSession(...)
unstable_v2_resumeSession(session_id)resumeSession(conversationId)
session.send(...)session.send(...)
session.stream()session.stream()
  • Claude session_id corresponds to Letta conversationId.
  • Letta sessions are anchored to a persistent agent; Claude sessions are ephemeral unless you store the session ID.
  • If you want stateless behavior, use prompt(...) or create a fresh agent per run.

V1 streams results from a single query(...) async generator. In Letta Code SDK, use prompt(...) for one-shots or createSession(...).send() + stream() for multi-turn flows.

Claude Agent SDK V1Letta Code SDK
query({ prompt, options })prompt(message) or createSession(...).send()
FeatureClaude Agent SDKLetta Code SDK
Persistence modelSession-based (ephemeral)Agent-based (persistent)
MemorySession state onlyPersistent memory blocks
Model supportClaude onlyClaude, GPT, Gemini, local models
Multiple conversationsOne per sessionMultiple per agent
import { unstable_v2_createSession, unstable_v2_resumeSession } from "@anthropic-ai/claude-agent";
// Create new session
const session = await unstable_v2_createSession({
systemPrompt: "You are a helpful assistant.",
});
// Send message
await session.send("Hello!");
for await (const msg of session.stream()) {
console.log(msg);
}
// Resume later
const resumed = await unstable_v2_resumeSession(session.sessionId);
import { createAgent, createSession, resumeSession } from "@letta-ai/letta-code-sdk";
// Create new agent (persistent)
const agentId = await createAgent();
const session = createSession(agentId, {
systemPrompt: "You are a helpful assistant.",
});
// Send message
await session.send("Hello!");
for await (const msg of session.stream()) {
console.log(msg);
}
// Resume later (agent persists with memory)
const resumed = resumeSession(agentId);