Skip to main content

How Variables Work

Variables let you personalize your agent’s prompt with dynamic data. itellicoAI uses Jinja2 for templating — see the official docs for the full language reference.

Variable Sources

Built-in Contact Variables

If a contact exists in your itellicoAI account, these 5 fields are automatically available:
Example:
✅ No setup needed - works automatically if contact exists

Everything Else: Dynamic Context API

All other data must come from your Dynamic Context connection (set up by your development team) as variables you can use directly. See Dynamic Context API. You can return any fields you want. For example:
Example - Your API returns:
Then your agent can use:
⚙️ Requires setup - see Dynamic Context API

Available Variables

Built-in Contact Variables

These variables are automatically available from your itellicoAI contacts:
Example usage:
Custom fields are NOT nested under contact. — they’re variables you can use directly like {{ language }} or {{ account_tier }}. You must provide these through your Dynamic Context connection (set up by your development team). See Dynamic Context API.

Dynamic Context Variables

Any custom data you provide through your Dynamic Context connection (set up by your development team) becomes available as variables you can use directly:
Example with custom variables:
Set up a Dynamic Context connection (requires developer setup) to provide custom variables. Any JSON fields you return become variables you can use directly (e.g., {"language": "de"}{{ language }}).

Date & Time

The current datetime is automatically available as current_datetime in both greetings and prompts:
Example usage:
Use current_datetime to build advanced time-based logic like business hours routing, time-of-day greetings, or scheduling constraints without needing external data sources.
Use the datetime filter for formatting. Direct date formatting methods are not available. Use the datetime filter shown above instead.

Conditional Logic

If Statement

If-Else

If-Elif-Else

Real-World Example


Filters

Filters transform variable values.

Common Filters

default: Provide fallback value
upper: Convert to uppercase
lower: Convert to lowercase
title: Title case
length: Get length
datetime: Format datetime objects

Chaining Filters


Loops

Iterate over lists (advanced use case):

Practical Examples

Example 1: Personalized Greeting

Example 2: Custom Business Logic (Requires Dynamic Context API)

Variables like company_name and account_tier must be provided by your Dynamic Context connection (set up by your development team). See Dynamic Context API.

Example 3: Time-Based Prompt Logic

Example 4: Multi-Language Support (Requires Dynamic Context API)

Example 5: Account Tier Logic


Testing Variables

Test with Different Data

  1. Open the agent’s Test Agent menu and choose Chat, Web call, or Phone call
  2. Test scenarios with different contact data:
    • With first name vs without
    • VIP vs standard customer
    • Different languages
    • Different timezone

Common Issues


Best Practices

Never assume a variable has a value. Always provide defaults.Bad:
Good:
Complex nested conditions are hard to debug. Keep it simple.Too complex:
Simpler:
Test with:
  • Missing data (all fields empty)
  • Unexpected values
  • Very long strings
  • Special characters

Next Steps

Prompt Engineering Guide

See variables in action with complete examples

Test Your Agent

Test your variables work correctly