.toon file.
Defining a Component
Use the top-levelcomponents: block:
Component Parameters
Parameters are declared in theparams: block and referenced with {params.fieldName} inside the component body:
ID Interpolation
Component step ids use{id} to prefix with the caller’s id, avoiding collisions when a component is used multiple times:
{id} token in the component definition is replaced with the caller’s id value at compile time.
Referencing Component Outputs
Access component outputs by their expanded step id:Components with Control Flow
Components can contain any node kind — sequences, parallels, loops, approvals:Importing Components
Components can be imported from other.toon files:
When to Use Components vs. Separate Workflows
Use components when:- The pattern is a reusable fragment within a larger workflow
- You want to avoid duplicating step definitions
- The fragment shares context (input, upstream outputs) with the parent workflow
- The workflow is independently executable
- It has its own input schema and lifecycle
- It should be invocable from the CLI or API on its own