Skip to main content
Workflow error handling provides structured exception handling for step failures, enabling robust parallel execution and graceful error recovery.
The user runs a workflow; WorkflowStepError surfaces the failing step and root cause for recovery.

Running the same workflow instance concurrently

An AgentFlow instance is not safe to run() (or astart()) concurrently on the same object — its per-run mutable state (status, step_statuses, _handoff_chain) would be corrupted. As of PraisonAI #3086, a second concurrent call raises a clear error instead:
Fix: create one AgentFlow instance per concurrent run — either instantiate a fresh AgentFlow(steps=[...]) on each call, or use a lightweight factory:
Sequential re-use of the same instance is fine — the lock is released in a finally when a run completes (successfully or not), so the next run() call proceeds normally.

Quick Start

1

Basic Error Handling

2

Handling Multiple Errors


How It Works


Configuration Options


Failed Task Propagation

When tasks fail after exhausting retries, dependent tasks are automatically skipped instead of running with None context:

How It Works

Example

Failure Propagation Rules

  1. Failed Task: When a task fails after max_retries, its status is set to "failed"
  2. Dependent Detection: Tasks with context=[failed_task] are identified as dependents
  3. Skip Execution: Dependent tasks are marked as "failed" without execution
  4. No None Propagation: Dependent tasks don’t receive None values from failed dependencies

Process Integration

This behavior works consistently across all process types:

Common Patterns

Pattern 1: Single Step Recovery

Pattern 2: Parallel Error Analysis

Pattern 3: Graceful Degradation


Best Practices

Catch WorkflowStepError specifically rather than generic Exception to handle workflow failures appropriately while allowing other errors to bubble up.
Use the cause and errors attributes to understand what specifically went wrong and implement targeted recovery strategies.
Include workflow context in error logs to help with debugging and monitoring.
When using parallel execution, design your aggregation logic to handle partial results gracefully.

Workflow Parallel

Parallel execution with failure strategies

Workflow Patterns

Common workflow implementation patterns