Skip to main content
Jinja templates enable dynamic inputs inside workflow blocks, pulling in state, outputs, environment variables, or computed values wherever a text field is accepted. They are the core mechanism for passing data between blocks — anywhere you can type text in a block’s configuration, you can reference values from elsewhere in the workflow.

Core Syntax

Jinja has two delimiters:
  • {{ ... }} for expressions — evaluated and rendered into the field.
  • {% ... %} for control flow — conditionals and loops that shape the output.
{{ inputs.user_message }}
{{ summarize_block.output }}
{% if inputs.priority == "high" %}urgent{% else %}normal{% endif %}

Variable References

Scout provides three namespaces in every template:
NamespaceWhat it references
inputs.field_nameFields defined on the workflow’s Input block
block_id.outputOutput produced by a prior block
_env.VAR_NAMEEnvironment variables for secrets and config
Nested fields use chained dot notation:
{{ fetch_user.output.email }}

Common Use Cases

Build a prompt with workflow state

Assemble an Agent prompt from the original question and retrieved context:
You are a helpful assistant.
The user asked: {{ inputs.question }}
Relevant context from the knowledge base: {{ retrieval_block.output }}
Answer based only on the context above.

Build an API payload dynamically

Inject workflow values into a JSON body for an Action block:
{
  "user_id": "{{ inputs.user_id }}",
  "action": "{{ inputs.action }}",
  "timestamp": "{{ datetime.now(timezone.utc).isoformat() }}"
}

Conditional messaging

Change the message based on workflow state:
{% if inputs.priority == "high" %}
Urgent: {{ inputs.message }}
{% else %}
FYI: {{ inputs.message }}
{% endif %}

Date and Time

Use __exp_global for ready-made date strings, or reach for datetime directly when you need custom formatting:
{# Simple date strings #}
{{ __exp_global.current_date }}
{{ __exp_global.current_datetime }}
{{ __exp_global.current_time_utc }}

{# Custom formatting #}
{{ datetime.now(timezone.utc).isoformat() }}
{{ datetime.now(ZoneInfo("America/Los_Angeles")).strftime('%Y-%m-%d %I:%M %p') }}
The objects datetime, timezone, and ZoneInfo are available inside any template.

Safe Templating Rules

Reference specific fields rather than whole objects. {{ block.output.name }} is safer than {{ block.output }} because it fails loudly if the field is missing, instead of silently rendering a large object.
Keep logic out of templates. Move any conditional longer than one line into a Condition block. Templates are for inserting values, not for branching business logic.
Test in Console first. The Console shows rendered template output, so you catch bad references before they reach production.
Use _env for secrets and never hardcode credentials. Reference API keys and tokens through _env.VAR_NAME so they stay out of your workflow definition.

Next Steps

Logic and State

Understand how data flows between blocks through shared state.

Creating Workflows

Build cleaner workflow architectures with a consistent pattern.

Blocks

See which block produces which output to reference in templates.

Running Workflows

Validate rendered template output in the Console before going live.