{"id":9810,"library":"hera-workflows","title":"Hera Workflows","description":"Hera Workflows is a Python library that simplifies the orchestration of Python code on Argo Workflows. It allows users to define, construct, and submit complex workflows entirely in Python, abstracting away much of the underlying YAML complexity. The current version is 6.0.0, and the project maintains an active release cadence with frequent updates.","status":"active","version":"6.0.0","language":"en","source_language":"en","source_url":"https://github.com/argoproj-labs/hera","tags":["argo","workflows","orchestration","kubernetes","python","workflow-management"],"install":[{"cmd":"pip install hera-workflows","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Hera Workflows v6.0.0+ requires Pydantic v2. Previous versions used Pydantic v1.","package":"pydantic","optional":false},{"reason":"Used for interacting with the Argo Workflows API to submit and manage workflows.","package":"argo-workflows-client","optional":false}],"imports":[{"symbol":"Workflow","correct":"from hera.workflows import Workflow"},{"symbol":"Task","correct":"from hera.workflows import Task"},{"symbol":"Parameter","correct":"from hera.workflows import Parameter"},{"symbol":"Artifact","correct":"from hera.workflows import Artifact"},{"note":"The `script` utility moved to `hera.shared` in v5.x, often confused with `hera.workflows`.","wrong":"from hera.workflows import script","symbol":"script","correct":"from hera.shared import script"}],"quickstart":{"code":"import os\nfrom hera.workflows import Workflow, Task, Parameter\nfrom hera.shared import global_config\n\n# Configure Hera to connect to Argo Workflows (adjust as needed)\n# For local testing, ensure ARGO_SERVER and ARGO_TOKEN are set,\n# or modify client configuration directly.\nglobal_config.host = os.environ.get('ARGO_SERVER', 'http://localhost:2746')\nglobal_config.token = os.environ.get('ARGO_TOKEN', '')\nglobal_config.verify_ssl = False # Set to True in production\n\ndef my_task_func(name: str):\n    print(f\"Hello, {name} from Hera!\")\n\nwith Workflow(generate_name=\"my-first-hera-workflow-\", entrypoint=\"my-entrypoint\") as w:\n    my_task = Task(\n        name=\"my-entrypoint\",\n        inputs=[Parameter(name=\"message\", default=\"World\")],\n        func=my_task_func,\n        arguments=[\"{{inputs.parameters.message}}\"]\n    )\n\nw.submit()","lang":"python","description":"This example demonstrates a basic Hera workflow with a single task that prints a greeting. It shows how to define a Python function as a task, configure it with parameters, and submit the workflow to an Argo Workflows instance. Ensure `ARGO_SERVER` and `ARGO_TOKEN` environment variables are set for a remote Argo server, or configure `global_config.host` appropriately for local development."},"warnings":[{"fix":"Migrate from `@task` to `Task(func=my_func, ...)` and from `@workflow` to `with Workflow(...) as w:`.","message":"Hera Workflows v6.0.0 has removed the decorator feature (e.g., `@workflow`, `@task`). Workflows and tasks must now be defined by directly instantiating the `Workflow` and `Task` classes.","severity":"breaking","affected_versions":">=6.0.0"},{"fix":"Ensure Pydantic V2 is installed (`pip install pydantic>=2`). Review any custom Pydantic models interacting with Hera components for Pydantic V1-specific API usage. Hera's internal models are now `dataclasses`.","message":"Hera Workflows v6.0.0 has migrated its core models away from Pydantic V1 to Python dataclasses, and now requires Pydantic V2 for any remaining Pydantic integrations. Code relying on Pydantic V1 behavior or direct manipulation of Hera models as Pydantic V1 objects will break.","severity":"breaking","affected_versions":">=6.0.0"},{"fix":"Upgrade your Python environment to 3.10 or higher. The minimum supported version is 3.10.","message":"Support for Python 3.9 was removed in Hera Workflows v5.27.0.","severity":"breaking","affected_versions":">=5.27.0"},{"fix":"Set `ARGO_SERVER` and `ARGO_TOKEN` environment variables, or explicitly configure `hera.shared.global_config.host` and `token`. Ensure network connectivity to the Argo server.","message":"Submitting a workflow requires access to an Argo Workflows API server. Configuration is typically handled via `hera.shared.global_config` or by passing a `hera.workflows.service.Services` instance to the `Workflow` constructor. Incorrect configuration leads to connection errors.","severity":"gotcha","affected_versions":"all"},{"fix":"Update imports from `from hera.workflows import script` to `from hera.shared import script`.","message":"The `script` helper function, used for wrapping Python functions to run as Argo script templates, moved from `hera.workflows` to `hera.shared` in Hera Workflows v5.x.","severity":"gotcha","affected_versions":">=5.0.0"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Ensure Pydantic v2 is installed (`pip install 'pydantic>=2'`) and check for other dependencies that might be pinning Pydantic v1.","cause":"Upgrading to Hera Workflows v6.0.0+ without updating Pydantic or having other libraries that still implicitly require Pydantic v1. Hera v6+ requires Pydantic v2.","error":"ModuleNotFoundError: No module named 'pydantic.v1'"},{"fix":"Remove the decorators and instantiate `Workflow` and `Task` classes directly. For example, replace `@task` with `Task(func=your_function, ...)`, and `@workflow` with `with Workflow(...) as w:`.","cause":"Attempting to use `@workflow` or `@task` decorators after upgrading to Hera Workflows v6.0.0, where they have been removed.","error":"TypeError: 'function' object is not callable"},{"fix":"This error means Pydantic V1 is being used where Pydantic V2 is expected or vice-versa. Ensure all Pydantic-related code (including third-party libraries) is compatible with the version Hera (V2) expects. Hera's core models are now dataclasses, so this is usually in user-defined I/O models.","cause":"This typically indicates a mismatch between Pydantic v1 and v2 usage, often when Hera v6+ is used with existing code expecting Pydantic v1 Field behavior.","error":"AttributeError: type object 'Field' has no attribute 'Required'"},{"fix":"Upgrade your Python environment to 3.10 or higher. Hera Workflows v5.27.0+ requires Python >=3.10.","cause":"Attempting to install or run Hera Workflows v5.27.0+ on an unsupported Python version (e.g., Python 3.9).","error":"ERROR: Package 'hera-workflows' requires a different Python version: <4, >=3.10 but your Python version is X.Y"}]}