Roman Bedroš
06/22/2026, 8:40 AMMarvin
06/22/2026, 8:40 AMMarvin
06/22/2026, 8:42 AM{{ flow_run }} in an automation parameter is typically rendered as a string, not passed through as a native dict/object.
If you want Flow B to receive structured data, the supported pattern is to wrap the Jinja output in Prefect's JSON hydration format:
{
"__prefect_kind": "json",
"value": {
"__prefect_kind": "jinja",
"template": "{{ flow_run | tojson }}"
}
}
That does two things:
1. {{ flow_run | tojson }} serializes the triggering flow run to JSON
2. __prefect_kind: "json" tells Prefect to parse that JSON back into a structured parameter
So in your automation's RunDeployment action, you'd do something like:
parameters={
"upstream_flow_run": {
"__prefect_kind": "json",
"value": {
"__prefect_kind": "jinja",
"template": "{{ flow_run | tojson }}"
}
}
}
Then Flow B can accept:
@flow
def flow_b(upstream_flow_run: dict):
print(upstream_flow_run["id"])
Recommended approach: instead of passing the entire flow_run object, pass only the fields you actually need:
parameters={
"trigger_info": {
"__prefect_kind": "json",
"value": {
"__prefect_kind": "jinja",
"template": "{{ {'id': flow_run.id, 'name': flow_run.name, 'parameters': flow_run.parameters} | tojson }}"
}
}
}
That tends to be more stable and easier to work with.
A few notes:
- Simple scalar values can use plain Jinja:
"name": {
"__prefect_kind": "jinja",
"template": "{{ flow_run.name }}"
}
- For dicts/lists/bools/numbers where you want native types preserved, use the json + jinja + tojson pattern
- flow_run here refers to the run that triggered the automation
If you want, I can also show you a complete automation example for either:
- Python SDK automations, or
- deployment trigger configuration in YAML/UI.