When to Use Sub-steps
- Complex operations - Multiple distinct actions within one step
- Parallel execution - Running multiple operations concurrently
- Debugging visibility - Need to see intermediate progress
- Performance analysis - Identify bottlenecks within steps
Sub-step Properties
- Parent step - Associated with a main step
- Unique name - Within the parent step context
- Independent status - Can succeed or fail independently
- Timestamps - Track execution timing
- Context data - Specific to the sub-step operation
Sub-step vs Step
| Feature | Step | Sub-step |
|---|---|---|
| Scope | Thread-level | Within a step |
| Validation | Contract rules | No validation |
| Notifications | Can trigger events | No events |
Using Sub-steps
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
name | string | required | Sub-step name |
data | object | {} | Sub-step data |
status | string | 'success' | 'success' or 'failed' |
Best Practices
- Logical grouping - Sub-steps should be related to parent step
- Don’t overuse - Not every operation needs a sub-step
- Clear naming - Describe the specific sub-operation
- Consistent patterns - Use similar sub-step structures across steps