Every LLM application assembles prompts somehow. Most teams reach for Python f-strings, JavaScript template literals, or Jinja2. These general-purpose templating tools work well enough for web pages and email templates. But prompts are different. They need multi-role conversations, multi-step chaining, model-specific configuration, and multi-modal content. Shoving all of that through f-strings creates fragile, unreadable code.

PromptL v0.4.6 is the first templating language designed specifically for LLM prompts. Created by Latitude, the open-source prompt engineering platform, PromptL compiles structured templates into the message arrays that every LLM API expects. It ships with a compiler, Python and TypeScript bindings, a VS Code extension, and a universal WASM module. And it has 96 GitHub stars and growing.

The Problem It Solves

Here is what a typical prompt looks like in production code:

messages = [
    {"role": "system", "content": f"You are a {domain} expert."},
    {"role": "user", "content": f"Analyze this: {user_input}"}
]
if include_examples:
    messages.insert(1, {"role": "assistant", "content": example_response})
if use_tools:
    messages.append({"role": "user", "content": tool_output})

This works. But it scales poorly. When you add conditional logic, multi-step flows, and multi-modal content, the code becomes tangled. Conditionals scatter across Python conditionals. Tool outputs get manually spliced into message arrays. Different models need different message formats. The prompt logic is inseparable from the application logic.

PromptL separates prompt definition from application code. The same template becomes a single, readable file.

How PromptL Works

A PromptL template has two sections: a YAML configuration header and a body with role-based blocks, variables, and control flow.

---
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 compiler transforms this into the standard message array:

{
  "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?"}
  ]
}

That output plugs directly into any LLM provider API. The compiler handles the transformation while preserving the semantic structure of the prompt.

Key Features

Variables and Default Values

{{ user_input }}
{{ is_premium_member = true }}
{{ system_prompt || 'You are a helpful AI assistant' }}

Variables support interpolation, assignment, and default values. If a variable is undefined, the fallback value kicks in. This eliminates the "undefined is not a string" errors that plague f-string templates in production.

Role-Based Blocks

<system>
  You are an expert content writer with deep knowledge of {{ industry }}.
</system>

<user>
  Write a blog post about {{ topic }}. Use a {{ tone }} tone.
</user>

<assistant>
  Here's a draft blog post about {{ topic }}...
</assistant>

<message role='example'>
  Here's an example of high-quality content in this style...
</message>

Role blocks replace the manual construction of message arrays. Each <system>, <user>, and <assistant> tag maps directly to a message role. Custom roles work through <message role='example'>.

Steps and Chaining

<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>

Steps are the killer feature. Each <step> block can target a different model, set its own temperature, and optionally isolate its context. The output of one step becomes the input to the next through variable references like {{ researchPhase.outline }}.

This replaces the hand-rolled pipeline code that most teams write to chain multiple LLM calls. Instead of managing state across Python functions, the chaining logic lives in the template itself.

Control Flow

{{ if audience == 'technical' }}
  Provide a 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 technical jargon.
{{ endif }}

{{ for task, index in tasks }}
  {{ index + 1 }}. Complete this task: {{ task }}
{{ else }}
  No tasks provided
{{ endfor }}

Conditionals and loops work directly in the template. No Python if statements scattered through the application layer. The loop syntax includes index access, making numbered lists trivial.

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 get first-class support. No manual base64 encoding. No fighting with provider-specific attachment formats. The compiler handles the transformation.

Partials and Reusability

<prompt path='prompts/code-review' language='python' style='detailed'/>

Partials let you break complex prompts into reusable components that accept parameters. This is the DRY principle applied to prompts. Instead of copy-pasting system instructions across templates, you reference a shared partial.

Error Handling

{{ if response?.suggestions }}
  Consider these improvements: {{ response.suggestions }}
{{ endif }}

{{ raw }}
  Here's how to use variables: {{ variable_name }}
{{ endraw }}

Optional chaining (?.) prevents crashes on undefined nested properties. The {{ raw }} block lets you include template syntax as literal text. These are production-grade safety features that f-strings lack entirely.

The Technical Stack

PromptL is built in TypeScript and compiles to a universal WASM module with RPC. This architecture choice means it runs anywhere that supports WASM. The official bindings are:

  • TypeScript/JavaScript: npm install promptl-ai (15.8K weekly downloads on npm)
  • Python: pip install promptl-ai (1,326 weekly downloads on PyPI)
  • VS Code extension: Syntax highlighting, real-time diagnostics, and navigation

The npm package sits at v0.12.0, and the PyPI package at v1.5.0. The spec version is v0.4.6. The MIT license means no vendor lock-in concerns.

The WASM compilation also means PromptL can integrate with languages beyond Python and TypeScript. Any runtime that supports WASM can call the compiler. Rust, Go, and Ruby integrations are architecturally feasible without maintaining separate compiler implementations.

Why This Matters

Prompts as Code, Not Strings

The broader trend in prompt engineering is the shift from prompts-as-strings to prompts-as-artifacts. WORKFLOW.md (OpenAI Symphony), AGENTS.md, and COMPRESSION.md all treat prompts as structured, version-controlled documents. PromptL extends this philosophy to the template layer. Instead of embedding prompt logic in application code, the template becomes a standalone artifact that application code references.

The Chaining Gap

Multi-step LLM workflows are the norm in production. Most teams implement them with custom Python orchestration code. PromptL's <step> syntax makes the orchestration declarative. Each step declares its model, temperature, and isolation level. The compiler and runtime handle the plumbing.

This is the same insight that drove the adoption of infrastructure-as-code tools. Declarative specifications beat imperative scripts for maintainability and reviewability.

Non-Technical Users Can Edit Prompts

YAML headers and markdown-like syntax are readable by product managers, domain experts, and content designers. They do not need to understand JSON message arrays or Python f-string syntax. This lowers the collaboration barrier that currently forces engineers to mediate every prompt change.

Comparison to Alternatives

Feature PromptL Jinja2 f-strings LangChain PromptTemplate
Role-based blocks Yes No No No
Multi-step chaining Yes No No Via chains
Multi-modal content Yes No No Limited
Model config in template Yes No No No
Provider-agnostic output Yes Yes Yes LangChain only
Partials/includes Yes Yes No No
VS Code support Yes Via extensions No No
WASM runtime Yes No No No

Jinja2 and f-strings are general-purpose templating tools. They lack native support for conversation roles, multi-step workflows, and multi-modal content. LangChain's PromptTemplate handles basic variable substitution but does not address the full prompt lifecycle. PromptL is purpose-built for the specific structure of LLM conversations.

Getting Started

  1. Install the binding:
  2.    npm install promptl-ai

or

   pip install promptl-ai
  1. Write a template:
  2.    ---
       model: gpt-4o
       temperature: 0.6
       ---
    
       You are a {{ domain }} expert.
    
       <user>
         Analyze this input: {{ user_input }}
       </user>
  1. Compile and use:
  2.    from promptl_ai import Compiler
    
       compiler = Compiler()
       messages = compiler.compile(
           template=template_string,
           variables={"domain": "finance", "user_input": "Q1 earnings report"}
       )
  1. Install the VS Code extension for syntax highlighting and diagnostics.

Limitations and Caveats

At 96 stars, PromptL is early. The spec is at v0.4.6, meaning breaking changes are possible. The ecosystem around it is small. The Latitude platform integration is optional but tightly coupled. And the step-chaining feature requires runtime support beyond what the compiler alone provides.

The tool also assumes you want to declare model configuration inside the template. Some teams prefer to keep configuration in the application layer. PromptL's approach centralizes it, which is a tradeoff that favors prompt portability over application flexibility.

The Bigger Picture

PromptL is a signal that the prompt engineering stack is maturing. Six months ago, most teams assembled prompts with string concatenation. Today, the field is moving toward purpose-built tools with compilers, syntax checkers, and IDE support. PromptL is the templating layer. WORKFLOW.md is the orchestration layer. AGENTS.md is the behavior layer. Together, they form a stack that treats prompts as first-class engineering artifacts.

The question is not whether purpose-built prompt tooling will win. It already is. The question is whether PromptL's specific syntax catches on or whether a different standard emerges. With Latitude backing it, a WASM compiler, and bindings for both major ML languages, PromptL has a credible shot.


PromptL v0.4.6 is available at github.com/latitude-dev/promptl under the MIT license. Documentation lives at docs.latitude.so/promptl. The project website is promptl.ai.