Skip to main content

How to define Workflow parameters

Workflow parameters are the method parameters of the singular method decorated with @workflow.run. These can be any data type Temporal can convert, including 'dataclasses' when properly type-annotated. Technically this can be multiple parameters, but Temporal strongly encourages a single dataclass parameter containing all input fields. For example:

@dataclass
class YourParams:
your_int_param: int
your_str_param: str


@workflow.defn
class YourWorkflow:
@workflow.run
async def run(self, params: YourParams) -> None:
...