In Lesson 8, we successfully built a powerful Agent that can think and search. However, you might have noticed a tiny issue: even though we asked the final LLM to list the answers, sometimes the formatting can be a bit messy or inconsistent (e.g., mixing bullet points with paragraphs). To fix this, we need a dedicated format assistant to organize the answers into a beautiful, standardized format before the final LLM writes the email.Documentation Index
Fetch the complete documentation index at: https://docs.dify.ai/llms.txt
Use this file to discover all available pages before exploring further.
Template
It takes the original data (like your list of answers), follows a strict design template/standards you provide, and generates a perfectly formatted block of text, ensuring consistency every single time.Hands-On: Polish the Email Layout
Update the LLM Node
Since the Template node will be handling the greetings, we need to tell LLM to focus solely on the questions and answers. Copy and paste the prompt below or feel free to edit it.
Set up the Input Variables
Click the Template node, go to the Input Variables section, and add these two items:
-
customer: ChooseUser Input / {x} customer_name String -
body: ChooseLLM / {x} text String
Format with Jinja
What is Jinja2?In simple terms, Jinja2 is a tool that allows you to format variables (like your list of answers) into a text template exactly how you want. It uses simple symbols to mark where variables go and perform basic logic. With it, we can turn a raw list of data into a neat, standardized text block.Here, we can put together opening, signatures, and email body to make sure the email is professional and consistent every time.Copy and paste this exact layout into the Template code box:

Mini Challenge
- How would you change the Jinja2 code to make a numbered list (1. Answer, 2. Answer) instead of bullet points?
- What else can Template node do?

