Skip to main content
Custom actions turn repeating logic into reusable building blocks referenced with action: my-action inside a workflow step.
The user triggers a step; the resolver locates the matching action and runs it.

Quick Start

1

Run actions from an agent

2

Reference an action in a workflow step

That single line triggers a 3-tier resolution chain to find and run the action.
Custom actions turn repeating logic into reusable building blocks for job workflows. Define them inline in YAML, as standalone Python files, or use built-in actions — all referenced with 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’s action: 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-level actions: 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 a run 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-info resolves to actions/system_info.py. Dashes in the action name become underscores in the filename.

Built-in Actions

Shipped with PraisonAI, no files needed:
Flags --major and --minor override the strategy at runtime:

Passing Data to Actions

Custom keys on the step are passed through to the action via the step dict:
actions/deploy.py

Resolution Priority Demo

When the same action name exists in both YAML and as a file, YAML wins:

Best Practices

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.
If multiple workflows need the same action, put it in actions/ (per-project) or .praison/actions/ (project-level shared).
File-based actions must return {"ok": True, "output": "..."} or {"ok": False, "error": "..."}. The workflow executor checks ok to determine pass/fail.
Dry run shows all steps and their action names without executing:

Job Workflows

Core job workflow syntax and step types

YAML Workflows

Agent-based YAML workflows