Skip to main content

How to develop a Workflow definition in Python

Workflows in Python are defined as classes.

Specify the @workflow.defn decorator on the Workflow class to register a Workflow class.

Use the @workflow.run to mark the entry point method to be invoked. This must be set on one asynchronous method defined on the same class as @workflow.defn. Run methods have positional parameters.

@workflow.defn
class YourWorkflow:
@workflow.run
async def run(self, name: str) -> str:
return await workflow.execute_activity(
your_activity, name, schedule_to_close_timeout=timedelta(seconds=5)
)