Skip to Content
almyty docs — v1
AgentsTemplate Expressions

Template Expressions

Template expressions let nodes in an agent pipeline reference data from the invocation input or from other nodes’ outputs. They use {{...}} syntax and are resolved at runtime just before each node executes.

Syntax

{{source.path.to.value}}

The first segment identifies the data source. Subsequent segments navigate into the data structure using dot notation.

Data Sources

SourceSyntaxDescription
Input{{input.property}}The agent’s invocation payload
Node output{{nodes.<id>.output}}Output of any upstream node
Loop context{{loop.item}}, {{loop.index}}Current item and index inside a Loop node

Input Data

{{input.message}} // Top-level property {{input.user.name}} // Nested property {{input.items[0].title}} // Array access

Node Outputs

{{nodes.llm_1.output}} // Full output of node llm_1 {{nodes.tool_1.output.data}} // Nested property {{nodes.transform_1.output}} // Transform result

Loop Context

Inside a Loop node’s body:

{{loop.item}} // Current item being iterated {{loop.index}} // Zero-based index {{loop.item.name}} // Property of the current item

In the UI

Template expressions are used in node configuration fields throughout the builder:

  1. Click a node on the canvas to open its config panel
  2. In any text field that supports expressions (prompts, mappings, parameters), type {{
  3. Autocomplete suggests available upstream nodes and input properties
  4. Select or type the full expression path
  5. Use the Test panel to verify expressions resolve correctly with sample input

Examples

Simple String Interpolation

In an LLM Call node’s user prompt template:

You asked: {{input.message}}

Resolves to: You asked: What is the weather?

Composing Multi-Node Data

Based on the search results ({{nodes.tool_1.output.count}} found), here is a summary: {{nodes.llm_1.output}}

JSON Construction in Transform Nodes

const query = "{{input.query}}"; const results = {{nodes.tool_1.output}}; return { query, resultCount: results.length, summary: results.map(r => r.title).join(", ") };

Type Handling

Expression TargetResolved Type
String propertystring
Number propertynumber
Objectobject (JSON)
Arrayarray (JSON)
Boolean propertyboolean
Null/undefinednull

When an expression is used inside a string (like a prompt template), non-string values are serialized to JSON automatically.

When an expression is the entire value of a field (like a Transform node’s input), the original type is preserved.

Error Handling

ScenarioBehavior
Node does not existPipeline validation catches this before execution
Node has not executed yetTopological sorting prevents this for valid pipelines
Node returned an errorDownstream node receives null; the failure is recorded in the execution log

To handle optional data, use JavaScript in Transform nodes:

const data = {{nodes.tool_1.output}}; const name = data?.name || "Unknown"; return { name };

Best Practices

  1. Keep expressions simple — use Transform nodes for complex data manipulation
  2. Validate your schema — define Input node schemas to catch bad data early
  3. Use meaningful node IDssearch_api is clearer than tool_1 in expressions
  4. Test incrementally — use the agent test panel to verify expressions resolve correctly