Skip to main content
A task within a workflow represents a discrete unit of work that contributes to achieving the overall objectives defined by the workflow. It encapsulates a specific action or set of actions that need to be executed in a predefined order to advance the workflow towards its completion. Tasks are designed to be modular and focused, each serving a distinct purpose within the broader context of the workflow. By breaking down the workflow into manageable tasks, organizations can effectively coordinate and track progress, enabling efficient collaboration and ensuring that work is completed in a structured and organized manner.

Task Types

The Serverless Workflow DSL defines a list of tasks that must be supported by all runtimes:

Call

Call services and/or functions

Do

Execute subtasks in sequence

Emit

Publish events to brokers

For

Iterate over collections

Fork

Execute subtasks concurrently

Listen

Wait for external events

Raise

Raise errors and fault workflows

Run

Execute containers, scripts, shells, or workflows

Set

Set workflow data dynamically

Switch

Conditional branching logic

Try

Handle errors gracefully with retries

Wait

Pause execution for a duration

Common Task Properties

All tasks share the following common properties:
if
string
A runtime expression used to determine whether or not the task should be run. The task is considered skipped if not run, and the raw task input becomes the task’s output.
input
input
An object used to customize the task’s input and to document its schema, if any.
output
output
An object used to customize the task’s output and to document its schema, if any.
export
export
An object used to customize the content of the workflow context.
timeout
string | timeout
The configuration of the task’s timeout, if any. If a string, must be the name of a timeout defined in the workflow’s reusable components.
then
flowDirective
The flow directive to execute next. If not set, defaults to continue.
metadata
map
Additional information about the task.

Build docs developers (and LLMs) love