Variable Referencing
The Rounded Studio supports dynamic content insertion through variable references using {{variable_name}}
. This feature enables personalized, context-aware conversation flows by embedding variable values where needed.
Variable Reference Syntax
To reference any variable, wrap its name in double curly braces: {{variable_name}}
Variable Types and Formatting
Variables are automatically formatted according to their defined types, but when inserted into conversation text, all variables are ultimately rendered as strings:
STRING
Plain text
BOOLEAN
True/false (converted to a string like true
or false
)
NUMBER
Numeric value (rendered as a string)
DATETIME
Formatted as Monday, YYYY-MM-DD HH:MM:SS
(returned as a string)
JSON
Complex data structures (serialized to JSON, then inserted as a string)
Variable Scoping
Global Variables
Global variables are set in the call context and are accessible throughout the entire conversation flow. They can be initialized through:
API Calls
Variables initialized through API requests before the call starts
CSV Import
Variables loaded from CSV files for call campaigns
Global variables are perfect for static context that needs to be available throughout the entire conversation, such as:
- Customer identification (
customer_id
,account_number
) - Contact information (
phone_number
,email
) - Session data (
call_id
,timestamp
)
Task-Specific Variables
Task-specific variables are created within a specific task and may be derived from:
Extraction
Capturing user input during the task
API Response Mappings
Parsing JSON paths after an API call
Task-specific variables:
- Only become accessible after the task in which they are defined completes
- Cannot be referenced in the same task where they are first defined
- In a parent-child task structure, child tasks can inherit parent variables, but not vice versa
Usage Locations
Variables can be referenced in the following places:
Agent Context
- Initial message
- Base prompt
- State-specific prompts
Tools
- Tool descriptions
- Parameter descriptions
- Filler sentences
- Phone numbers
Transitions
- Task conditions
- Filler sentences
Important Transition Scoping Rules:
- Conditions can only reference variables that are available before or in the previous (origin) task
- Filler Sentences may include variables that were updated during the current (origin) task
- Variables must be carefully scoped to avoid undefined variable errors
Best Practices
Plan Variable Flow
Plan Variable Flow
Map out when and how each variable will be introduced and referenced. Always ensure variables are used only after they have been assigned or mapped.
Use Correct Types
Use Correct Types
Select the appropriate data type (STRING, BOOLEAN, NUMBER, DATETIME, or JSON) for each variable to ensure proper formatting and behavior.
Follow Scoping Rules
Follow Scoping Rules
Reference variables only after they become available in the conversation flow. Task-specific variables cannot be referenced in the same task where they are defined.
Check Names and Spelling
Check Names and Spelling
Use consistent, correctly spelled variable names to prevent referencing errors or missing data issues.
Secure Sensitive Data
Secure Sensitive Data
Avoid disclosing private or confidential information in prompts, logs, or transitions.
Validate JSON Paths
Validate JSON Paths
Verify correct JSON path syntax in API response mappings. Ensure any mapped variables are used only in subsequent tasks, after the API call completes.