fix: localhost improvements (#667)

Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
Charles Packer
2026-01-24 18:39:17 -08:00
committed by GitHub
parent 49e02e438c
commit 417e1bafdd
6 changed files with 381 additions and 24 deletions

View File

@@ -281,9 +281,11 @@ export async function createAgent(
blockProvenance.push({ label: blockId, source: "shared" });
}
// Get the model's context window from its configuration
// Get the model's context window from its configuration (if known)
// For unknown models (e.g., from self-hosted servers), don't set a context window
// and let the server use its default
const modelUpdateArgs = getModelUpdateArgs(modelHandle);
const contextWindow = (modelUpdateArgs?.context_window as number) || 200_000;
const contextWindow = modelUpdateArgs?.context_window as number | undefined;
// Resolve system prompt content:
// 1. If systemPromptCustom is provided, use it as-is
@@ -319,7 +321,7 @@ export async function createAgent(
description: agentDescription,
embedding: embeddingModelVal || undefined,
model: modelHandle,
context_window_limit: contextWindow,
...(contextWindow && { context_window_limit: contextWindow }),
tools: toolNames,
// New blocks created inline with agent (saves ~2s of sequential API calls)
memory_blocks: