Template Syntax
Prompt templates use{{variable}} syntax to inject context data.
Variable Rules
Case Sensitivity
Variable names are case-sensitive:{{userName}}≠{{username}}≠{{UserName}}
Missing Variables
If a variable isn’t provided in context:- The placeholder remains as-is:
{{missing_var}} - Consider providing defaults or handling in your template
Special Characters
Context values are included as-is. Escape special characters if needed:- User input might contain quotes, HTML, etc.
- Consider sanitizing sensitive data before passing
Template Examples
E-commerce
SaaS Onboarding
Error Recovery
Building Natural Messages
For events without custom templates, the system builds a natural message from context: Context:User Data in Templates
Pass user information via theuser option:
Tips for Effective Templates
Be specific about the situation
Be specific about the situation
Don’t just say “user needs help” — describe the exact scenario:
- What were they trying to do?
- What went wrong or where did they get stuck?
- What’s their current state?
Include actionable instructions
Include actionable instructions
Tell your agent how to help:
- What solutions to offer
- What tone to use
- What to avoid saying
- When to escalate
Provide context for better responses
Provide context for better responses
More context = better help:
- User’s history with your product
- Common issues at this point
- Relevant policies or limitations
Keep it scannable
Keep it scannable
Use formatting to make templates easy to read:
- Headers and sections
- Bullet points for lists
- Clear labels for data