Jongbin Jung
03/04/2026, 6:33 PMMarvin
03/04/2026, 6:33 PMMarvin
03/04/2026, 6:40 PMfrom prefect import flow
@flow
def my_flow(x: int, mode: str = "standard"):
...
my_flow.deploy(
name="standard",
work_pool_name="my-pool",
parameters={"x": 10, "mode": "standard"} # These appear as defaults in the UI
)
- Via prefect.yaml:
deployments:
- name: standard
entrypoint: flows/my_flow.py:my_flow
work_pool: my-pool
parameters:
x: 10
mode: standard
These deployment-level defaults populate the Custom Run form in the UI. If your flow’s parameters are typed (Pydantic/Literal/etc.), the UI will render the proper controls and validate input.
Ways to create “presets” (no built-in saved templates)
- Multiple deployments: Create one deployment per preset (simple and discoverable in UI).
my_flow.deploy(name="standard", work_pool_name="my-pool", parameters={"x": 10, "mode": "standard"})
my_flow.deploy(name="high-volume", work_pool_name="my-pool", parameters={"x": 1000, "mode": "batch"})
- Per-schedule parameter overrides: Each schedule on a deployment can include its own parameters (good for time-based variants).
- Automations: Use a RunDeployment action with parameters (can template from triggering events/flow runs).
- Programmatic triggers: Keep JSON files or small wrappers that call the CLI/SDK with the desired parameter sets.
Trigger a run with parameters
- CLI:
# Pass individual params (values are parsed as JSON)
prefect deployment run my-flow/standard \
--param x=42 \
--param mode="batch"
# Pass a full mapping as JSON
prefect deployment run my-flow/standard \
--params '{"x": 42, "mode": "batch"}'
# From stdin
cat params.json | prefect deployment run my-flow/standard --params -
- Python SDK:
from prefect.deployments import run_deployment
flow_run = run_deployment(
name="my-flow/standard",
parameters={"x": 42, "mode": "batch"},
flow_run_name="manual-run-42"
)
- API (advanced):
from prefect.client import get_client
async with get_client() as client:
run = await client.create_flow_run_from_deployment(
deployment_id="your-deployment-id",
parameters={"x": 42, "mode": "batch"},
name="manual-run-42",
)
Caveats and tips
- UI prefill comes only from deployment defaults; tags don’t influence parameters.
- Parameters supplied at run-time merge with deployment defaults; run-time values override conflicts.
- If you enable strict parameter schema enforcement, invalid/missing params will fail validation.
- Use proper JSON types in the CLI (e.g., true/false for booleans, quoted strings).
Docs and references
- Deployments concepts (schema, parameters): Deployments concepts
- Define parameters in YAML: prefect.yaml parameters
- Define parameters in Python: Deploy via Python
- Run a deployment (how-to): Run deployments
- CLI reference (prefect deployment run): CLI: deployment
- Python API (run_deployment): API: deployments flow runs
- Automations concepts: Automations conceptsMarvin
03/04/2026, 6:40 PMJongbin Jung
03/04/2026, 6:42 PMparameters query param as part of a call to deployments/deployment/{deployment_id}/run, so that the UI is pre-filled?Jongbin Jung
03/04/2026, 6:43 PMparameters query param as part of a call to deployments/deployment/{deployment_id}/run, so that the UI is pre-filled?Marvin
03/04/2026, 6:43 PMMarvin
03/04/2026, 6:45 PM