Skip to content

Create a Hera Workflow

Define a Workflow with a Python source and a handler that returns a Hera Workflow. The handler takes no arguments; declare workflow parameters inside the Hera object.

Parameters

Name Type Required Description
project str (✓) Project name. Required only when creating from the library; otherwise MUST NOT be set.
name str ✓ Name that identifies the object.
kind str ✓ Workflow kind. Must be hera.
uuid str Object ID in UUID4 format.
description str Description of the object.
labels list[str] List of labels.
embedded bool Whether to embed the object in the project.
code_src str URI pointing to the source code.
code str Source code provided as plain text.
base64 str Source code encoded as base64.
handler str ✓ Function entrypoint. It must return a Hera Workflow and accept no arguments.
lang str Source code language. Only python is supported; defaults to python.

See the pipeline definition guide for the function structure and DSL helpers.

Example

workflow = dh.new_workflow(
    name="my-workflow",
    kind="hera",
    code_src="pipeline.py",
    handler="pipeline",
)