Skip to main content
Step and Condition can pause when execution fails, letting users decide to retry or skip the failed component.

Error Pause Mode

Set on_error=OnError.pause to pause when a step fails:
Step retries executor failures up to max_retries times before applying on_error. The default, max_retries=3, allows four total execution attempts. Set max_retries=0 to apply the error policy after the first failed attempt.

OnError Options

ErrorRequirement Properties

When a Step or Condition fails with on_error=OnError.pause, an ErrorRequirement is created:

ErrorRequirement Methods

Retry Behavior

When you call req.retry():
  1. The component executes again with the same input, including its configured automatic retries.
  2. If it still fails, the workflow pauses again.
  3. You can retry again or skip.
Track attempts in your resolution loop to cap retries:

Skip Behavior

When you call req.skip():
  1. The failed component is not re-executed.
  2. The workflow continues with the next top-level step.
  3. The next step’s step_input.previous_step_content comes from the last successful top-level step, or is None if there is none.

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.

Condition Errors

Set on_error on a Condition to control failures raised by its selected branch. OnError.pause creates an ErrorRequirement for the Condition after the failing inner Step exhausts its own max_retries.

Streaming

Handle error HITL in streaming workflows:

Error Types

Common error scenarios and handling:

Developer Resources