Skip to main content
Job workflows run ordered pipelines in YAML — mixing shell commands, Python scripts, inline Python, custom actions, and AI agent steps. Use type: job for deterministic automation with optional AI-powered steps.

Quick Start

1

Simple Usage

deploy.yaml
2

With Configuration

Add agent, judge, and approve steps — see Agent-Centric Steps below.
3

Run programmatically

Async
[!TIP] A YAML file is a job workflow when it has type: job at the root. Without it, PraisonAI treats it as an agent workflow.
No extra flag needed — the wrapper detects type: job and routes automatically. Previously only the praisonai workflow run CLI did this; the programmatic API now matches.

How It Works


Step Types

Deterministic Steps (No LLM)

Agent-Centric Steps (LLM-Powered)


Deterministic Steps

Shell Steps

Runs via subprocess.run() with shell=True. Non-zero exit code means failure.

Python Script Steps

Path is resolved relative to the workflow file. Uses sys.executable to match the current Python interpreter.

Inline Python Steps

Executes Python code using exec() in a restricted namespace with safe builtins only.

What’s available in script:

Safe builtins only: Basic data types (int, str, list, dict), functions (len, range, min, max, print), etc. No module imports: Standard library modules are not available in the namespace. Use vars or flags to pass data. Error types you may see:
  • NameError: name 'module' is not defined — Module not available in namespace
  • SyntaxError: ... — Invalid Python syntax
  • Exception: ... — Runtime execution error
Examples:

Action Steps

Actions use a 3-tier resolution chain: YAML-defined → file-based → built-in. See Custom Actions for full details. Built-in actions: bump-version — bumps version = "X.Y.Z" in a file.

Agent-Centric Steps

Agent Step (agent:)

Execute an AI agent inline using praisonaiagents.Agent:
Agent config fields: Features:
  • output_file: — automatically saves agent output to a file
  • prompt supports variable resolution: ${{ env.X }}, {{ flags.X }}
  • Tools are resolved from the praisonaiagents.tools registry
  • Simple string shorthand: agent: "Write a greeting" (uses defaults)

Judge Step (judge:)

Quality gate that evaluates content and passes/fails based on a threshold:
Judge config fields: on_fail options:

Approve Step (approve:)

Human or automatic approval gate:
Approve config fields: When auto_approve: false, the workflow pauses and prompts in the console. Use flag expressions for dynamic control:

YAML-Defined Actions

Define reusable actions inline — including agent-powered actions:
YAML-defined actions support four inner types: run: (shell), script: (inline Python), python: (script file), and agent: (AI agent).

Variables

Workflow Variables

Environment Variables

Variable Resolution

[!NOTE] Flag names with hyphens are converted to underscores: --no-bumpflags.no_bump.

Flags


Conditional Steps

Python expressions with flags (dot access) and env (os.environ) in scope.

Dry Run

Execution Output


Error Handling

By default, workflows stop on the first failure. Agent steps show helpful errors for missing API keys.

Full Example

release.yaml

Comparison: Job vs Agent Workflows


YAML Schema Reference


Best Practices

Run praisonai workflow run file.yaml --dry-run to validate step order and agent references before executing shell or publish steps.
Define flags: in YAML and reference them with if: expressions so one pipeline works locally and in CI without duplicating files.
Structure workflows with deterministic steps first — build, test, publish — and add agent: / judge: steps only where AI adds value.
Use continue_on_error: true on optional cleanup steps so a failed lint does not block teardown.

Custom Actions

YAML-defined, file-based, built-in actions

Hybrid Workflows

Combine job + multi-agent workflows

All Systems

Compare all 8 PraisonAI systems