The Research Report
PromptL: The Templating Language That Treats Prompts Like Code
Every LLM project hits the same wall. You start with a string. Then you need variables. Then conditionals. Then you're looping over few-shot examples. Before long, you've built a rickety templating system on top of Python f-strings or Jinja, and it's buckling under the weight of what you're actually trying to do: compose multi-turn conversations with dynamic logic, multi-modal content, and model configuration, all in one place.
PromptL v0.4.6 takes that pattern and turns it into a proper language. Latitude, the open-source prompt engineering platform behind it, built PromptL specifically for LLM prompting. Not as a web templating afterthought. Not as string interpolation with extra steps. As a compiled language that understands conversations, roles, steps, and content types from the ground up.
The result is a tool that makes the ad-hoc approach look exactly as fragile as it is.
What PromptL Actually Is
PromptL is a templating language that compiles into structured message arrays. You write a .promptl file. The compiler parses it. The output is a JSON object with model configuration and a messages array that any LLM provider API can consume.
Here's what a minimal PromptL template looks like:
---
model: gpt-4o
temperature: 0.6
---
You are a useful AI assistant expert in geography.
<user>
Hi! What's the capital of {{ country_name }}?
</user>
The YAML frontmatter handles configuration. The body handles the conversation. The {{ country_name }} syntax handles variable interpolation. And the <user> tags handle role-based message construction.
That compiles to:
{
"model": "gpt-4o",
"temperature": 0.6,
"messages": [
{
"type": "system",
"content": "You are a useful AI assistant expert in geography."
},
{
"type": "user",
"content": "Hi! What's the capital of Spain?"
}
]
}
This is the basic contract. But PromptL's real value shows up when things get complex.
Why f-Strings and Jinja Fall Short
Most teams assemble prompts one of three ways:
f-strings in Python. You embed variables directly in template literals. Works for five-line prompts. Breaks when you need conditionals, loops, or multi-message conversations. No validation. No structure. The string is opaque until runtime.
Jinja2 templates. More powerful. You get conditionals and loops. But Jinja was built for HTML. It doesn't understand that a prompt is a conversation between roles. You end up encoding system/user/assistant boundaries yourself, usually as conditionals inside a single string. The model configuration lives somewhere else entirely.
Manual JSON construction. You build the messages array in code. Maximum flexibility, minimum readability. When someone needs to understand what prompt the model is actually receiving, they have to trace through your Python function.
All three approaches share the same problem: they treat prompts as strings with some interpolation sprinkled on top. But prompts aren't strings. They're structured conversations with configuration metadata. PromptL treats them as what they are.
The Features That Matter
Variables with Defaults
{{ system_prompt || 'You are a helpful AI assistant' }}
You can define defaults inline. No more if not provided, use this fallback logic scattered across your codebase. The template declares what it needs and what happens when it's missing.
Role-Based Message Blocks
<system>
You are an expert in {{ domain }}.
</system>
<user>
Analyze this data: {{ input_data }}
</user>
<assistant>
Here's my analysis...
</assistant>
Instead of manually constructing message arrays with type fields, you use semantic tags. The compiler maps <system>, <user>, and <assistant> to the correct role fields. Custom roles work too with <message role='example'>.
Conditionals
{{ if audience == 'technical' }}
Provide detailed analysis including architecture patterns and performance considerations.
{{ else if audience == 'business' }}
Focus on business value, ROI, and strategic implications.
{{ else }}
Give a balanced overview covering key points without jargon.
{{ endif }}
If/else/endif blocks let you adapt prompt content based on runtime variables. This replaces the if/else chains you'd normally write in Python, except the logic lives in the template where it's visible and editable by non-engineers.
Loops with Index
{{ for task, index in tasks }}
{{ index + 1 }}. Complete this task: {{ task }}
{{ else }}
No tasks provided
{{ endfor }}
The else clause in a for loop handles empty collections. The index variable gives you iteration count. This is Jinja-level iteration in a language designed for prompts, not web pages.
Steps and Chaining
This is where PromptL differentiates from every templating approach I've seen. You can chain multiple LLM calls in a single template:
<step as='researchPhase' provider='OpenAI' model='gpt-4'>
<user>
Research key points about {{ topic }} and create an outline.
</user>
</step>
<step as='writing' isolated='true' temperature='0.7'>
<user>
Using this outline: {{ researchPhase.outline }}
Write a detailed article.
</user>
</step>
Each step can specify its own model, provider, and temperature. Steps can reference outputs from previous steps. The isolated flag controls whether a step inherits conversation context from prior steps or starts fresh. This turns a single template into a multi-step pipeline, and the pipeline logic is declarative and visible.
Multi-Modal Content
<content-text>
Describe what you see in the following image.
</content-text>
<content-image>
screenshots/code-review.png
</content-image>
<content-file mime='application/pdf'>
documents/style-guide.pdf
</content-file>
Images and files are first-class content types. No base64 encoding in your template. No manual construction of content arrays with type discriminators. The compiler handles it.
Partials for Reusability
<prompt path='prompts/code-review' language='python' style='detailed'/>
You can reference other PromptL files as reusable components. This lets you build a library of prompt fragments and compose them. Change the shared persona template once, and every prompt that includes it picks up the change.
Error Handling
{{ if response?.suggestions }}
Consider these improvements: {{ response.suggestions }}
{{ endif }}
Optional chaining with ?. handles undefined nested properties without blowing up. And {{ raw }} blocks let you include template syntax as literal text when you need to show users how templates work.
Comments
/* This section handles premium user features */
Inline comments that don't appear in the compiled output. Essential for maintaining complex prompts over time.
The Compiler and Bindings
PromptL ships as a compiler with official bindings for TypeScript/JavaScript and Python. The npm package is promptl-ai (15.8K weekly downloads on npm as of late April 2026). The Python package is promptl-ai (available via pip, supports Python 3.9+). Both wrap a universal WASM module, so the compilation logic is consistent across runtimes.
TypeScript usage:
import { Promptl } from 'promptl-ai';
const promptl = new Promptl();
const prompt = `
---
model: gpt-4o
temperature: 0.7
---
<system>
You are a {{ domain }} expert.
</system>
<user>
{{ question }}
</user>
`;
const chain = promptl.chains.create({
prompt,
parameters: {
domain: 'finance',
question: 'What are the key risks in emerging market debt?',
},
});
Python usage:
from promptl_ai import Promptl
promptl = Promptl()
prompt = """
---
model: gpt-4o
temperature: 0.7
---
<system>
You are a {{ domain }} expert.
</system>
<user>
{{ question }}
</user>
"""
chain = promptl.chains.create(
prompt=prompt,
parameters={
"domain": "finance",
"question": "What are the key risks in emerging market debt?",
},
)
The WASM module also makes PromptL available in any language that can run WASM natively, which is most modern runtimes.
The VS Code Extension
PromptL has a VS Code extension (published under LatitudeData.promptl-vscode) that provides:
- Syntax highlighting for
.promptlfiles, including YAML frontmatter, message tags, mustache expressions, and control flow - Real-time diagnostics that catch syntax errors, undefined variables, and invalid references as you type
- Go to Definition that lets you Cmd+Click on prompt path references to navigate to the referenced file
- Hover information showing details about referenced prompt files
- Auto-closing for brackets and tags
The extension turns PromptL from a file format into something you can actually work with day-to-day. Real-time error checking alone saves significant debugging time when you're iterating on complex templates.
Latitude: The Platform Behind PromptL
PromptL is built and maintained by Latitude, an open-source prompt engineering platform with 3,955 GitHub stars on its main repo (latitude-dev/latitude-llm). Latitude provides a prompt editor, evaluation suite, dataset management, observability telemetry, and integrations with frameworks like LangChain, LlamaIndex, CrewAI, DSPy, and Haystack.
PromptL is the language that powers Latitude's prompt editor. It's also usable standalone. You don't need to buy into the Latitude platform to use PromptL in your codebase. The compiler, bindings, and VS Code extension all work independently.
This dual status, both standalone tool and platform substrate, is worth noting. PromptL benefits from Latitude's engineering resources and real-world usage at scale. But it's also MIT-licensed and self-contained, so you can adopt it without committing to a broader platform.
Why This Matters Now
The prompt engineering field is moving from ad-hoc string assembly toward treating prompts as engineering artifacts. Several converging trends make PromptL timely:
Prompts are getting longer and more structured. The average system prompt has grown from a few lines to multiple kilobytes. Multi-turn agent prompts span tens of thousands of tokens. Managing these as raw strings is untenable. You need structure, validation, and composability.
Multi-model deployments are the norm. Teams run the same prompt logic against GPT-4, Claude, Gemini, and local models. PromptL's provider-agnostic compilation means one template works across all of them. The YAML frontmatter can specify a default model, but the runtime can override it.
Non-engineers need to edit prompts. Product managers, domain experts, and content specialists often have better prompt intuitions than the engineers wiring them up. But they can't edit Python f-string templates safely. PromptL's declarative syntax is readable enough that non-technical team members can modify prompts directly, with the compiler catching their errors.
The prompts-as-code movement is accelerating. OpenAI's Symphony uses WORKFLOW.md as a prompt contract. PromptOpsKit stores prompts as Markdown alongside code. Prompt governance and traceability are becoming production requirements. PromptL fits directly into this trajectory. Templates are version-controllable files with clear syntax, not string concatenation logic scattered across functions.
Getting Started
1. Install the compiler.
# TypeScript/JavaScript
npm install promptl-ai
# Python
pip install promptl-ai
2. Create a .promptl file.
Start simple:
---
model: gpt-4o
temperature: 0.7
---
<system>
You are a helpful assistant.
</system>
<user>
{{ question }}
</user>
3. Compile and use it.
import { Promptl } from 'promptl-ai';
const promptl = new Promptl();
const chain = promptl.chains.create({
prompt: yourTemplate,
parameters: { question: 'What is PromptL?' },
});
const conversation = chain.step();
// conversation.messages contains the structured message array
4. Install the VS Code extension.
Search for "PromptL" in the VS Code extension marketplace. It provides syntax highlighting and real-time diagnostics for .promptl files.
5. Explore advanced features.
Add conditionals for audience-specific content. Use <step> blocks for multi-stage pipelines. Reference shared partials with <prompt path='...'/>. Add images and files with <content-image> and <content-file>.
The full documentation is at docs.latitude.so/promptl. The GitHub repo is github.com/latitude-dev/promptl.
What's Still Early
PromptL is at v0.4.6 with 96 GitHub stars. That's early. The language spec is solid, the compiler works, and the bindings are functional. But the ecosystem is nascent. The VS Code extension has 5 installs. The community is small. You'll be an early adopter.
The tradeoff is worth considering. PromptL solves real problems that f-strings and Jinja don't. The question is whether you want to invest in an early ecosystem or wait for it to mature. For teams already feeling the pain of ad-hoc prompt assembly, the answer is straightforward. The compiler produces standard JSON. If PromptL disappears tomorrow, your compiled output still works with every LLM API. The risk is low.
The 15.8K weekly npm downloads suggest more usage than the GitHub star count implies. Teams are using the compiler without necessarily starring the repo. That's a healthy adoption pattern for infrastructure tooling.
The Bigger Picture
PromptL is part of a broader shift: prompts graduating from strings to structured artifacts. When you write a PromptL template, you're not writing a string with variable holes. You're writing a program that compiles into a structured conversation. The distinction matters.
Strings are opaque. You can't validate them at edit time. You can't compose them safely. You can't version-control their structure separately from their content. PromptL gives you all of those capabilities while keeping the syntax readable enough for non-engineers.
The step-chaining feature is particularly notable. Multi-step LLM pipelines normally require orchestration code. PromptL lets you declare the pipeline in the template itself, with each step specifying its own model and parameters. That's a meaningful reduction in the distance between "what I want the LLM to do" and "the code that makes it happen."
Whether PromptL specifically wins as the standard is less important than what it represents. The era of treating prompts as strings is ending. Purpose-built templating languages for LLM prompting are the logical next step. PromptL is the most complete implementation of that idea available today.
Citations
- PromptL v0.4.6 official site: promptl.ai
- PromptL GitHub repository (96 stars, 10 forks, MIT license): github.com/latitude-dev/promptl
- PromptL Python bindings (11 stars): github.com/latitude-dev/promptl-py
- npm package
promptl-aiv0.12.0, 15.8K weekly downloads: registry.npmjs.org/promptl-ai - PromptL VS Code extension: marketplace.visualstudio.com/items?itemName=LatitudeData.promptl-vscode
- Latitude open-source platform (3,955 stars): github.com/latitude-dev/latitude-llm
- PromptL documentation: docs.latitude.so/promptl
- Latitude organization on GitHub (37 public repos, created Feb 2022): github.com/latitude-dev
Suggested Title
PromptL: The First Real Templating Language for LLM Prompts
Word Count
~1,650 words (body text)
Fact-Check Notes
- GitHub star count (96) and fork count (10) are from live search results as of May 1, 2026. These will change over time.
- npm weekly download count (15.8K) is from the npm registry and may fluctuate.
- VS Code extension install count (5) is from the marketplace page and is very early. This will grow.
- Latitude-llm repo star count (3,955) and fork count (310) are from live search and will change.
- The npm package version on the registry shows v0.12.0 while the PromptL spec version on the website shows v0.4.6. These are different versioning tracks: the spec is v0.4.6 and the npm package is v0.12.0. I've used the spec version (v0.4.6) in the article title as that's what the official site displays.
- The Python binding requires Python 3.9+, confirmed from the GitHub README.
- PromptL is MIT licensed, confirmed from GitHub repo metadata.
- The Latitude platform's provider integrations (LangChain, LlamaIndex, CrewAI, DSPy, Haystack) are from their documentation llms.txt index.
- I did not find dedicated Reddit or Hacker News discussions about PromptL. The community engagement appears concentrated on GitHub.