Voxta docs

Templates

Scriban templating syntax — variables, conditions, and functions you can use in character and scenario fields.

Most dynamic fields in Voxta — character descriptions, scenario text, prompts, bootstrap messages — accept Scriban templates. Scriban is a fast, sandboxed templating language that supports variable interpolation, conditionals, loops, and function calls.

For the full language reference, see the official Scriban docs. This page documents the Voxta-specific variables and functions you can use in templates.

A worked example

{{ user }} and {{ char }} finally arrive to the designated location.
{{~ if has_flag "night" ~}}
It was dark, they had no idea where the box was.
{{~ else ~}}
It was day, they could clearly see the box.
{{~ end ~}}

If the chat has the night flag set, that template renders one way; if not, the other.

Not all fields support every variable. Character fields can use character variables but not scenario-level ones. Scenario fields see everything. When in doubt, try it — Voxta will tell you in the prompt preview if a variable resolved to nothing.

Available variables

About the user

VariableTypeDescription
usertextThe user's name.
user_descriptiontextThe user's profile description.

About the main character

VariableTypeDescription
chartextThe main character's name.
char_descriptiontextThe main character's appearance.
char_personalitytextThe main character's personality.
char_profiletextThe main character's full profile.
characterCharacterThe main character object. Has id, name, tags, description, personality, profile.

About all characters

VariableTypeDescription
charsstring[]All character names.
charactersCharacter[]All character objects.
other_charsstring[]All character names except the main one.
other_charactersCharacter[]All character objects except the main one.

About the scenario

VariableTypeDescription
scenariostringThe scenario's text.
scenario_chars{ [role: string]: string }Character names indexed by role: scenario_chars.main.
scenario_characters{ [role: string]: Character }Character objects by role: scenario_characters.main.id.
chat_flowstringStory or Chat.
chat_stylestringCompanion, Storytelling, Roleplay, Assistant.
explicitbooleanTrue if the scenario or any character is marked explicit.
nowtextCurrent date/time formatted for the character's culture. Only set if the character is time-aware and the scenario isn't roleplay.

Context and history

VariableTypeDescription
contextstring[]All resolved contexts for this turn.
last_function_callActionInvocationThe last action invoked. Has name, signature, short, timestamp (relative).

Scripting

VariableTypeDescription
variables.variable_nameanyA chat variable set from a script.

Functions

FunctionReturnsDescription
has_flag "flag_name"booleanWhether the chat has that flag.
char_has_tag "tag_name"booleanWhether the main character has that tag.

Common patterns

Conditional description

{{ char }} is a tall woman in her late twenties.
{{~ if has_flag "is_drenched" ~}}
She is completely soaked from the rain.
{{~ end ~}}

Tag-based branching

{{~ if char_has_tag "detective" ~}}
{{ char }} carries a worn notebook and a magnifying glass.
{{~ end ~}}

Multi-character introduction

Tonight, {{ char }} is meeting {{ scenario_chars.guest }} for the first time.

Time-aware greeting

{{~ if now ~}}
It is {{ now }}.
{{~ end ~}}

Scriban whitespace

Note the ~ symbols ({{~ ... ~}}) — those trim whitespace around the directive so conditional blocks don't leave blank lines in the rendered output. Worth using for almost every if / else / end.

What's next

On this page