Variable Syntax
All variables in the Syllable platform use the double curly brace syntax:{{ x }} and {{x}} are equivalent.
This standardized format ensures consistency across all platform components and makes variables easily identifiable in your content.
Variable Types
System Variables
System variables provide access to platform-managed data and session context:{{ vars.session.id }}- Unique identifier for the current session{{ vars.session.agent.name }}- Name of the current agent{{ vars.session.datetime }}- Current timestamp, e.g.2025-01-02 12:00{{ vars.session.date }}- Current date, e.g.2025-01-02{{ vars.session.language }}- The current language code for the session, e.g.en-US
Custom Variables
Custom variables allow you to define your own dynamic content:{{ vars.custom_field }}- User-defined variables stored in the vars namespace
Usage Examples
In Prompts
Variables can be used within prompt content to create dynamic, personalized instructions:In Greeting Messages
Create dynamic greeting messages that adapt to different contexts:In Tool Descriptions
Make tool descriptions more contextual and informative:In Tool Static Parameters
Use variables to set dynamic default values for tool parameters:Best Practices
Variable Naming
- Use descriptive, lowercase names with underscores for readability
- Prefix custom variables with
vars.for clarity - Avoid spaces and special characters in variable names
{{ vars.customer_name }}{{ order_number }}
{{ Customer Name }}(spaces){{ vars.customer-name }}(hyphens){{ CUSTOMER_ID }}(all caps)
Error Handling
Variables that cannot be resolved will typically:- Be replaced with blank values (e.g.,
Welcome, {{ unknown_var }}!becomesWelcome, !) - Not break the overall functionality
Security Considerations
- Never expose sensitive information through variables
- Validate custom variable values before use
- Be cautious when using variables in tool parameters that make external API calls
Common Use Cases
- Multi-language Support
- Time-based Messaging
- Personalization
Dynamic Tool Configuration
Troubleshooting
Variable Not Resolving
If a variable is not replaced or replaced with a blank string instead of its expected value:- Check spelling - Variable names are case-sensitive
- Verify scope - Ensure the variable is available in the current context, for example a prompt can only reference variables that are available at the start of the session
- Check syntax - Confirm you’re using double curly braces
{{ }} - Validate data source - For custom variables, ensure the data source is properly configured
Migration from Legacy Formats
If you’re updating from older variable substitution formats, here are the conversions:| Legacy Format | New Format |
|---|---|
{variable} | {{ variable }} |
${variable} | {{ variable }} |
{{ variable }} syntax works exactly the same as the ${variable} syntax: if we the variable doesn’t exist, it defaults to an empty string. The {variable} syntax has slightly different behavior: if the variable doesn’t exist, the {variable} placeholder remains in the text as-is.

