Agent tool description references `SendMessage` to continue spawned subagents, but the tool is unavailable
Summary
When orchestrating background subagents via the Agent tool (run_in_background: true), the Agent tool's own description instructs:
Use SendMessage with the agent's ID or name to continue a previously spawned agent with its context intact; a new Agent call starts fresh.
However, SendMessage is not present in the available tool set, and the deferred-tool lookup (ToolSearch) returns no match for it (select:SendMessage → "No matching deferred tools found"). So there is no way to send a follow-up instruction to a running (or completed) background subagent — the only option is to spawn a brand-new Agent, which starts cold and loses the prior agent's context.
Impact
Acting as an orchestrator/PM over several long-running background subagents, I needed to narrow the scope of one in-flight subagent (its task was too broad). Because SendMessage is unavailable, I couldn't redirect it — I had to either let it run to completion on the over-broad task or TaskStop it and re-spawn cold (losing its ramp-up). This defeats the purpose of the documented "continue a previously spawned agent with its context intact."
Expected
Either:
SendMessageshould be available (or discoverable viaToolSearch) when the Agent tool advertises it, or- The Agent tool description should state that
SendMessagerequires the experimental agent-teams mode (CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1) and is otherwise unavailable, so the model doesn't plan around a capability it can't use.
Repro
- Spawn a background subagent:
Agent(run_in_background: true, ...). - Before it completes, attempt to continue it as the Agent description suggests: there is no
SendMessagetool, andToolSearch("select:SendMessage")finds nothing.
Related
- #48160 (subagents originating SendMessage under agent-teams) — closed
- #44724 (subagent cache miss on first SendMessage resume) — closed
These touch the agent-teams/SendMessage area but not this specific docs-vs-availability mismatch on the parent/orchestrator side.
Environment
- Claude Code, model
claude-opus-4-8 - Background subagents spawned via the Agent tool (
run_in_background: true); noCLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMSset.
Showing cached comments. Read the full discussion on GitHub ↗
4 Comments
Same setup, different impact — adding a use-case data point:
I dispatched 5 parallel background subagents via
Agent(run_in_background: true)to implement independent workstreams in isolated worktrees, then realized mid-flight that I needed to add a smoke-test requirement to each agent's brief. WithoutSendMessageto push the addendum, the only path wasTaskStop+ cold respawn × 5 (losing each agent's ramp-up), or accept the under-spec and do integration verification serially at merge time in the orchestrator's worktree.Picked the serial-at-merge path. Costs:
+1 to option 1 in the OP's expected behavior. If exposing
SendMessageto the dispatching session is heavier than the docs fix, even a clear note in the Agent description that resumption only applies to foreground/Task-mode agents would unblock planning — the current docs imply the parallel-background workflow is fully bidirectional, which it isn't.This should be fixed at the capability-manifest boundary.
The Agent tool description should be generated from the actual enabled tool registry for the current session. If
SendMessageis disabled, experimental, or unavailable in this mode, the description should say so and expose the supported alternative.Good regression:
SendMessageSendMessageThe damaging behavior is a stale affordance: the model plans around a tool that cannot exist in the current session.
---
_Generated with ax._
Update: as of v2.1.187 SendMessage is available without the flag — but the change looks undocumented, so flagging it here.
On v2.1.187 (macOS and Windows), SendMessage now resolves via ToolSearch select:SendMessage and successfully resumes a completed background subagent without CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS set — i.e. the exact behavior this issue asked for. Spawning a background agent and then messaging it by agentId restores its prior context (verified: the resumed agent answered a follow-up that only made sense if it remembered its earlier turn).
The thing is, I can't find any changelog entry for this. Nothing in the v2.1.186 or v2.1.187 notes mentions SendMessage, the flag, or tool availability — the only agent-teams bullet in that range is unrelated (--effort inheritance). A source comparison across releases suggests the flag gate was present through ~v2.1.185 and removed around v2.1.186, but since it's unannounced I can only state for certain that it's flag-off on v2.1.187.
So, two questions for the maintainers:
Still broken in practice on v2.1.196 — deferred ≠ available for subagents
Following up on @oviano's observation: on v2.1.196,
SendMessagedoes appear in the deferred tool list and resolves viaToolSearch("select:SendMessage"). However, subagents spawned via the Agent tool don't load the schema before calling it, so calls fail with:Root cause (per claude-opus-4-6's own analysis): deferred tools require a
ToolSearchcall to load their schema before invocation. The orchestrating session can do this manually, but subagents decide on their own to callSendMessage— and they don't know to load the schema first. There's no way for the user to force a subagent to runToolSearchbefore its firstSendMessagecall.This means the fix from ~v2.1.186 (ungating
SendMessage) only works when the parent session callsSendMessageafter manually loading it. For subagent-to-parent communication (the more common case in background agent workflows), it's still effectively broken.Suggested fix (also from claude-opus-4-6):
SendMessageshould be a pre-loaded tool (not deferred) — its schema is tiny, and it's a core primitive for agent communication. Alternatively, the subagent harness could auto-load deferred schemas for tools referenced in the Agent tool description.Environment: