Variables and Dynamic Content

Use variables in PromptOwl for dynamic prompts - system variables, custom inputs, artifact data, and block output chaining.

This guide explains how to use variables in PromptOwlarrow-up-right to create dynamic, reusable prompts that adapt to different contexts and inputs.


Table of Contents


Understanding Variables

Variables allow you to insert dynamic content into your prompts at runtime.

Why Use Variables?

Benefit
Example

Reusability

Same prompt, different company names

Personalization

Include user-specific context

Data Integration

Pull in artifact content

Workflow Chaining

Pass output between blocks

Variable Types Overview

Type
Source
Example

System

Built-in, automatic

{memory}, {last_message}

Custom

User-defined

{company_name}, {product}

Artifact

Data Room content

{context} → artifact content

Block Output

Previous block

{output_analysis}

Question

User input

{user_goal}


Variable Syntax

Basic Format

Variables use curly braces: {variable_name}

Examples:

Naming Rules

Rule
Valid
Invalid

Alphanumeric

{user_name}

{user-name}

Underscores OK

{company_info}

{company info}

No spaces

{productDetails}

{product details}

Case sensitive

{Name}{name}

-

Where Variables Work

Location
Variables Supported

System context

Yes

Block instructions

Yes

Human messages

Yes

Variation text

Yes


System Variables

PromptOwl provides three built-in system variables automatically available at runtime.

{memory}

Contains user memories if memory is enabled.

What It Contains:

  • All user memories as formatted text

  • Categorized by type (Preferences, Personal, etc.)

  • Injected automatically when memory is enabled

Example Usage:

{last_message}

Contains the most recent message in the conversation.

What It Contains:

  • Content of the last user or assistant message

  • Useful for follow-up processing

Example Usage:

{chat_history}

Contains the full conversation history.

What It Contains:

  • All messages formatted with roles

  • User and assistant messages included

  • Chronological order

Example Usage:

System Variable Availability

Variable
Simple Prompt
Sequential
Supervisor

{memory}

Yes

Yes

Yes

{last_message}

Yes

Yes

Yes

{chat_history}

Yes

Yes

Yes


Custom Variables

Define your own variables for dynamic content.

Creating Custom Variables

  1. Open prompt for editing

  2. Find the Variables section

  3. Click Add Variable

  4. Enter variable name and value

  5. Use {variable_name} in your prompt

Screenshot: Variable Manager

Variable Manager Interface

Element
Description

Variable name

The key used in {name} syntax

Variable value

Content to be inserted

Import button

Import from artifacts/folders

Clear button

Remove the value

Example: Company Context

Variables:

Prompt:

Resolved:

Static vs Dynamic Variables

Type
When Resolved
Use Case

Static (text)

At prompt save

Fixed values

Dynamic (artifact)

At runtime

Changing content


Artifact and Folder Variables

Import content from your Data Room into prompts.

Importing an Artifact

  1. In Variables section, click Import

  2. Select Artifact tab

  3. Choose the artifact to import

  4. Assign a variable name

  5. Artifact content becomes the variable value

Screenshot: Import Artifact

Importing a Folder

For RAG (retrieval) rather than direct injection:

  1. In Variables section, click Import

  2. Select Folder tab

  3. Choose the folder

  4. Folder becomes available for AI retrieval

How Artifact Variables Work

Storage Format:

At Runtime:

  1. System detects artifact- prefix

  2. Fetches artifact content from database

  3. Replaces variable with actual content

  4. Content escaped to prevent injection

Artifact vs Folder Import

Import Type
Behavior
Best For

Artifact

Entire content injected

Small, specific documents

Folder

AI searches and retrieves

Large knowledge bases

Content Escaping

Artifact content is automatically escaped:

  • { becomes {{

  • } becomes }}

This prevents accidental variable injection from artifact content.


Block Output Variables

Pass outputs between blocks in sequential prompts.

How It Works

In a sequential prompt:

  1. Block 1 generates output

  2. Output stored as {output_block1id}

  3. Block 2 can reference this output

  4. Chain continues for all blocks

Automatic Block Output Names

Block
Output Variable

Block 1

{output_abc123}

Block 2

{output_def456}

Block 3

{output_ghi789}

The block ID becomes part of the variable name.

Using Block Outputs

In Human Message field:

In Block Instructions:

Default Behavior

If you don't specify a human message for a block:

  • System automatically uses previous block's output

  • Format: {output_previousBlockId}

Example: Multi-Stage Analysis

Block 1 (Research):

Output stored as: {output_research}

Block 2 (Analysis):

Output stored as: {output_analysis}

Block 3 (Recommendations):


Question-Based Variables

Collect user input through questions to populate variables.

How Questions Work

  1. Define questions in prompt settings

  2. Questions shown to user at chat start

  3. Answers stored as variables

  4. Variables used in prompt

Creating Questions

  1. Open prompt settings

  2. Find Questions section

  3. Add question text

  4. Assign variable name

  5. Set visibility and requirements

Screenshot: Question Configuration

Question Properties

Property
Description

Text

The question shown to user

