action: my-action inside a workflow step.
Quick Start
1
Run actions from an agent
2
Reference an action in a workflow step
action: my-action.
How Actions Resolve
The user triggers a workflow step; the resolver finds the YAML, file, or built-in action and runs it.[!TIP] YAML-defined actions always win. This lets you override any file-based or built-in action per-workflow.
How It Works
The user runs a workflow; each step’saction: name is resolved through the 3-tier chain, executed, and its result returned to the step.
YAML-Defined Actions
Self-contained in the workflow file — no external files needed. Define them in the top-levelactions: block.
1
Define and Run
yaml-actions-demo.yaml
YAML Action Types
Each action defines one key — the same types available in regular steps:File-Based Actions
Reusable.py files that can be shared across multiple workflows.
Directory Structure
The Action Contract
Every action file must export arun function:
Example: System Info Action
actions/system_info.py
Example: Line Count Action
actions/line_count.py
Using File-Based Actions
Reference them by name — dashes become underscores when looking up the.py file:
file-actions-demo.yaml
[!NOTE]action: system-inforesolves toactions/system_info.py. Dashes in the action name become underscores in the filename.
Built-in Actions
Shipped with PraisonAI, no files needed:--major and --minor override the strategy at runtime:
Passing Data to Actions
Custom keys on the step are passed through to the action via thestep dict:
actions/deploy.py
Resolution Priority Demo
When the same action name exists in both YAML and as a file, YAML wins:Best Practices
Use YAML actions for workflow-specific logic
Use YAML actions for workflow-specific logic
If the action is only used in one workflow, define it inline. This keeps the workflow portable — a single file you can copy or share.
Always return the correct dict shape
Always return the correct dict shape
File-based actions must return
{"ok": True, "output": "..."} or {"ok": False, "error": "..."}. The workflow executor checks ok to determine pass/fail.Use --dry-run to preview
Use --dry-run to preview
Dry run shows all steps and their action names without executing:
Related
Job Workflows
Core job workflow syntax and step types
YAML Workflows
Agent-based YAML workflows

