Skip to main content
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.

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

1

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.
Combine all answers for the original email. Write a complete, clear, and friendly reply that only includes the summarized answers.

IMPORTANT: Focus SOLELY on the answers. Do NOT include greetings (like "Hi Name"), do
NOT write intro paragraphs (like "Thank you for reaching out"), and do NOT include
signatures.
2

Add User Message

List the different variables respectively.
Edit LLM Node
3

Add Template Node

After LLM node, click to add Template node.
Add Template Node
4

Set up the Input Variables

Click the Template node, go to the Input Variables section, and add these two items:
  • customer: Choose User Input / {x} customer_name String
  • body: Choose LLM / {x} text String
    Template Input Variable
5

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:
Hi {{ customer }},

Thank you for reaching out to us, and we are more than happy to provide you with the information you are seeking.

Here are the details regarding your specific questions:

{{ body }}

---
Thank you for reaching out to us!
Best regards,
Anne
Here’s the final workflow.
Final Workflow
Click Test Run. Ask multiple questions in one email. Notice how your final output has a perfectly written custom intro, the LLM’s beautifully summarized answers in the middle, and a standard, professional signature at the bottom.

Mini Challenge

  1. How would you change the Jinja2 code to make a numbered list (1. Answer, 2. Answer) instead of bullet points?
    Check the Template Designer Documentation or ask an LLM about it.
  2. What else can Template node do?