From 5a696e611665bf07d2ed3c536b7dc23ecd8d2bab Mon Sep 17 00:00:00 2001 From: Charles Packer Date: Thu, 12 Feb 2026 17:21:18 -0800 Subject: [PATCH] fix: add auto-notification guidance to background task return value (#942) Co-authored-by: Letta --- src/tools/impl/Task.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/tools/impl/Task.ts b/src/tools/impl/Task.ts index e021624..730572c 100644 --- a/src/tools/impl/Task.ts +++ b/src/tools/impl/Task.ts @@ -426,7 +426,14 @@ export async function task(args: TaskArgs): Promise { await waitForBackgroundSubagentLink(subagentId, null, signal); - return `Task running in background with ID: ${taskId}\nOutput file: ${outputFile}`; + // Extract Letta agent ID from subagent state (available after link resolves) + const linkedAgent = getSubagentSnapshot().agents.find( + (a) => a.id === subagentId, + ); + const agentId = linkedAgent?.agentURL?.split("/agents/")[1] ?? null; + const agentIdLine = agentId ? `\nAgent ID: ${agentId}` : ""; + + return `Task running in background with task ID: ${taskId}${agentIdLine}\nOutput file: ${outputFile}\n\nYou will be notified automatically when this task completes — a message will be delivered with the result. No need to poll, sleep-wait, or check the output file. Just continue with your current work.`; } // Register subagent with state store for UI display (foreground path)