Jinja Templates: Wiring Data Between Workflow Blocks
Use Jinja templates to pull workflow state, block outputs, and environment variables into any text field in a Scout workflow block.
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.
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.
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.