Skip to main content
Steps can pause when they encounter errors, letting users decide to retry or skip the failed step.

Error Pause Mode

Set on_error=OnError.pause to pause when a step fails:

OnError Options

ValueBehavior
OnError.failFail the workflow immediately (default)
OnError.skipSkip the step and continue
OnError.pausePause for user decision (retry or skip)

ErrorRequirement Properties

When a step fails with on_error=OnError.pause, an ErrorRequirement is created:
PropertyTypeDescription
step_namestrName of the failed step
error_messagestrThe exception message
error_typestrException class name (e.g., “ValueError”)
retry_countintNumber of retry attempts so far

ErrorRequirement Methods

MethodDescription
req.retry()Retry the failed step
req.skip()Skip the step and continue

Retry Behavior

When you call req.retry():
  1. The step executes again with the same input
  2. retry_count increments
  3. If it fails again, the workflow pauses again
  4. You can retry indefinitely or skip after some attempts

Skip Behavior

When you call req.skip():
  1. The step is marked as skipped (not failed)
  2. The workflow continues with the next step
  3. step_input.previous_step_content will be None for the next step

Combining with Confirmation

A step can have both error handling and confirmation:
The confirmation happens first. If confirmed and the step fails, the error pause activates.

Streaming

Handle error HITL in streaming workflows:

Error Types

Common error scenarios and handling:
ScenarioRecommended Action
Network timeoutRetry a few times, then skip
Rate limitRetry after delay
Invalid inputSkip (retry won’t help)
Resource unavailableRetry or skip based on criticality

Developer Resources