Dmytro Stelmakh
05/12/2026, 2:02 PMMarvin
05/12/2026, 2:02 PMMarvin
05/12/2026, 2:05 PMRunning. After that, there isn’t a built-in prefect runtime helper like “rename this flow run now” that avoids talking to the API.
Supported way to set the name
Use flow_run_name on the @flow decorator:
python
from prefect import flow
@flow(flow_run_name="customer-{customer_id}")
def my_flow(customer_id: str):
...
or with a callable:
python
from prefect import flow
from datetime import datetime
def make_name():
return f"run-{datetime.utcnow().strftime('%Y%m%d-%H%M%S')}"
@flow(flow_run_name=make_name)
def my_flow():
...
A couple caveats:
- String templates can use flow parameters
- The name is applied near the start of execution, before Running
- There’s no supported “change it later during execution” API except updating the run through the client/server API
If you do want to rename mid-run, that effectively means an API update, e.g. via the Prefect client (update_flow_run / set_flow_run_name), which still results in a PATCH to the server.
So if your requirement is specifically without an API PATCH call: I don’t think Prefect supports that.
Relevant source/docs:
- Flow run naming docs: Flow run names
- @flow API reference: prefect.flows
- Prefect source showing runtime name application in the flow engine: flow_engine.py
If you want, I can also suggest a few patterns to simulate this without renaming the run itself, like:
- logging a changing “display name”
- storing progress metadata elsewhere
- encoding dynamic context into artifacts or task run names