Agent Workflows
AgentFlow is now the primary class name (v1.5.5+). Workflow and Pipeline are silent aliases. See AgentFlow for the latest documentation.Quick Start
1
Simple Usage
2
With Configuration
See the sections below for advanced options.
Sequential Agent Pipeline
Parallel Agent Execution
Run multiple Agents simultaneously:Agent Router Workflow
Route to different Agents based on conditions:Agent Loop (Iterative Refinement)
Have an Agent iterate until satisfied:Multi-Agent Workflow with Context
Share context between Agents in a workflow:Conditional Agent Steps
Skip Agents based on conditions:Agent Workflow with Error Handling
Handle Agent failures gracefully:Workflow Patterns
Control-Flow Patterns
The control-flow patterns from the Python SDK (when, if_, include, Route, Parallel) are real classes in TypeScript. Import the friendly helpers top-level from praisonai — never from a deep dist/ path — and drop them straight into an AgentFlow step list.
Conditional branching with when / if_ / ifStep
Conditional branching with when / if_ / ifStep
when(condition, thenSteps, elseSteps?) is the preferred spelling; if_ and ifStep are aliases that build the same If step. Conditions are strings evaluated against the flow variables — numeric comparisons ({{score}} > 80), string equality ({{status}} == approved), in/contains membership, and truthy checks ({{flag}}). An unparseable condition fails safe to false.include() — run a recipe or nested workflow as a step
include() — run a recipe or nested workflow as a step
include(recipe?, workflow?, input?) runs another recipe (resolved via setRecipeResolver) or a nested workflow inline. Either recipe or workflow must be provided. The optional input supports {{var}}, {{previous_output}} and {{input}} substitution.Parallel failure modes and MAX_NESTING_DEPTH
Parallel failure modes and MAX_NESTING_DEPTH
new Parallel(steps, maxWorkers?, onFailure?) accepts 'partial_ok' (default — failed branches contribute null), 'fail_fast' (throw on first failure), or 'fail_all' (wait, then throw if any failed). Patterns may nest up to MAX_NESTING_DEPTH (5); deeper nesting raises NestingDepthError.YAMLWorkflowParser — load a workflow from YAML
YAMLWorkflowParser — load a workflow from YAML
YAMLWorkflowParser (and the parseYAMLWorkflow / loadWorkflowFromFile helpers) build a workflow from a YAML definition, including handoff shapes, so you can keep pipelines in config rather than code.Workflow Patterns
Related
Multi-Agent
Multi-Agent
Guardrails
Guardrails

