11# Jinja2 Templating Migration Guide
22
3- This guide explains how to migrate taskflow YAML files from version 0.0.x ( custom template syntax) to version 0. 1.0 (Jinja2 templating) .
3+ This guide explains how to migrate taskflow YAML files from the old custom template syntax to Jinja2 templating with version ` " 1.0" ` format .
44
55## Overview
66
7- Version 0.1.0 replaces the custom regex-based template processing with Jinja2, providing:
7+ The new version replaces the custom regex-based template processing with Jinja2, providing:
88- More powerful templating features (filters, conditionals, loops)
99- Better error messages with clear variable undefined errors
1010- Industry-standard syntax familiar to many developers
1111- Extensibility for future template features
12+ - String-based version format (e.g., ` "1.0" ` ) for semantic versioning support
1213
1314## Syntax Changes
1415
1516### 1. Global Variables
1617
17- ** Version 0.0.x :**
18+ ** Old syntax :**
1819``` yaml
1920globals :
2021 fruit : apples
@@ -24,7 +25,7 @@ taskflow:
2425 Tell me about {{ GLOBALS_fruit }}.
2526` ` `
2627
27- **Version 0.1.0 :**
28+ **New syntax :**
2829` ` ` yaml
2930globals :
3031 fruit : apples
@@ -48,55 +49,55 @@ taskflow:
4849
4950### 2. Input Variables
5051
51- **Version 0.0.x :**
52+ **Old syntax :**
5253` ` ` yaml
5354user_prompt : |
5455 Color: {{ INPUTS_color }}
5556` ` `
5657
57- **Version 0.1.0 :**
58+ **New syntax :**
5859` ` ` yaml
5960user_prompt : |
6061 Color: {{ inputs.color }}
6162` ` `
6263
6364### 3. Result Variables
6465
65- **Version 0.0.x (primitives):**
66+ **Old syntax (primitives):**
6667` ` ` yaml
6768repeat_prompt : true
6869user_prompt : |
6970 Process {{ RESULT }}
7071` ` `
7172
72- **Version 0.1.0 :**
73+ **New syntax :**
7374` ` ` yaml
7475repeat_prompt : true
7576user_prompt : |
7677 Process {{ result }}
7778` ` `
7879
79- **Version 0.0.x (dictionary keys):**
80+ **Old syntax (dictionary keys):**
8081` ` ` yaml
8182user_prompt : |
8283 Function {{ RESULT_name }} has body {{ RESULT_body }}
8384` ` `
8485
85- **Version 0.1.0 :**
86+ **New syntax :**
8687` ` ` yaml
8788user_prompt : |
8889 Function {{ result.name }} has body {{ result.body }}
8990` ` `
9091
9192### 4. Environment Variables
9293
93- **Version 0.0.x :**
94+ **Old syntax :**
9495` ` ` yaml
9596env :
9697 DATABASE : " {{ env DATABASE_URL }}"
9798` ` `
9899
99- **Version 0.1.0 :**
100+ **New syntax :**
100101` ` ` yaml
101102env :
102103 DATABASE : " {{ env('DATABASE_URL') }}"
@@ -110,14 +111,14 @@ env:
110111
111112### 5. Reusable Prompts
112113
113- **Version 0.0.x :**
114+ **Old syntax :**
114115` ` ` yaml
115116user_prompt : |
116117 Main task.
117118 {{ PROMPTS_examples.prompts.shared }}
118119` ` `
119120
120- **Version 0.1.0 :**
121+ **New syntax :**
121122` ` ` yaml
122123user_prompt : |
123124 Main task.
@@ -195,7 +196,7 @@ python scripts/migrate_to_jinja2.py myflow.yaml
195196
196197## Manual Migration Checklist
197198
198- 1 . Update YAML version from ` 1 ` to ` 2 `
199+ 1 . Update YAML version to ` "1.0" ` (string format, e.g., ` version: "1.0" ` )
1992002 . Replace ` {{ GLOBALS_ ` with ` {{ globals. `
2002013 . Replace ` {{ INPUTS_ ` with ` {{ inputs. `
2012024 . Replace ` {{ RESULT_ ` with ` {{ result. `
@@ -242,15 +243,29 @@ python -m seclab_taskflow_agent -t your.taskflow.name -g key=value
242243
243244## Backwards Compatibility
244245
245- Version 0.0.x syntax is no longer supported. Attempting to load a v0.1.0 file will fail with:
246+ ### Version Format
246247
248+ The system now uses string-based semantic versioning (e.g., ` "1.0" ` , ` "1.1" ` ). For backwards compatibility:
249+
250+ - Integer ` version: 1 ` is automatically converted to ` "1.0" `
251+ - Float ` version: 1.2 ` is automatically converted to ` "1.2" `
252+ - String versions like ` version: "1.0" ` are used as-is
253+
254+ Only versions in the ` 1.x ` series are supported. Any version that doesn't convert to ` "1.x" ` format will be rejected:
255+
256+ ```
257+ VersionException: Unsupported version: <version>. Only version 1.x is supported.
247258```
248- VersionException: YAML file uses unsupported version 1 template syntax.
249- Version 2 (Jinja2) is required.
250- Migrate using: python scripts/migrate_to_jinja2.py <file>
259+
260+ ### Template Syntax
261+
262+ The old custom template syntax (e.g., ` {{ GLOBALS_key }} ` , ` {{ INPUTS_key }} ` ) is ** no longer supported** . All files using the old syntax must be migrated to Jinja2 syntax using the migration script:
263+
264+ ``` bash
265+ python scripts/migrate_to_jinja2.py < file>
251266```
252267
253- All v0.0.x files must be migrated to v0. 1.0 before use .
268+ The migration script will also update your version format to the string-based ` " 1.0" ` format .
254269
255270## Additional Resources
256271
0 commit comments