Summary
When using sessions_spawn to run sub-agents, the announce result is always posted directly to the requester chat channel (e.g., Slack DM, WhatsApp). There is no way to route the announce back to the parent agent session first, so the parent can review, filter, summarize, or gate the output before it reaches the user.
This makes it difficult to build orchestrator patterns where the main agent acts as a coordinator — spawning multiple sub-agents and intelligently relaying their results.
Current flow:
Parent agent → spawns sub-agent → sub-agent finishes → announce → directly to user chat
(parent is bypassed)
Desired flow:
Parent agent → spawns sub-agent → sub-agent finishes → announce → parent session (system event)
→ parent reviews/filters
→ parent relays to user
Proposed solution
Add an announce parameter to sessions_spawn:
sessions_spawn({
task: "...",
announce: "user" | "parent" | "skip" // default: "user" (current behavior)
})
"user" (default): Current behavior — announce goes directly to the requester chat channel.
"parent": Inject the announce result as a system event into the spawning (parent) session. The parent agent can then decide what to relay.
"skip": Equivalent to current ANNOUNCE_SKIP behavior — nothing is posted.
When announce: "parent", the system event injected into the parent session should include:
- Sub-agent status (success/error/timeout)
- The announce summary text
childSessionKey and sessionId for sessions_history follow-up
- Token usage and cost stats
Relevant source files
src/agents/tools/sessions-spawn-tool.ts — spawn tool params
src/agents/subagent-announce.ts — announce execution logic
src/agents/tools/sessions-announce-target.ts — announce target resolution (key file for this change)
src/agents/subagent-announce-queue.ts — announce queue
src/config/types.agent-defaults.ts — agent defaults schema
Documentation reference
Current behavior documented in docs/tools/subagents.md:
"The announce step runs inside the sub-agent session (not the requester session)."
"The announce reply is posted to the requester chat channel via a follow-up agent call (deliver=true)."
Alternatives considered
-
ANNOUNCE_SKIP + manual polling: Parent spawns with task ending in "reply ANNOUNCE_SKIP", then polls sessions_history. Works but is fragile — parent has no trigger to know when to poll.
-
Constraining announce content via task instructions: Currently used (e.g., "prefix with 🤖, be factual"). Limits noise but doesn't give the parent agent control over delivery.
-
sessions_send from sub-agent to parent: Sub-agents don't have session tools by default (by design), so this isn't possible without relaxing tool policy.
Additional context
Summary
When using
sessions_spawnto run sub-agents, the announce result is always posted directly to the requester chat channel (e.g., Slack DM, WhatsApp). There is no way to route the announce back to the parent agent session first, so the parent can review, filter, summarize, or gate the output before it reaches the user.This makes it difficult to build orchestrator patterns where the main agent acts as a coordinator — spawning multiple sub-agents and intelligently relaying their results.
Current flow:
Desired flow:
Proposed solution
Add an
announceparameter tosessions_spawn:"user"(default): Current behavior — announce goes directly to the requester chat channel."parent": Inject the announce result as a system event into the spawning (parent) session. The parent agent can then decide what to relay."skip": Equivalent to currentANNOUNCE_SKIPbehavior — nothing is posted.When
announce: "parent", the system event injected into the parent session should include:childSessionKeyandsessionIdforsessions_historyfollow-upRelevant source files
src/agents/tools/sessions-spawn-tool.ts— spawn tool paramssrc/agents/subagent-announce.ts— announce execution logicsrc/agents/tools/sessions-announce-target.ts— announce target resolution (key file for this change)src/agents/subagent-announce-queue.ts— announce queuesrc/config/types.agent-defaults.ts— agent defaults schemaDocumentation reference
Current behavior documented in
docs/tools/subagents.md:Alternatives considered
ANNOUNCE_SKIP+ manual polling: Parent spawns with task ending in "reply ANNOUNCE_SKIP", then pollssessions_history. Works but is fragile — parent has no trigger to know when to poll.Constraining announce content via task instructions: Currently used (e.g., "prefix with 🤖, be factual"). Limits noise but doesn't give the parent agent control over delivery.
sessions_sendfrom sub-agent to parent: Sub-agents don't have session tools by default (by design), so this isn't possible without relaxing tool policy.Additional context