Allow Workflow agent() subagents to spawn nested subagents (grant the Agent tool)

Open 💬 1 comment Opened Jun 17, 2026 by otavio

Summary

Subagents spawned by a Workflow script's agent() call are not granted the
Agent/Task tool, so they cannot spawn nested subagents — even though the
general "subagents can spawn subagents" feature shipped in v2.1.172. Please make
nested spawning available to Workflow agent() subagents too, ideally as an
opt-in per agent() call.

Current behavior (verified on CLI 2.1.177)

Inside a Workflow({ script }) run, an agent() subagent's toolset has no
Agent/Task tool, and ToolSearch "select:Agent,Task" returns
No matching deferred tools found — it is genuinely absent, not merely unloaded.
This holds across every agentType I tried, including the Tools: * catch-alls
(default, general-purpose, claude).

The v2.1.172 "Spawn nested subagents" docs describe the Agent-tool delegation
path
only; the Workflow agent() path is documented separately and says
nothing about tool grants or nesting, and there's no documented agent() option
to enable it.

Why this matters

Workflows are the recommended way to run deterministic, multi-stage
orchestration. But a workflow often wants an agent() worker to call a skill or
agent that is itself a fan-out (anything that internally delegates via the Agent
tool). Today that's impossible from a workflow: the inner Agent calls have no
tool to invoke, so any skill that spawns its own subagents can't be used from a
workflow at all.

The only workaround is to re-implement that skill's internal orchestration
directly in workflow JS, which duplicates logic that then drifts from the real
skill. Granting nested spawning would let a workflow reuse existing skills/agents
as-is instead of reproducing them.

Proposed solution

Let a Workflow agent() call opt into receiving the Agent tool, e.g.:

await agent(prompt, { agentType: "general-purpose", allowAgentTool: true })

(or honor the resolved agentType's tools / allowedTools the same way the
Agent-tool path does). The existing depth-≤5 nesting cap and per-run
concurrency/total-agent limits would still apply.

Reproduction

Run a minimal workflow whose single agent() asks the subagent to list its tools
and call ToolSearch "select:Agent,Task". Result: no Agent/Task tool, and
No matching deferred tools found. Repeat with agentType set to
general-purpose / claude — same result.

Environment

  • Claude Code CLI 2.1.177
  • Workflow tool (dynamic agent() / parallel() / pipeline() scripts)

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