André Lynum
07/09/2026, 7:55 AMMarvin
07/09/2026, 7:55 AMMarvin
07/09/2026, 7:56 AMprefect.runtime.deployment.name returns just the deployment name as a string.
So if your deployment is named my-deployment, this:
python
from prefect.runtime import deployment
print(deployment.name)
returns:
python
my-deployment
It does not return a combined value like flow-name/my-deployment.
A couple notes:
- Type: Optional[str]
- If the flow run is not associated with a deployment, it can be None
Related runtime attribute:
- prefect.runtime.flow_run.name gives the flow run name, which is different
- prefect.runtime.deployment.id gives the deployment ID
Docs:
- Runtime context docs
If you want, I can also show how to get both the flow name and deployment name together inside a running flow.