Luiza
03/04/2026, 12:31 PMprefect.yaml and need to pass a field from the event payload (e.g., event.payload.output_uri) as a parameter to the RunDeployment action. In the UI, Prefect represents this as a dict with __prefect_kind: "jinja" and a template key. The Prefect docs show how to configure this in the UI but don’t show the corresponding YAML syntax. What is the correct way to write this templated parameter in prefect.yaml so that Prefect interprets it as a Jinja template at runtime?Marvin
03/04/2026, 12:31 PMMarvin
03/04/2026, 12:34 PMparameters:
output_uri:
__prefect_kind: jinja
template: "{{ event.payload.output_uri }}"
Details and examples (Prefect 3.x):
- In a deployment’s event trigger inside prefect.yaml
deployments:
- name: my-deployment
entrypoint: flows.py:my_flow
work_pool:
name: default
triggers:
- type: event
enabled: true
match:
prefect.resource.id: my.app.resource
expect:
- my.event.type
parameters:
output_uri:
__prefect_kind: jinja
template: "{{ event.payload.output_uri }}"
# static parameter (no templating)
mode: "fast"
- If you are defining a top-level automation with a RunDeployment action, the same parameter wrapper goes under the action’s parameters:
automations:
- name: run-on-event
trigger:
type: event
match:
prefect.resource.id: my.app.resource
expect:
- my.event.type
actions:
- type: run-deployment
deployment: "my-flow/my-deployment"
parameters:
output_uri:
__prefect_kind: jinja
template: "{{ event.payload.output_uri }}"
Notes:
- Always include __prefect_kind: jinja with a template key; without it, Prefect treats the value as a literal.
- If you want the result to be a structured object (e.g., pass the entire payload as a dict), use a JSON wrapper so the rendered template is parsed back into a Python object:
parameters:
full_payload:
__prefect_kind: json
value:
__prefect_kind: jinja
template: "{{ event.payload | tojson }}"
If you share a snippet of your prefect.yaml, I can sanity-check the placement and syntax.Luiza
03/04/2026, 12:53 PMMarvin
03/04/2026, 1:02 PMMarvin
03/04/2026, 1:05 PMparameters:
grib_file:
__prefect_kind: jinja
template: "{{ event.payload.output_uri }}"
You can also use the simpler string form (also supported):
parameters:
grib_file: "{{ event.payload.output_uri }}"
If it’s still not working, check these points:
- Verify the event actually has payload.output_uri
- Add a temporary debug parameter to inspect what the automation sees:
parameters:
grib_file: "{{ event.payload.output_uri }}"
_debug_event:
__prefect_kind: jinja
template: "{{ event | tojson }}"
Then look at the automation firing in the UI and confirm the payload shape.
- Ensure your match selector is correct
- Flow run resource IDs look like prefect.flow-run.<UUID>. If you want to match flow-run events broadly, use either:
match:
prefect.resource.role: "flow-run"
or
match:
prefect.resource.id: "prefect.flow-run.*"
Using flow-run.* without the prefect. prefix typically won’t match.
- Confirm the event type and payload source
- maps.decompress.completed must be emitted with payload={"output_uri": ...}. If the event was not emitted with that payload key, the template will render empty/undefined.
- Make sure your flow parameter name matches exactly
- Your flow must accept a grib_file parameter; otherwise the parameter may be ignored or cause an error.
- Re-deploy after changing prefect.yaml
- Edit → prefect deploy again so the updated trigger and parameters are applied.
- You can also try the “JSON wrapper” if you need a dict object (not needed for a single string, but useful for debugging):
parameters:
full_payload:
__prefect_kind: json
value:
__prefect_kind: jinja
template: "{{ event.payload | tojson }}"
If you can share:
- a sample event (or the _debug_event output),
- your exact match selector,
- and the flow signature,
I can pinpoint why the value isn’t rendering and suggest the minimal change.