Skip to main content
This page was written for advanced builders who want to review and edit workflows in code.

Overview

Workflows in Tracecat are defined as YAML workflow definitions.

Workflow schema

The workflow body uses these top-level fields:
A minimal workflow looks like this:

Top-level fields

string
Workflow name.
string
Workflow description.
object
Input schema. Use expects to define trigger inputs in the workflow definition.
object
Workflow settings. Supported fields are environment and timeout.
list[object]
Optional trigger definitions. Trigger types are webhook and schedule.
string
Workflow alias to run when the workflow fails.
list[object]
Workflow actions.
any
Output schema. Use returns to define the workflow output in the workflow definition.
Example input schema:
Example output schema:

Actions schema

string
Unique action identifier. It must be unique within the workflow and match Tracecat’s slug format.
string
Fully qualified action name such as core.http_request, core.transform.reshape, core.transform.scatter, core.loop.end, or tools.slack.post_message.
mapping
Action inputs. The valid keys depend on the action type.
list[string]
Dependencies for this action.Use upstream_ref for a success edge, upstream_ref.success for an explicit success edge, and upstream_ref.error for an error edge. Any other suffix is invalid.
expression
Conditional expression. If it evaluates to a falsy value, the action is skipped.
expression | list[expression]
Run the action once per item in a collection. Inside the action, access the current item through var.<name>. Example: for_each: ${{ for var.alert in TRIGGER.alerts }}.
object
Retry configuration with max_attempts and timeout.
float
Delay in seconds before the action starts.
string
Join behavior for downstream actions. Use all to wait for all upstream branches, or any to allow a downstream join to complete once any upstream branch completes.
expression | string
Per-action override for the secrets environment.
boolean
Redacts this action’s result in workflow execution views and execution API responses. Tracecat keeps object and array structure but replaces each individual value, so JSONPath references remain visible. Downstream actions still receive the original result.
object
Marks an action as interactive. interaction cannot be combined with for_each.
Example action:

Expressions

Expressions use ${{ ... }}. Use these references inside expressions:
  • TRIGGER.<field>
  • ACTIONS.<ref>.result
  • SECRETS.<name>.<KEY>
  • VARS.<name>.<key>
  • ENV.<field>
  • var.<name>
  • FN.<name>(...)
See Expressions for syntax, operators, and literals. See JSONPath for field access and array access. See Functions for the full function list.

Control-flow primitives

Conditional execution with run_if

Scatter and gather

Use core.transform.scatter to fan out a collection into parallel streams, then core.transform.gather to collect results back into a list.
Within a scatter region, each downstream action reads the current item through ACTIONS.<scatter_ref>.result.

Do-while loops

Use core.loop.start to open a loop region and core.loop.end to decide whether to continue.
Loop-specific behavior:
  • core.loop.start exposes ACTIONS.<loop_start_ref>.result.iteration
  • core.loop.end requires condition
  • max_iterations defaults to 100

Subflows

Use core.workflow.execute to run a subflow.
The subflow target is usually provided through workflow_id. Trigger data is passed through trigger_inputs.

Validation rules

These are the main workflow rules:
  • All action refs must be unique.
  • Every dependency in depends_on must reference a real action.
  • Cycles in the action graph are invalid.
  • interaction cannot be combined with for_each.
  • Outer scopes cannot reference actions inside a nested scatter or loop scope.
  • Inner scopes can reference actions in parent scopes.
  • core.transform.gather must close the scatter scope it depends on.
  • core.loop.end must close the loop scope it depends on.

Workflow definition schema

Workflow definitions may also use this outer schema: