> For the complete documentation index, see [llms.txt](https://docs.pipekit.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pipekit.io/reference/cli/using-with-hera.md).

# Using with Hera

[Hera](https://github.com/argoproj-labs/hera) is a Python framework for authoring Argo `Workflows`. The Pipekit CLI integrates with Hera by issuing tokens you pass into the [Pipekit Python SDK](/reference/python-sdk.md), which submits your Hera-authored workflows to Pipekit.

## Generate a token

```bash
pipekit login          # one-time
pipekit hera           # prints a token to stdout
```

If you want only the token value (no banner), use `-r` for raw output:

```bash
pipekit hera -r
```

The token is a bearer token, the same format the [REST API](/reference/rest-api.md) and the [MCP Server](/ai/setup.md) use.

## Use the token in Python

```python
from pipekit_sdk.service import PipekitService
import os

pipekit = PipekitService(token=os.environ["PIPEKIT_TOKEN"])
```

Then author your workflow with Hera and submit it via the SDK:

```python
from hera.workflows import DAG, Workflow, script

@script(image="python:3.12")
def echo(message):
    print(message)

with Workflow(
    generate_name="dag-diamond-",
    entrypoint="diamond",
    namespace="argo",
    service_account_name="argo-workflow",
) as w:
    with DAG(name="diamond"):
        A = echo(name="A", arguments={"message": "A"})
        B = echo(name="B", arguments={"message": "B"})
        C = echo(name="C", arguments={"message": "C"})
        D = echo(name="D", arguments={"message": "D"})
        A >> [B, C] >> D

pipe_run = pipekit.submit(w, "<cluster-name>")
print(pipe_run["uuid"])
```

For worked examples, see:

* [Python SDK > Jupyter Notebooks](/reference/python-sdk/examples-jupyter.md)
* [Python SDK > Python Scripts](/reference/python-sdk/examples-scripts.md)

## CronWorkflows with Hera

Hera and the SDK also support the full CronWorkflow lifecycle. See [Python SDK > CronWorkflows](/reference/python-sdk.md#cronworkflows).

## Token lifetime

The token Pipekit issues for Hera carries the same TTL as your CLI session. For long-running Python scripts that exceed the session length, refresh the token by running `pipekit login` and re-issuing `pipekit hera`.
