Skip to main content
The workflow command manages reusable multi-step workflows stored in .praisonai/workflows/.
Install requirement: praisonai workflow requires pip install praisonai (the full wrapper). On a standalone pip install praisonai-code install these subcommands (list, show, run) exit 1 with workflow requires the full wrapper. Install the full wrapper: pip install praisonai — a single-line hint, no Rich traceback (PR #2854).

Quick Start

List workflows example

Two Ways to Run Workflows

Execute Multi-Step Workflows

Template-Based Workflows

List Workflows

Expected Output:

Execute Workflow

Execute with Options

Resume an Interrupted Workflow

If a workflow stops partway — a crash, a timeout, or a Ctrl-C — resume it from the last saved step instead of starting over. A checkpoint is saved after each completed step; --resume reads it and continues from the next step.
--resume, --checkpoint, and --rebase-checkpoint apply to markdown workflows run through WorkflowManager. YAML workflows use a different engine and do not support these flags yet.
If you edit the workflow file between saving and resuming, a definition fingerprint guards against landing on the wrong step. Whitespace and comment-only edits keep the same fingerprint, so resume still works. Changing steps or agent configuration changes the fingerprint and resume refuses:
Pick between the three options with this decision guide: Here is the full save → interrupt → list → resume flow end to end:

Manage Checkpoints

List saved workflow checkpoints, or delete one you no longer need.
Expected Output:
Checkpoint files live in {workspace}/.praisonai/checkpoints/{name}.json. The Fingerprint column shows - for checkpoints saved before fingerprinting existed.

Show Workflow Details

Create Workflow Template

Inline Workflows

Run workflows directly from the command line without creating a template file:

Inline Workflow Format

CLI Options

Workflows use global flags (same as other commands):

Workflow YAML Schema

framework: key

YAML workflow files accept a top-level framework: key. Only praisonai (case-insensitive) is supported by the native execution engine.
If you set a different framework name, PraisonAI raises immediately rather than silently running the native engine:
The framework: validation only applies to the native YAML workflow executor (Workflow.run()). To run CrewAI or AutoGen, use the framework adapters path via praisonai --framework crewai agents.yaml — see Framework Availability for adapter details.

Workflow File Format

Workflows are stored in .praisonai/workflows/ as Markdown files with YAML frontmatter:

How It Works

  1. Load: Workflow file is loaded from .praisonai/workflows/
  2. Variables: Variables are substituted into step prompts
  3. Execution: Each step is executed sequentially with its configured agent
  4. Context: Results from each step are passed to the next

Exit Codes

praisonai workflow now returns process exit codes that reflect what actually happened, so CI, benchmarks, and shell pipelines can branch on success without parsing stdout.
Behaviour change (PraisonAI PR #4946). An agent/action step that produces no output is now a step failure, not a warning. Previously every path in the workflow handler exited 0 even when steps failed — the fix behind .github/workflows/praisonai-pr-review.yml no longer passing unconditionally. Any recipe, tutorial, or CI job that shells out to praisonai workflow run and swallows the exit code should be updated: a non-zero exit is now a signal, not noise.
Before the fix, a failed model call was silently swallowed and the run still reported success:
After the fix, the same run fails loudly:
handler steps are unchanged — a custom Python handler may legitimately return None. Only agent and action steps are treated as failures when they produce nothing.

The error field on a failed result

A failed Workflow.start() (or .run()) result carries an error string describing the first failure. It is populated whenever the final workflow status is failed; a successful run does not set it.

Hierarchical Mode Validation

When a workflow runs with process="hierarchical", a manager LLM judges each step’s output. Three fail-open defects are fixed as of PR #4946:
  • Manager rejections are honoured. The manager verdict is parsed with the engine’s own _parse_json_output helper (the same one used elsewhere in the engine), which strips the ```json fences models routinely emit. A bare json.loads used to raise JSONDecodeError on every fenced reply and substitute {"approved": true, "reason": "assuming success"}, silently discarding a rejection. Now "approved": false fails the run.
  • An unreadable verdict fails closed. If the manager response cannot be parsed into a dict, it is treated as not approved rather than assumed successful.
  • A manager outage fails the run. Exceptions raised during the manager call are now failures, not a logged-and-ignored pass.
  • A step that produced nothing is judged too — the same no-output rule from the sequential path applies here.

Examples

Research Workflow

Deployment Workflow

Release Workflow

Programmatic Usage

Best Practices

Use variables for environment-specific values to make workflows reusable.
Workflows execute steps sequentially. Ensure each step can complete independently.

Auto-Generate Workflows

Fixed in PR #2147: praisonai workflow auto was non-functional in all previous releases — every call raised a NameError on _models_cache and surfaced as Generation failed: in the CLI. The command now works as documented below.
Generate workflow YAML files automatically from a topic description:

Available Patterns

Pattern Examples

Central orchestrator analyzes the task and delegates to specialized workers:
Generated workflow includes:
  • Orchestrator: Analyzes task, determines required workers
  • Workers: Researcher, Analyst, Writer (run in parallel)
  • Synthesizer: Combines all worker outputs
Iterative refinement with feedback loops:
Generated workflow includes:
  • Generator: Creates initial content
  • Evaluator: Scores content (1-10), provides feedback
  • Loop: Continues until score >= 7 or max iterations
Multiple agents work concurrently:
Classifier routes to specialized agents: