action: my-action.
How Actions Resolve
| Priority | Type | Where it lives |
|---|---|---|
| 1st | YAML-defined | actions: block in the workflow file |
| 2nd | File-based | actions/my_action.py or .praison/actions/my_action.py |
| 3rd | Built-in | Shipped with PraisonAI (e.g., bump-version) |
[!TIP] YAML-defined actions always win. This lets you override any file-based or built-in action per-workflow.
YAML-Defined Actions
Self-contained in the workflow file — no external files needed. Define them in the top-levelactions: block.
yaml-actions-demo.yaml
YAML Action Types
Each action defines one key — the same types available in regular steps:| Key | What it does |
|---|---|
run: | Shell command |
script: | Inline Python (set result variable for output) |
python: | Run a Python script file |
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:| Action | Description |
|---|---|
bump-version | Bump version in pyproject.toml (patch, minor, or major) |
--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.
Use file-based actions for shared logic
Use file-based actions for shared logic
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:

