Ron
12/22/2025, 6:29 PMprefect deploy how do I set specific parameters for the deployment?Marvin
12/22/2025, 6:29 PMMarvin
12/22/2025, 6:31 PMprefect deploy CLI using either --param (repeatable key=value) or --params (single JSON object). These are mutually exclusive.
- Use --param key=value for individual parameters (repeatable). Values are parsed as JSON if possible; otherwise treated as strings.
- Use --params '{"k":"v"}' to provide all parameters at once as a JSON object.
Examples:
# Set individual params (repeatable)
prefect deploy ./flows.py:my_flow \
--name my-deployment \
--param customer_id=12345 \
--param enabled=true \
--param tags='["gold","priority"]'
# Set all params at once (JSON)
prefect deploy ./flows.py:my_flow \
--name my-deployment \
--params='{"customer_id":12345,"enabled":true,"tags":["gold","priority"]}'
Notes:
- Don’t mix --param and --params in the same command (you’ll get an error).
- These values become the deployment’s default parameters. You can override them at run time:
prefect deployment run my-flow/my-deployment --param customer_id=999
If you prefer YAML, you can put defaults under parameters: for a deployment in `prefect.yaml`:
deployments:
- name: my-deployment
entrypoint: flows.py:my_flow
parameters:
customer_id: 12345
enabled: true
CLI flags will merge with and override values defined in prefect.yaml.
Programmatic equivalent (Python):
from prefect import flow
@flow
def my_flow(customer_id: int, enabled: bool = True): ...
flow.from_source(
source="<https://github.com/org/repo.git>",
entrypoint="flows.py:my_flow"
).deploy(
name="my-deployment",
work_pool_name="my-pool",
parameters={"customer_id": 12345, "enabled": True}
)
Docs:
- Create deployments
- prefect.yaml
- Trigger deployment runs