> ## Documentation Index
> Fetch the complete documentation index at: https://docs.maadify.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Prompt Templates

> Create, edit, version, and reuse system prompts for sub-agents

## What prompt templates do

Prompt templates are reusable system prompts for sub-agents. Use them to standardize instructions, insert runtime variables, and keep a version history as your prompts change.

<Frame>
  <img src="https://mintcdn.com/maadify/X4aEKWAIWIr8YAhZ/images/prompt_templates/prompt_templates_general.png?fit=max&auto=format&n=X4aEKWAIWIr8YAhZ&q=85&s=02c042dedb41f351a1e9d0ad50c2e738" alt="Prompt Templates page showing searchable template cards and the Create New Prompt Template button" width="1562" height="614" data-path="images/prompt_templates/prompt_templates_general.png" />
</Frame>

<Warning>
  If you edit the current version instead of creating a new version, every sub-agent that uses that template receives the change.
</Warning>

## Browse prompt templates

Open **Prompt Templates** from the sidebar. The page lists the latest version of each available template as a card.

Each card shows:

* **Version**: the active version number.
* **System**: a badge for built-in, read-only templates that are available to all tenants.
* **Name**: the template name.
* **Description**: a short summary. Hover to view longer descriptions.
* **Last Updated**: the most recent update time.
* **Tags**: labels that help you group related templates.
* **View Content**: a hover preview of the template content.

Use **Search prompt templates** to filter by name or keyword. Press **Enter** or click **Search**. If there are more results than fit on one page, use the pagination controls below the grid.

<Note>
  The **Create New Prompt Template** button appears only when your role includes the **prompt\_templates.create** permission.
</Note>

## Create a prompt template

<Steps>
  <Step title="Open the create dialog">
    Select **Create New Prompt Template**. The **Prompt Template** dialog opens on the **Current** tab.
  </Step>

  <Step title="Name the template">
    Enter a **Template Name**. Names are required.
  </Step>

  <Step title="Add a description and tags">
    Write a **Description** that explains when to use the template. Add tags if you want to group templates by workflow, team, or use case.
  </Step>

  <Step title="Write the template content">
    Add the system prompt in **Template Content**. You can write plain Markdown and insert variables with Jinja syntax.
  </Step>

  <Step title="Save the template">
    Select **Save**. New templates start at version `0.1`.
  </Step>
</Steps>

<Frame>
  <img src="https://mintcdn.com/maadify/X4aEKWAIWIr8YAhZ/images/prompt_templates/add_prompt_template.png?fit=max&auto=format&n=X4aEKWAIWIr8YAhZ&q=85&s=8c084a576b4975e85ff678631d1f6381" alt="Prompt Template dialog showing template name, version, description, tags, and template content editor" width="1372" height="861" data-path="images/prompt_templates/add_prompt_template.png" />
</Frame>

<Info>
  **Template Name**, **Description**, and **Template Content** are required before you can save.
</Info>

## Edit a prompt template

Click a template card to open it. Templates owned by your tenant open in edit mode when your role includes **prompt\_templates.update**. System templates and templates owned by another tenant open in view-only mode.

When you edit a tenant-owned template, use **Create New Version** to decide how the save behaves:

* Turn **Create New Version** on to keep the selected version in history and save your changes as the next version.
* Turn **Create New Version** off to update the existing version directly.

Version numbers increase by `0.1` when you create a new version. For example, version `0.1` becomes `0.2`.

<Tip>
  Create a new version for meaningful prompt changes. Edit the existing version only when you are correcting a typo or making a small safe change.
</Tip>

## Insert variables

Prompt templates support Jinja-style variables inside double braces.

```text theme={null}
{{ input.question }}
{{ system.current_datetime }}
{{ tool_model.gmail_12.send_email_34.input_schema }}
```

Use the variable autocomplete in the editor or the **Template Content** help menu to find available variables. The available variables depend on the prompt context and the tools connected to the sub-agent or flow.

Common variable groups include:

