New Syntax (Important)
Learn about the new workflow syntax and how to migrate your existing workflows
Overview
We’ve updated our workflow syntax to make data flow more explicit and consistent. These changes improve readability and make workflows more maintainable. While this update requires modifications to existing workflows, it provides a more robust foundation for workflow development.
1. Input/Output Data References
The most significant change is how we reference input and output data between workflow steps. The new syntax makes the data flow more explicit by using the steps
keyword.
Old Syntax:
inputs[x]
- Referenced input data from step xoutputs[x]
- Referenced output data from step x_x
- Shorthand for input data from step x
New Syntax:
steps[x].input
- References input data from step xsteps[x].output
- References output data from step x_x
- Has been removed
Example
Old Syntax
New Syntax
Notice the addition of the $
prefix in the new syntax. This indicates that the value should be treated as a Python expression. We’ll cover this in detail in the next section.
Key Changes:
inputs[0]
becomessteps[0].input
outputs[0]
becomessteps[0].output
_0
becomessteps[0].input
- Added
$
prefix to indicate Python expressions
2. Template Syntax Changes Inside prompt
Steps
Another significant change is the removal of Jinja templates ({{ }}
) in log
steps and prompt
steps. Instead, we now use Python f-strings with the $
prefix for dynamic content.
Old Syntax (Using Jinja):
New Syntax (Using f-strings):
For multiple lines, you can use a multiline f-string:
The $
prefix is only needed when the value contains a Python expression or f-string. Plain text content doesn’t require the prefix.
3. When to Use the $ Prefix
The $
prefix should be used in two scenarios:
- When referencing step data (inputs/outputs)
- When using Python expressions or f-strings