Documentation Index
Fetch the complete documentation index at: https://docs.pflow.run/llms.txt
Use this file to discover all available pages before exploring further.
For the curious. Your AI agent handles template variables automatically. This explains how data flows between nodes and what’s happening when you see
${variable} syntax in workflows or traces.${variable} syntax in a workflow, it’s pulling data from previous nodes, workflow inputs, or nested structures.
Basic syntax
The${variable} syntax accesses values from the shared store:
${read.content} pulls the content output from the read node.
Nested access
Template variables can traverse deeply nested structures:apinode’s outputresponsekeyitemsarray- First element (
[0]) namefield
Type preservation
Template variables preserve the original data type when used alone. When combined with text, they become strings.
| Template | Original value | Result | Type |
|---|---|---|---|
"${count}" | 42 (int) | 42 | int |
"Count: ${count}" | 42 (int) | "Count: 42" | string |
"${config}" | {"key": "val"} | {"key": "val"} | dict |
"Prefix ${config}" | {"key": "val"} | "Prefix {\"key\": \"val\"}" | string |
${var}) preserve type. Complex templates (any surrounding text) become strings.
Inline objects
This type preservation makes inline object construction intuitive:settings is {"timeout": 30} and results is {"status": "ok"}, the resolved stdin is:
JSON auto-parsing
When a template accesses nested fields on a JSON string, pflow automatically parses it:fetch.stdout is a string containing JSON, the nested access ${fetch.stdout.results[0].name} works because pflow:
- Sees you’re trying to access
.results - Attempts to parse
stdoutas JSON - Traverses the parsed structure
- Returns the value at
results[0].name
Workflow inputs
Template variables also reference workflow inputs declared in the workflow definition:Stdin input
Inputs can receive piped data by addingstdin: true. See Stdin input for details.
Array notation
Array elements are accessed using bracket notation:Batch processing
In batch nodes, a special template variable (${item} by default) represents the current item:
as: "file" creates ${file} as the item variable. See Batch processing for details.
Coalesce operator
The?? operator returns the first resolved value, skipping variables that don’t exist (e.g., from a branch that didn’t execute):
Node metadata
Beyond their primary outputs, some nodes expose metadata that downstream nodes can access through templates. This is useful for cost-aware workflows, debugging, or building on execution details.LLM token usage
Bothllm and claude-code nodes write llm_usage with token counts:
Shell command
Theshell node stores the resolved command that was actually executed, accessible as ${node_id.command}. Useful for logging or debugging when the command is built dynamically from templates.
HTTP response details
Thehttp node exposes response_headers (dict) and response_time (seconds as float) alongside the response body. Useful for handling pagination links, rate limit headers, or performance monitoring.
Escaping
Literal${...} text (not a template variable) uses double dollar signs to escape:
Price: ${PRICE} instead of trying to resolve a variable.
Validation
pflow validates template variables at workflow creation time:- Unknown variables → Error: “Unresolved variable:
${typo}” - Type mismatches → Warning: “Expected string, got dict”
- Invalid syntax → Error: “Invalid template:
${foo.}”
Compile-time vs runtime validation
Compile-time vs runtime validation
Most validation happens when the workflow is created (compile-time). Some validations happen during execution (runtime):
- Compile-time: Variable existence, type compatibility, syntax
- Runtime: JSON parsing success, nested access on dynamic values
Related
- Nodes overview - How nodes use template variables
- Batch processing - Item variables in batch nodes
- Debugging - Troubleshooting template issues

