diff --git a/src/agent/create.ts b/src/agent/create.ts index e55caf5..0280210 100644 --- a/src/agent/create.ts +++ b/src/agent/create.ts @@ -12,6 +12,7 @@ import { getClient } from "./client"; import { getDefaultMemoryBlocks } from "./memory"; import { formatAvailableModels, + getDefaultModel, getModelUpdateArgs, resolveModel, } from "./model"; @@ -120,8 +121,8 @@ export async function createAgent( } modelHandle = resolved; } else { - // Use default model - modelHandle = "anthropic/claude-sonnet-4-5-20250929"; + // Use default model from models.json + modelHandle = getDefaultModel(); } const client = await getClient(); diff --git a/src/cli/profile-selection.tsx b/src/cli/profile-selection.tsx index ac09bdb..2f64ab0 100644 --- a/src/cli/profile-selection.tsx +++ b/src/cli/profile-selection.tsx @@ -305,10 +305,6 @@ function ProfileSelectionUI({ Select a model - - The default model ({defaultModelHandle || "unknown"}) is not - available on this server. - {showModelSearch && ( diff --git a/src/index.ts b/src/index.ts index 3b94a9b..be8f46c 100755 --- a/src/index.ts +++ b/src/index.ts @@ -1094,6 +1094,9 @@ async function main(): Promise { LETTA_CLOUD_API_URL; const isSelfHosted = !baseURL.includes("api.letta.com"); + // Track whether we need model picker (for skipping ensureDefaultAgents) + let needsModelPicker = false; + if (isSelfHosted) { setSelfHostedBaseUrl(baseURL); try { @@ -1108,6 +1111,7 @@ async function main(): Promise { // Only set if default model isn't available if (!handles.includes(defaultModel)) { setAvailableServerModels(handles); + needsModelPicker = true; } } catch { // Ignore errors - will fail naturally during agent creation if needed @@ -1268,10 +1272,15 @@ async function main(): Promise { const wouldShowSelector = !localSettings.lastAgent && !forceNew && !agentIdArg && !fromAfFile; - if (wouldShowSelector && globalPinned.length === 0) { + if ( + wouldShowSelector && + globalPinned.length === 0 && + !needsModelPicker + ) { // New user with no pinned agents - create a fresh Memo agent // NOTE: Always creates a new agent (no server-side tag lookup) to avoid // picking up agents created by other users on shared orgs. + // Skip if needsModelPicker is true - let user select a model first. const { ensureDefaultAgents } = await import("./agent/defaults"); try { const memoAgent = await ensureDefaultAgents(client); @@ -1289,7 +1298,7 @@ async function main(): Promise { } } - // If there's a local LRU, use it directly + // If there's a local LRU, use it directly (takes priority over model picker) if (localSettings.lastAgent) { try { await client.agents.retrieve(localSettings.lastAgent); @@ -1303,6 +1312,12 @@ async function main(): Promise { } } + // On self-hosted with unavailable default model, show selector to pick a model + if (needsModelPicker) { + setLoadingState("selecting_global"); + return; + } + // Show selector if there are pinned agents to choose from if (wouldShowSelector && globalPinned.length > 0) { setLoadingState("selecting_global");