Skip to main content
Use variables to inject dynamic content into your messages with {{placeholder}} syntax.

Basic Usage

The messages sent to the LLM will be:
  • System: “You are a helpful coding assistant.”
  • User: “Help me with writing a REST API.”

Variable Syntax

Variables use double curly braces: {{variableName}}
  • Variable names must contain only alphanumeric characters and underscores
  • Variables are case-sensitive
  • Undefined variables are left as-is (not replaced)

Multi-Message Interpolation

Variables are interpolated across all messages:

Common Patterns

Personalized Responses

Dynamic Prompts from Configuration

Locale-Based Content

Variables vs String Interpolation

You might wonder why use Tracia variables instead of JavaScript template literals. The key difference is traceability.

With Template Literals

Using Tracia variables allows you to:
  • Filter spans by variable values in the dashboard
  • Analyze prompt performance across different inputs
  • Group spans by the variables used

Escaping Curly Braces

If you need literal curly braces in your content, they won’t be interpolated if they don’t match the {{word}} pattern:
Single braces and braces with spaces inside are preserved as-is.