* **Inputs**: runtime inputs such as `input.question`, `input.history`, `input.files`, and `input.element_ids`.
* **Trigger Inputs**: values passed by the trigger that started the workflow.
* **System**: system values such as `system.current_datetime`.
* **Tool Models**: tool input and output schemas or examples, such as `tool_model.{tool}.input_schema`.
* **Tool Configs**: configured tool properties, such as `tool_config.{tool}.{property}`.
* **Context variables**: outputs from trigger tools, execute tools, code execution stubs, or structured-output sub-agents.

<Tip>
  Use dot notation for nested values and numeric indexes for arrays. For example, `{{ order_lookup.items.0.id }}` reads the first item ID.
</Tip>

## Preview example inputs

Use **View Input Example** to inspect the sample JSON available to the template. Use **Render Example Inputs** to render the template with those example values. This helps you catch missing variables or formatting issues before saving.

<Tabs>
  <Tab title="Template Content">
    <Frame>
      <img src="https://mintcdn.com/maadify/X4aEKWAIWIr8YAhZ/images/prompt_templates/template_content.png?fit=max&auto=format&n=X4aEKWAIWIr8YAhZ&q=85&s=0bcda7476e9961f7f837039317d73231" alt="Prompt Template dialog showing the View Input Example popover and rendered template preview" width="1539" height="728" data-path="images/prompt_templates/template_content.png" />
    </Frame>
  </Tab>

  <Tab title="Example Inputs">
    <Frame>
      <img src="https://mintcdn.com/maadify/X4aEKWAIWIr8YAhZ/images/prompt_templates/example_inputs.png?fit=max&auto=format&n=X4aEKWAIWIr8YAhZ&q=85&s=2fea137beba7c906d2cd8bc99ed48bf7" alt="Prompt Template dialog showing the View Input Example popover and rendered template preview" width="1565" height="722" data-path="images/prompt_templates/example_inputs.png" />
    </Frame>
  </Tab>

  <Tab title="Render Template Content">
    <Frame>
      <img src="https://mintcdn.com/maadify/X4aEKWAIWIr8YAhZ/images/prompt_templates/render_template_content.png?fit=max&auto=format&n=X4aEKWAIWIr8YAhZ&q=85&s=f005baf4642f123c174323905bc0b30e" alt="Prompt Template dialog showing the View Input Example popover and rendered template preview" width="1526" height="771" data-path="images/prompt_templates/render_template_content.png" />
    </Frame>
  </Tab>
</Tabs>

## Review version history

Open the **History** tab in the dialog to review previous versions for the selected template. Select a version card to preview it.

The preview area includes:

* **Preview**: renders the selected version as Markdown.
* **Diff**: compares the current content with the selected version.
* **Use this version**: copies the selected version back into the editor. Saving after this creates or updates the active template based on your permissions and **Create New Version** setting.

<Frame>
  <img src="https://mintcdn.com/maadify/X4aEKWAIWIr8YAhZ/images/prompt_templates/prompt_template_history_diff.png?fit=max&auto=format&n=X4aEKWAIWIr8YAhZ&q=85&s=ffe24854b18d16ca7642a5d1c29b8c53" alt="Prompt Template History tab showing version cards, preview, diff, and Use this version button" width="1544" height="847" data-path="images/prompt_templates/prompt_template_history_diff.png" />
</Frame>

## Delete a prompt template

If your role includes **prompt\_templates.delete**, a **Delete** button appears for templates owned by your tenant. Select **Delete**, then confirm the deletion in the confirmation dialog.

<Warning>
  Delete only templates that are no longer used by sub-agents. Deleted templates are removed from the template list.
</Warning>

## Example prompt template

```text agent_summary.txt theme={null}
You are the operations coordinator.

Current time: {{ system.current_datetime }}
User request: {{ input.question }}

Summarize the most recent order activity from {{ order_lookup.orders }}.
If any orders are blocked, list the reason and recommended next step.
Return the result as a short paragraph and a bullet list.
```
