Skip to main content
The workflow command manages reusable multi-step workflows stored in .praison/workflows/.

Quick Start

# List available workflows
praisonai workflow list

# Execute a workflow
praisonai workflow run "Research Blog" --tools tavily --save

Two Ways to Run Workflows

MethodCommandUse Case
Template-basedpraisonai workflow run "name"Reusable, complex workflows with per-step agents
Inlinepraisonai "prompt" --workflow "step1,step2"Quick, ad-hoc workflows

Template-Based Workflows

List Workflows

praisonai workflow list
Expected Output:
╭─ Available Workflows ────────────────────────────────────────────────────────╮
│  📋 deploy - Deploy application to production                               │
│  📋 Research Blog - Research and write blog posts                           │
╰──────────────────────────────────────────────────────────────────────────────╯

Execute Workflow

praisonai workflow run "Research Blog"

Execute with Options

# With variables
praisonai workflow run deploy --workflow-var environment=staging --workflow-var branch=main

# With tools and save output
praisonai workflow run "Research Blog" --tools tavily --save

# With planning mode (AI creates sub-steps for each workflow step)
praisonai workflow run "Research Blog" --planning --verbose

# With memory
praisonai workflow run "Research Blog" --memory

Show Workflow Details

praisonai workflow show deploy

Create Workflow Template

praisonai workflow create my_workflow

Inline Workflows

Run workflows directly from the command line without creating a template file:
# Simple format: step names only
praisonai "What is Python?" --workflow "Research,Analyze,Summarize"

# Detailed format: step_name:action
praisonai "AI trends" --workflow "Research:Search for AI trends,Write:Write a blog post"

# With all options
praisonai "GPT-5 features" --workflow "Research,Write" --tools tavily --save --verbose

Inline Workflow Format

FormatExampleDescription
Simple"Research,Summarize"Step name = action
Detailed"Research:Search for info,Write:Write blog"Custom action per step

CLI Options

Workflows use global flags (same as other commands):
FlagDescription
--workflow-var key=valueSet workflow variable (can be repeated)
--llm <model>LLM model (e.g., openai/gpt-4o-mini)
--tools <tools>Tools (comma-separated, e.g., tavily)
--planningEnable planning mode (AI creates sub-steps)
--memoryEnable memory
--verboseEnable verbose output
--saveSave output to file

Workflow File Format

Workflows are stored in .praison/workflows/ as Markdown files with YAML frontmatter:
---
name: Research Blog
description: Research and write blog posts
default_llm: gpt-4o-mini
variables:
  topic: AI trends
---

## Step 1: Research
Research the topic thoroughly.

\`\`\`agent
role: Researcher
goal: Find comprehensive information
\`\`\`

\`\`\`tools
tavily_search
\`\`\`

\`\`\`action
Search for information about {{topic}}
\`\`\`

## Step 2: Write Blog
Write a blog post based on research.

\`\`\`agent
role: Writer
goal: Write engaging content
\`\`\`

context_from: [Research]

\`\`\`action
Write a blog post about {{topic}} using the research data.
\`\`\`

How It Works

  1. Load: Workflow file is loaded from .praison/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

Examples

Research Workflow

# Execute with tools
praisonai workflow run "Research Blog" --tools tavily --save

# With planning mode (AI creates sub-steps for each step)
praisonai workflow run "Research Blog" --planning --verbose

Deployment Workflow

# With variables
praisonai workflow run deploy --workflow-var environment=staging --workflow-var branch=main

Release Workflow

praisonai workflow run release --workflow-var version=1.2.0

Programmatic Usage

from praisonaiagents.memory import WorkflowManager

manager = WorkflowManager()

# Execute a workflow
result = manager.execute(
    "deploy",
    executor=lambda prompt: agent.chat(prompt),
    variables={"environment": "production"}
)

Best Practices

Use variables for environment-specific values to make workflows reusable.
Workflows execute steps sequentially. Ensure each step can complete independently.
DoDon’t
Use variables for environment valuesHardcode environment names
Keep steps focused and atomicCreate monolithic steps
Add descriptions to workflowsSkip documentation
Test workflows in staging firstDeploy directly to production

Auto-Generate Workflows

Generate workflow YAML files automatically from a topic description:
# Basic auto-generation
praisonai workflow auto "Research and write a blog post"

# With specific pattern
praisonai workflow auto "Analyze market trends" --pattern orchestrator-workers

# With output file
praisonai workflow auto "Customer support routing" --pattern routing --output support_workflow.yaml

Available Patterns

PatternDescriptionUse Case
sequentialAgents work one after anotherDefault, step-by-step tasks
parallelAgents work concurrentlyIndependent subtasks
routingClassifier routes to specialistsDifferent input types
loopRepeat steps until condition metIterative processing
orchestrator-workersCentral orchestrator delegates dynamicallyComplex decomposition
evaluator-optimizerGenerate-evaluate loop until quality metContent refinement

Pattern Examples

Central orchestrator analyzes the task and delegates to specialized workers:
praisonai workflow auto "Comprehensive market analysis and report" --pattern orchestrator-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:
praisonai workflow auto "Write and polish a high-quality article" --pattern evaluator-optimizer
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:
praisonai workflow auto "Research from news, social media, and academic sources" --pattern parallel
Classifier routes to specialized agents:
praisonai workflow auto "Handle technical, billing, and general customer requests" --pattern routing