Ivar Zapata
04/20/2026, 10:02 AMMarvin
04/20/2026, 10:02 AMMarvin
04/20/2026, 10:07 AMfrom prefect import flow
from pydantic import Field
@flow
def my_flow(
important_id: str = Field(
..., # no default → required → UI shows an asterisk
description="Required. This drives downstream choices."
),
tuning: int = Field(
10, # has default → optional → no asterisk
description="Important for performance, but optional."
),
):
...
Docstring descriptions also show up in the form:
@flow
def my_flow(important_id: str, tuning: int = 10):
"""
Args:
important_id: Required. This drives downstream choices.
tuning: Important for performance, but optional.
"""
...
Notes for Prefect 3.x:
- The label shown in the UI is the parameter name; you cannot override it with Field(title=...).
- Field(description=...) or docstrings are the supported way to add emphasis or guidance.
- There isn’t a supported way to append a custom suffix (like “*”) to the label for optional fields.
If you’d like, I can file a feature request on your behalf for customizable label decorations in the run form.