Important Limitations
Before diving into configuration, understand what spawn can and cannot do: Current constraints:- Single workflow target: Spawn only supports
builtin://agentas 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.
- Sequential by default: While spawn tool calls execute in parallel with regular tool calls, each spawn creates an independent workflow that must complete before its result returns.
How Spawn Works
When an agent calls the spawn tool:- New thread created: The spawned workflow gets its own conversation thread, completely separate from the parent.
- Preset applied: The selected preset configures the child agent’s model, temperature, tools, and system prompt.
- Task executed: The child workflow runs until completion, following the same agent loop pattern as any other agent workflow.
- Result returned: The final response from the child workflow returns to the parent as a tool result, prefixed with the preset name for clarity.
Configuring Spawn
Spawn availability is controlled by thespawn_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:
- 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:spawn() CEL function:
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 thespawn_presets parameter.
Via workflow configuration: Omit the spawn filter or use empty presets:
Spawn Tool Parameters
When an agent has access to spawn, the tool accepts these parameters:| Parameter | Required | Description |
|---|---|---|
preset | Yes | Name of the preset to use and it must be in the allowed list |
prompt | Yes | Detailed task description for the spawned workflow |
agent_id | No | Agent ID to resume an existing conversation |
worktree | No | Worktree name to run this workflow in |
create_worktree | No | Configuration to create a new worktree |
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
When tasks do not depend on each other, spawn can run in parallel with other tool calls:What Gets Returned
The spawn tool returns the final response from the child workflow, prefixed to indicate the source:is_error flag.
Best Practices
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. 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.Related Topics
- Presets - Understanding the presets that configure spawned workflows
- Worktrees & Workspaces - Isolating file changes in separate working directories
- Multi-Agent Patterns - Broader patterns for coordinating multiple agents