> For the complete documentation index, see [llms.txt](https://docs.karini.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.karini.ai/prompt-management/prompt-template-tags.md).

# Prompt Template Tags

### Overview

Prompt template tags are quick-insert buttons available in the prompt editor. They allow users to embed special formatting tags and dynamic variables into prompt templates, instructing the LLM how to structure its responses with rich media, citations, references, and structured output formats.

These tags are processed at runtime ,the system parses the LLM's response, identifies the tags, and renders them as interactive UI elements (clickable citations, embedded images, video players, etc.) in the final output.

### Accessing Template Tags

Template tags are located directly below the prompt text area in the Prompt Editor. They appear as a row of buttons:

* **Add variable**&#x20;
* **Image Tag**&#x20;
* **Direct Link Citation**&#x20;
* **S3 Citation**&#x20;
* **Sitecore Citation**&#x20;
* **Reference Tag**&#x20;
* **Video Tag**&#x20;
* **Email Draft**

<figure><img src="https://415930246-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7ZrVuiAUMyuYVvrK5KaB%2Fuploads%2F8yTHs06hSWnJX8VLureU%2Fimage.png?alt=media&amp;token=03284a09-d9ea-44cd-ae73-962b94dfd0d1" alt=""><figcaption></figcaption></figure>

### Template Tags Reference

#### **1. Add Variable**

**Purpose:** Inserts a dynamic input variable placeholder into the prompt template.

**Inserted Template:** `{VAR001}`, `{VAR002}`, `{VAR003}`, etc.

**How It Works:**

* Each click generates a new uniquely numbered variable (VAR001, VAR002, ...).
* Variables use curly brace syntax: `{variable_name}`.
* At runtime, variables are replaced with actual values from user input, API parameters, or upstream workflow nodes.
* You can manually rename variables to meaningful names (e.g., `{customer_name}`, `{query}`, `{document_type}`).

**Example Prompt:**

```
You are a customer support agent. The customer's name is {customer_name} and their issue is: {issue_description}. 
Respond politely and provide a resolution.
```

**Runtime Behavior:** Variables are substituted before the prompt is sent to the LLM. If a variable has a configured default value, it is used when no runtime value is provided.

#### 2. Image Tag

**Purpose:** Inserts an image rendering tag that instructs the LLM to reference an image stored in S3. The system fetches a presigned URL and renders the image inline in the response.

**Inserted Template:**

```
img#$<s3_path>$#img
```

**Example in Prompt:**

```
After generating the chart, output the result using this format: img#$s3://my-bucket/charts/output.png$#img
```

**Runtime Behavior:**

* During streaming: Displays "Generating image..." as placeholder text.
* After completion: The system extracts the S3 path, generates a presigned URL, and renders an `<img>` element.

#### 3. Direct Link Citation

**Purpose:** Inserts a citation tag for external web sources with direct HTTP/HTTPS links. Renders as a clickable numbered reference that opens the source URL in a new browser tab.

**Inserted Template:**

```xml
<citation file_name="<title>" source_url="<direct_http_link>" page_number="<page_number>">[<number>]</citation>
```

**Example in Prompt:**

```
When citing external sources, use this format:
<citation file_name="Research Paper" source_url="https://example.com/paper.pdf" page_number="5">[1]</citation>
```

**Runtime Behavior:** Renders as a clickable blue underlined number `[1]` that opens the `source_url` in a new tab when clicked.

**Use Case:** RAG workflows that retrieve content from web-crawled sources and need to provide verifiable source links.

#### 4. S3 Citation

**Purpose:** Inserts a citation tag for documents stored in Amazon S3. Renders as a clickable numbered reference that fetches and displays the document from S3 storage.

**Inserted Template:**

```xml
<citation source-ref="<s3_path>" page_number="<page_number>">[<number>]</citation>
```

**Example in Prompt:**

```
Cite sources using this format:
<citation source-ref="s3://my-bucket/documents/report.pdf" page_number="12">[2]</citation>
```

**Runtime Behavior:** Renders as a clickable blue underlined number `[2]`. When clicked, the system generates a presigned URL for the S3 object and displays the referenced document at the specified page.

**Use Case:** Knowledge base workflows where source documents are stored in S3 and users need to verify or view the original content.

#### 5.Sitecore Citation

**Purpose:** Inserts a citation tag for content sourced from Sitecore CMS. Renders as a clickable numbered reference linked to the Sitecore content item.

**Inserted Template:**

```xml
<citation sitecore_source="<sitecore_source_id>" page_number="<page_number>">[<number>]</citation>
```

**Example in Prompt:**

```
Reference Sitecore content using:
<citation sitecore_source="110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9" page_number="3">[3]</citation>
```

**Runtime Behavior:** Renders as a clickable blue underlined number `[3]`. When clicked, resolves the Sitecore item by its GUID and displays the referenced content.

**Use Case:** Enterprise content management workflows where knowledge is stored in Sitecore CMS and responses need traceable citations back to CMS items.

#### 6.Reference Tag

**Purpose:** Inserts a reference tag that renders the document file name as a clickable hyperlink with associated metadata (source path and page number).

**Inserted Template:**

```xml
<reference file_name="<file_name>" source_ref="<s3_path>" page_number="<page_number>"><file_name></reference>
```

**Example in Prompt:**

```
Link to source documents using:
<reference file_name="User Manual" source_ref="s3://my-bucket/docs/manual.pdf" page_number="8">User Manual</reference>
```

**Runtime Behavior:** Renders the display text (e.g., "User Manual") as a clickable blue underlined link. When clicked, fetches the S3 document via presigned URL and opens it at the specified page.

**Difference from S3 Citation:** Citations render as numbered markers `[1]`, `[2]`, etc. Reference Tags render the actual document name as the clickable text, providing a more descriptive inline link.

#### 7. Video Tag

**Purpose:** Inserts a video rendering tag that instructs the LLM to reference a video stored in S3. The system fetches a presigned URL and renders an HTML5 video player inline in the response.

**Inserted Template:**

```
video#$<s3_path>$#video
```

**Example in Prompt:**

```
Include the tutorial video in your response: video#$s3://my-bucket/videos/tutorial.mp4$#video
```

**Runtime Behavior:**

* During streaming: Displays "Generating video..." as placeholder text.
* After completion: The system extracts the S3 path, generates a presigned URL, and renders an HTML5 `<video>` element with playback controls (500px width, auto height).

#### 8.Email Draft

**Purpose:** Inserts a structured email draft tag that instructs the LLM to format its response as a styled email block. The system parses the `<emaildraft>` tag and renders the output as a formatted email card in the response UI, with bold subject line and structured body content using HTML formatting.

**Inserted Template:**

```xml
<emaildraft id="<id>"><strong>Subject: </strong><subject_content><br/><br/>Team,<br/><main_content><br/>Regards,<br/>[Your Name]</emaildraft>
```

**Example in Prompt:**

```
When drafting an email, use this exact format:
<emaildraft id="email_001"><strong>Subject: </strong>Q3 Project Status Update<br/><br/>Team,<br/>Please find below the latest status update on our Q3 deliverables. All milestones are on track and the next review is scheduled for Friday.<br/>Regards,<br/>John Smith</emaildraft>
```

**Template Parameters:**

| Parameter           | Description                                                                  |
| ------------------- | ---------------------------------------------------------------------------- |
| `id`                | Unique identifier for the email draft (e.g., `email_001`, `draft_response`)  |
| `<subject_content>` | The email subject line, rendered in bold after "Subject: "                   |
| `<main_content>`    | The email body text with `<br/>` tags for line breaks                        |
| `[Your Name]`       | Signature placeholder - replaced by the LLM with the appropriate sender name |

**Runtime Behavior:** Renders as a formatted email card in the response UI. The subject line appears in bold, the body is structured with proper line breaks, and the entire block is visually distinct as an email draft that can be copied and used directly.

**Use Case:** Workflows where the agent generates email communications such as customer outreach, internal notifications, support replies, marketing drafts, or follow-up messages and the output needs to be structured for direct use in email clients or downstream automation.
