Skip to main content
The spawn tool allows an agent to delegate tasks to sub-workflows during execution. When an agent encounters a task better suited for a specialist, it can spawn a sub-workflow configured with a specific preset and keep working while that specialist runs in the background. Think of spawn as “asking a specialist for help.” The parent agent describes what needs to be done, the spawned workflow does the work in isolation, and the result comes back to the parent agent in a later turn. Spawn is asynchronous. The call returns a handle immediately — it does not block. The child’s result is not in the spawn tool call’s result; the parent is notified once the child finishes. Because the parent stays free, it can read files, edit, plan, and spawn additional agents while children are still running, and work discovered mid-run can join an in-flight fan-out rather than waiting for the next wave.

Important Limitations

Before diving into configuration, understand what spawn can and cannot do: Current constraints:
  • Single workflow target: Spawn only supports builtin://agent as the target workflow. You cannot spawn arbitrary custom workflows.
  • Preset selection only: The spawned workflow must be configured via a preset. You cannot pass arbitrary parameters or override individual settings.
  • Self-contained tasks: The spawned workflow runs in its own thread with its own context. It cannot access the parent’s conversation history or tool results directly—it only receives the prompt you provide.
  • Results arrive later, not inline: Because spawn is asynchronous, the parent cannot treat a spawn call as a value it can use in the same turn. It must be written to continue working and react to the result when it lands.
These limitations exist by design. Spawn provides a controlled way to delegate work while maintaining isolation between parent and child workflows.

How Spawn Works

When an agent calls the spawn tool:
  1. New thread created: The spawned workflow gets its own conversation thread, completely separate from the parent.
  2. Preset applied: The selected preset configures the child agent’s model, temperature, tools, and system prompt.
  3. Handle returned immediately: The spawn call settles right away with a handle identifying the child agent. The parent’s turn is not held open waiting for the child.
  4. Task executed in the background: The child workflow runs until completion, following the same agent loop pattern as any other agent workflow, while the parent keeps working.
  5. Result delivered later: When the child finishes, its final response reaches the parent as a message it reacts to on a subsequent turn, prefixed with the preset name for clarity.
The parent agent can then use this result to inform its next steps. While a child is running, the parent can call spawn_status to check on it (passing wait: true to block until it finishes, when the parent truly cannot proceed without the answer) or spawn_send to give it new instructions mid-flight.

Configuring Spawn

Spawn availability is controlled by the spawn_presets input in workflows that use the agent loop. This input determines which presets appear as options in the spawn tool.

The spawn_presets Input

In the built-in agent workflow, spawn_presets is configured as a multi-select enum:
The key points:
  • Empty selection disables spawn: If no presets are selected, the spawn tool does not appear in the agent’s toolset.
  • Default includes common presets: By default, agents can spawn general, researcher, and reviewer sub-workflows.
  • Enum values must be valid presets: Each value must correspond to a preset that exists, built-in or custom.

Tool Filter Syntax

Behind the scenes, spawn configuration flows through the tool filter system. The spawn filter syntax is:
For example, the agent workflow builds its tool filter using the spawn() CEL function:
The spawn() function takes a workflow reference and a list of presets, returning the spawn filter spec string. If the presets list is empty, it returns an empty string, disabling spawn.

Disabling Spawn

To disable spawn entirely: Via UI: Deselect all presets in the spawn_presets parameter. Via workflow configuration: Omit the spawn filter or use empty presets:
Or simply do not include any spawn filter:

Spawn Tool Parameters

When an agent has access to spawn, the tool accepts these parameters:

Basic Example

Resuming a Previous Agent

If a spawned agent was previously used, you can resume its conversation:

Running in a Worktree

For tasks that modify files, you can isolate changes in a worktree:

Use Cases

Research Before Implementation

Spawn a researcher to investigate before making changes:

Specialized Code Review

Get focused feedback from a specialist:

Breaking Down Complex Tasks

Delegate subtasks to specialists:

Parallel Independent Tasks

Because spawn never blocks, independent work should be started together rather than one at a time:
The anti-pattern is dribbling spawns out one per turn and waiting on each before starting the next. That serializes work which had no dependency between its parts.

What Gets Returned

The spawn call itself returns a handle for the new agent. The child’s final response is delivered separately, once it finishes, prefixed to indicate the source:
If the child workflow encounters an error, the error message is delivered with an is_error flag.

Best Practices

Start independent work together: Spawn does not block, so batching every independent unit into one turn costs no more than spawning one. Hold a spawn back only when it genuinely consumes another agent’s output. Write detailed prompts: The spawned workflow only knows what you tell it. Include context about what you are trying to accomplish, what you have already learned, and what specific questions need answering. Do not idle while children run: The parent is free during a fan-out. Use that time to prepare the next brief, read files, or start more units — not to poll. Choose appropriate presets: Match the task to the specialist. Use researcher for investigation, reviewer for quality feedback, refactor for systematic changes. Handle results appropriately: The spawn result is just information. The parent agent should interpret the findings and decide what to do next. Do not over-delegate: Simple tasks do not need spawn. Use spawn when the task benefits from a specialist’s focused attention or when you want isolation between concerns. Consider worktrees for modifications: When spawning workflows that will modify files, consider using worktrees to isolate changes until you are ready to merge them.