Path
Manage Agent → Customize tab → Dynamic VariablesWhat Dynamic Variables Do
Dynamic Variables allow your AI agent to personalize its Initial Message and **System Prompt **using runtime data fetched from an external API. They replace placeholder text like:- Rahul
- premium
- pending
Why Use Dynamic Variables?
- Personalizes the agent’s tone, message, and instructions
- Ensures responses are relevant to the current user context
- Allows the same agent to adapt dynamically for different users and use cases
- Integrates with your backend systems for context-aware conversations
Where They’re Used
Dynamic Variables can be embedded in:- Initial Message – The very first thing the agent says
- System Prompt – The underlying instruction set that guides the LLM
Placeholder Syntax
- Always wrap variable names in double curly brackets
- Use lowercase with underscores for clarity
How It Works
- Agent Invoked User starts a chat or API-triggered interaction.
-
Variables Detected
The system scans templates for
{{variable_name}}placeholders. - API Call Made If variables exist, the agent calls your configured Dynamic Message API.
- Values Returned API responds with a JSON object, e.g.:
- Template Compiled
- LLM Receives Context
Example
System Prompt Template:Best Practices
Related feature: Prompt validation
Your system prompt is treated as a Jinja2 template. That supports conditionals and loops, but requires validation before you save or test an agent.What validation checks
- Syntax correctness for variables,
ifblocks, andforloops - Undeclared variables referenced in the prompt
- Proper block closures (every opening tag has a matching closing tag)
Invalid syntax behavior
If syntax errors are found:- Save and Test are disabled
- A clear error message is shown
Validation rules
Agent behavior
- Existing agents keep working until the system prompt is edited and saved again.
- New and updated agents must follow Jinja formatting rules.