{{...}} tags that graph fills from data before a step, tool or agent runs. Templates only move data. They never call a model, and they have no logic beyond iterating over lists.
Where templates are used
Inside a
map or reduce body, item and index reference the current element, and reduce adds accumulator. A filter gate gets item and index too.
Variables
A variable is a dotted path from a root. Number segments index into arrays, andlength as the last segment counts the items in an array or the characters in a string.
input, item, index, accumulator or length.
A route step’s result is read through the route’s own id: {{triage.branch}} names the branch that ran and {{triage.result}} holds what it returned. Steps inside a branch are visible only to later steps in the same branch.
Typed values
When a string is exactly one tag, the tag’s value keeps its JSON type. When a tag sits in other text, the result is a string, and objects and arrays are written as JSON.max set to 50 and ids to [1, 2, 3], limit is the number 50, ids is the array [1, 2, 3], and query is the string "team Core".
A null value written into text renders as nothing.
Sections
A section renders its body once for each item in a list, once for an object or any other value, and not at all for a missing,null, false or empty value.
-
Inside a section, a tag without a root, such as
{{title}}, reads from the current item, then from enclosing sections. If no item has the key, it renders as nothing. -
{{@index}}is the item’s position, starting at 0.{{@first}}and{{@last}}are booleans you can use as sections. -
An inverted section,
{{^path}}...{{/path}}, renders only when the section would not: -
A section path that doesn’t resolve counts as empty rather than an error, so
{{^fetch.optional}}works as a fallback. A section over a step that doesn’t exist is still an error.
Errors
A variable that doesn’t resolve stops the step with one of three errors:graph plan validate catches references to steps that don’t exist or haven’t run yet before the plan runs. To learn how a plan responds to each error, see Handle failures.
Not supported
Templates have no conditionals, functions, partials, comments or inheritance, and using that syntax is a parse error. Put any computation in a step, such as areshape tool or an infer gate.