Semantic Kernel Prompt Created: 23 Jan 2026 Updated: 23 Jan 2026

A Comparative Guide to Prompt Template Factories

As we’ve explored, Semantic Kernel doesn't lock you into a single way of writing prompts. Instead, it provides a variety of "factories" that act as the engine for your AI's instructions. Choosing the right one is like choosing the right transmission for a car: some are built for simple, direct speed (Semantic Kernel), while others are built for handling complex, heavy terrain (Liquid and Handlebars).

To help you decide which blueprint fits your architecture, we have compared the three primary engines available in the SDK.

The Landscape of Template Engines

Each engine has its own syntax and specialized features. While they all aim to transform data into a string the LLM can understand, the "logic" they allow within the prompt varies significantly.

1. Semantic Kernel (Standard)

This is the default, "no-nonsense" engine. It is optimized for performance and is perfectly suited for tasks where you just need to swap out a few variables or call a quick function like {{time.now}}.

2. Liquid Prompt

Liquid is the most robust in terms of pure logic. If your prompt needs to behave like a mini-program—using complex if/else logic, math filters, or custom tags—Liquid is the powerhouse you need.

3. Handlebars

Handlebars is the industry standard for "clean" templates. It excels at rendering structured data (like JSON objects and lists) into a readable format for the AI. It strikes a balance between simplicity and logic.

Feature Comparison Table

The following table (Table 4.1) provides a side-by-side look at the capabilities of each engine. Use this to identify which factory supports the specific technical requirements of your AI application.

FeatureSemantic KernelLiquid PromptHandlebars
Variables{{$variable}}{{variable}}{{variable}}
Functions{{function $param}}{% function param %}{{function param}}
ConditionalsNot supported{% if cond %} ... {% endif %}{{#if cond}} ... {{/if}}
LoopsNot supported{% for item in col %} ... {% endfor %}{{#each items}} ... {{/each}}
CommentsNot supported{% comment %} ... {% endcomment %}{{!-- comment --}}
EscapingNot specified\{{escaped}}\{{escaped}}
Nested Objects{{$obj.prop}}{{obj.prop}}{{obj.prop}}

Making the Decision: Which One Should You Use?

  1. Use Semantic Kernel (Standard) if your prompts are simple, you prioritize execution speed, and you prefer to keep all logic inside your C# code.
  2. Use Liquid if your prompts require high levels of internal logic, such as complex branching based on user data, or if you are using tools like Prompty, which is powered by Liquid.
  3. Use Handlebars if you are dealing with deeply nested objects or lists and want a clean, industry-standard way to present that data to the LLM.
Share this lesson: