Error Pause Mode
Seton_error=OnError.pause to pause when a step fails:
OnError Options
| Value | Behavior |
|---|---|
OnError.fail | Fail the workflow immediately (default) |
OnError.skip | Skip the step and continue |
OnError.pause | Pause for user decision (retry or skip) |
ErrorRequirement Properties
When a step fails withon_error=OnError.pause, an ErrorRequirement is created:
| Property | Type | Description |
|---|---|---|
step_name | str | Name of the failed step |
error_message | str | The exception message |
error_type | str | Exception class name (e.g., “ValueError”) |
retry_count | int | Number of retry attempts so far |
ErrorRequirement Methods
| Method | Description |
|---|---|
req.retry() | Retry the failed step |
req.skip() | Skip the step and continue |
Retry Behavior
When you callreq.retry():
- The step executes again with the same input
retry_countincrements- If it fails again, the workflow pauses again
- You can retry indefinitely or skip after some attempts
Skip Behavior
When you callreq.skip():
- The step is marked as skipped (not failed)
- The workflow continues with the next step
step_input.previous_step_contentwill beNonefor the next step
Combining with Confirmation
A step can have both error handling and confirmation:Streaming
Handle error HITL in streaming workflows:Error Types
Common error scenarios and handling:| Scenario | Recommended Action |
|---|---|
| Network timeout | Retry a few times, then skip |
| Rate limit | Retry after delay |
| Invalid input | Skip (retry won’t help) |
| Resource unavailable | Retry or skip based on criticality |