feat: reduce time-to-boot, remove default eager approval checks on inputs, auto-cancel stale approvals (#579)

Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
Charles Packer
2026-01-17 16:19:30 -08:00
committed by GitHub
parent f4eb921af7
commit 5f5c0df18e
13 changed files with 1376 additions and 93 deletions

View File

@@ -271,26 +271,14 @@ export async function createAgent(
// Track provenance: which blocks were created
// Note: We no longer reuse shared blocks - each agent gets fresh blocks
const blockProvenance: BlockProvenance[] = [];
const blockIds: string[] = [];
// Create all blocks fresh for the new agent
// Mark new blocks for provenance tracking (actual creation happens in agents.create)
for (const block of filteredMemoryBlocks) {
try {
const createdBlock = await client.blocks.create(block);
if (!createdBlock.id) {
throw new Error(`Created block ${block.label} has no ID`);
}
blockIds.push(createdBlock.id);
blockProvenance.push({ label: block.label, source: "new" });
} catch (error) {
console.error(`Failed to create block ${block.label}:`, error);
throw error;
}
blockProvenance.push({ label: block.label, source: "new" });
}
// Add any referenced block IDs (existing blocks to attach)
// Mark referenced blocks for provenance tracking
for (const blockId of referencedBlockIds) {
blockIds.push(blockId);
blockProvenance.push({ label: blockId, source: "shared" });
}
@@ -314,7 +302,9 @@ export async function createAgent(
systemPromptContent = `${systemPromptContent}\n\n${options.systemPromptAppend}`;
}
// Create agent with all block IDs (existing + newly created)
// Create agent with inline memory blocks (LET-7101: single API call instead of N+1)
// - memory_blocks: new blocks to create inline
// - block_ids: references to existing blocks (for shared memory)
const tags = ["origin:letta-code"];
if (process.env.LETTA_CODE_AGENT_ROLE === "subagent") {
tags.push("role:subagent");
@@ -332,7 +322,11 @@ export async function createAgent(
model: modelHandle,
context_window_limit: contextWindow,
tools: toolNames,
block_ids: blockIds,
// New blocks created inline with agent (saves ~2s of sequential API calls)
memory_blocks:
filteredMemoryBlocks.length > 0 ? filteredMemoryBlocks : undefined,
// Referenced block IDs (existing blocks to attach)
block_ids: referencedBlockIds.length > 0 ? referencedBlockIds : undefined,
tags,
// should be default off, but just in case
include_base_tools: false,