This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

Stream agent output in island:analyze

Use session.send() + session.stream() instead of runTurn() so the
agent thinking, tool calls, and results are logged to stderr in
real-time as the analysis runs.

👾 Generated with [Letta Code](https://letta.com)

Co-Authored-By: Letta Code <noreply@letta.com>

author
nandi
co-author
Letta Code
date (May 15, 2026, 6:02 AM UTC) commit 41b1779d parent b81ec113
+20 -1
+20 -1
src/island-analyze.ts
··· 21 21 type AnyAgentTool, 22 22 type AgentToolResult, 23 23 type SDKResultMessage, 24 + type SDKMessage, 24 25 } from '@letta-ai/letta-code-sdk'; 25 26 import { loadDotEnv } from './cli-utils.js'; 26 27 import { findComponents, domainFromUrl, type Component, type EdgeRow, fetchComponentEdges, resolveDidHandles } from './island-shared.js'; ··· 345 346 346 347 ${context}`; 347 348 348 - const result: SDKResultMessage = await session.runTurn(prompt); 349 + // Send prompt and stream agent output in real-time 350 + session.send(prompt); 351 + for await (const msg of session.stream()) { 352 + if (msg.type === 'assistant') { 353 + console.error(` [agent] ${msg.content}`); 354 + } else if (msg.type === 'tool_call') { 355 + const input = JSON.stringify(msg.toolInput); 356 + console.error(` [tool:${msg.toolName}] ${input.slice(0, 200)}${input.length > 200 ? '...' : ''}`); 357 + } else if (msg.type === 'tool_result') { 358 + console.error(` [result] ${msg.content.slice(0, 100)}${msg.content.length > 100 ? '...' : ''}`); 359 + } else if (msg.type === 'result') { 360 + // Terminal result — stream ends 361 + const r = msg as SDKResultMessage; 362 + if (!r.success) { 363 + console.error(` Agent failed: ${r.error ?? r.errorCode ?? 'unknown'}`); 364 + } 365 + break; 366 + } 367 + } 349 368 350 369 if (!result.success) { 351 370 console.error(` Agent failed: ${result.error ?? result.errorCode ?? 'unknown'}`);