From e9a8054aba17304cab5ee96493eb01f1a0fb9366 Mon Sep 17 00:00:00 2001 From: paulbettner Date: Mon, 22 Dec 2025 02:21:40 -0600 Subject: [PATCH] feat: task tool: include subagent agent_id in output (#341) --- src/tools/impl/Task.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/tools/impl/Task.ts b/src/tools/impl/Task.ts index 002bf55..967c077 100644 --- a/src/tools/impl/Task.ts +++ b/src/tools/impl/Task.ts @@ -70,7 +70,16 @@ export async function task(args: TaskArgs): Promise { return `Error: ${result.error || "Subagent execution failed"}`; } - return result.report; + // Include stable subagent metadata so orchestrators can attribute results. + // Keep the tool return type as a string for compatibility. + const header = [ + `subagent_type=${subagent_type}`, + result.agentId ? `agent_id=${result.agentId}` : undefined, + ] + .filter(Boolean) + .join(" "); + + return `${header}\n\n${result.report}`; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); completeSubagent(subagentId, { success: false, error: errorMessage });