[FEATURE] Support fork agents in Workflow scripts

Status Open
Reported on v2.1.216
Maintainer reply None cached
Activity 0 comments · opened Jul 20, 2026

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

The Agent tool can spawn a fork. A fork starts with the full conversation, so it already knows everything the session has worked out and I do not have to repeat any of it in the prompt. The Workflow tool cannot do this. Its agent() accepts an agentType option, but "fork" is not among the accepted types, so every agent inside a workflow starts blank.

In practice the two features do not work together. I use forks for all my subagents so they know the session context. The moment a fan-out moves into a workflow that is lost. The main session then has to write the context into every agent prompt itself. Whatever it forgets to write in, the agents do not know.

Steps to reproduce (on 2.1.216, with CLAUDE_CODE_FORK_SUBAGENT=1 set):

  1. In a session with some history, ask Claude to run this workflow:
export const meta = {
  name: "fork-probe",
  description: "probe fork support",
  phases: [{ title: "Probe" }],
};
phase("Probe");
return await agent("Reply with one fact from earlier in this conversation.", {
  agentType: "fork",
});
  1. The agent() call fails immediately:
Error: agent({agentType}): agent type 'fork' not found. Available agents: claude, claude-code-guide, Explore, general-purpose, Plan, ...

Proposed Solution

Accept agentType: "fork" in workflow agent() calls, with the same behavior the Agent tool already has: the agent starts with the parent conversation as it was at launch and a model override is ignored.

Alternative Solutions

Today the main session writes the relevant context into each agent prompt itself. That works but it is easy for it to leave something out, and I only notice when the result misses it. For small fan-outs I can skip the Workflow tool and spawn forks through the Agent tool, but then there is no script around them. The loops and the structured outputs are the reason I reach for workflows in the first place.

Priority

Medium - Would be very helpful

Feature Category

Other

Use Case Example

Example scenario:

  1. A long session has worked out the constraints for a test rewrite.
  2. I fan out two designers and two reviewers as a workflow.
  3. With forks they would start knowing those constraints. Without them the main session pastes a summary into each prompt and hopes it is complete.

Additional Context

Claude Code 2.1.216. Forks are enabled via CLAUDE_CODE_FORK_SUBAGENT=1 in the settings.json env block. The Workflow tool description says agentType is resolved from the same agent list as the Agent tool, which is what made me expect "fork" to work there.

View original on GitHub ↗