Variable

Variable name for the answer

Visible

Whether to show the question

Required

Must be answered to proceed

Run Frequency

Once or every time

Run Frequency Options

Option
Behavior

Once

Ask first time, cache answer

Every Time

Ask at each conversation start

Example: Personalized Assistant

Questions:

  1. "What is your name?" → {user_name}

  2. "What is your role?" → {user_role}

  3. "What are you working on?" → {current_project}

Prompt:


Memory Variables

Long-term context that persists across conversations.

How Memory Works

  1. User creates memories (persistent context)

  2. Memories categorized by type

  3. When memory enabled on prompt, {memory} variable populated

  4. AI uses memory context in responses

Memory Categories

Category
Example Content

Preferences

"I prefer concise answers"

Personal

"My name is Sarah"

Professional

"I work at Acme Corp"

Technical

"I use Python 3.11"

Schedule

"I'm in EST timezone"

Prompt Specific

Context for specific prompt

Enabling Memory

  1. Open prompt settings

  2. Find Memory toggle

  3. Enable memory

  4. {memory} now available in prompt

Using Memory in Prompts

Implicit Use: When memory is enabled, it's automatically included in context.

Explicit Reference:

Memory vs Question Variables

Feature
Memory
Questions

Persistence

Permanent

Per-session (if "once")

User control

User manages

Defined by prompt

Scope

All prompts (if enabled)

Single prompt


Variable Resolution

Understanding how variables are processed at runtime.

Resolution Order

  1. Custom variables defined on prompt

  2. Artifact/folder content fetched and inserted

  3. Question answers from user input

  4. System variables (memory, last_message, chat_history)

  5. Block outputs from previous blocks

Resolution Process

Handling Missing Variables

Scenario
Behavior

Variable undefined

Replaced with empty string

Artifact not found

Empty string, error logged

Block output missing

Empty string, warning logged

Type Conversion

Value Type
Conversion

String

Used directly

Number

Converted to string

Boolean

Converted to string

Object/Array

JSON stringified

null/undefined

Empty string


Best Practices

Variable Naming

Do:

  • Use descriptive names: {company_overview}

  • Use underscores for readability: {user_profile_summary}

  • Be consistent across prompts

Don't:

  • Use single letters: {c}

  • Use reserved names: {system}, {prompt}

  • Mix naming conventions

Variable Organization

Group Related Variables:

Artifact Variables

Do:

  • Use for stable reference content

  • Keep artifact content focused

  • Update artifacts when info changes

Don't:

  • Import very large artifacts inline

  • Use for frequently changing data

  • Forget about sync status

Sequential Workflow Variables

Do:

  • Name blocks descriptively (helps identify outputs)

  • Document expected outputs

  • Handle missing outputs gracefully

Don't:

  • Create circular references

  • Skip documenting block purposes

  • Assume outputs will always exist

Security Considerations

Do:

  • Sanitize user input in questions

  • Be careful with artifact content

  • Test variable injection scenarios

Don't:

  • Put sensitive data in variables

  • Trust unvalidated user input

  • Expose internal variable names


Troubleshooting

Variable Not Resolving

Symptoms: {variable_name} appears in output

Solutions:

  1. Check variable name spelling (case sensitive)

  2. Verify variable is defined

  3. Check variable has a value

  4. Confirm using correct syntax {name} not {{name}}

Artifact Content Empty

Symptoms: Variable resolves to nothing

Solutions:

  1. Check artifact exists in Data Room

  2. Verify artifact has content

  3. Check artifact is synced

  4. Confirm artifact ID is correct

Block Output Missing

Symptoms: Sequential block gets empty input

Solutions:

  1. Verify previous block executed

  2. Check block ID in variable name

  3. Review previous block for errors

  4. Check human message references correct block

Memory Not Appearing

Symptoms: {memory} is empty

Solutions:

  1. Verify memory is enabled on prompt

  2. Check user has created memories

  3. Confirm memories aren't empty

  4. Test with explicit memory content

Question Answers Not Saved

Symptoms: Must re-answer questions

Solutions:

  1. Check run frequency setting

  2. Verify answer was submitted

  3. Check for validation errors

  4. Try clearing and re-answering

Unexpected Characters in Output

Symptoms: Extra {{ or }} in text

Solutions:

  1. This is intentional escaping

  2. Artifact content with braces gets escaped

  3. Review source content if problematic

  4. Consider alternative formatting

Variable Shows "undefined"

Symptoms: Literal "undefined" in output

Solutions:

  1. Variable value is JavaScript undefined

  2. Set explicit empty string instead

  3. Check variable initialization

  4. Review data source


Quick Reference

Variable Types Summary

Type
Syntax
Source

System

{memory}

Built-in

Custom

{company}

User-defined

Artifact

{context}

Data Room

Block Output

{output_id}

Previous block

Question

{answer}

User input

System Variables

Variable
Content

{memory}

User memories

{last_message}

Most recent message

{chat_history}

Full conversation

Common Patterns

Personalization:

Context Injection:

Sequential Chaining:

Variable Checklist


Last updated