Skip to main content

Variables And Templates

The DSL uses expressions for logic and templates for user-facing messages. Expressions are evaluated by the platform, not the LLM.

Expression Variables

$user (Context)

User context injected at conversation start. Read only.

- if: "$user.entitlements.tier == 'premium'"

$variables (Conversation Data)

All collected datapoints, action results, and set values live here.

- action: orders.get-details -> order
- if: "$variables.order.status == 'shipped'"

Aliases

For backward compatibility:

  • $context is an alias for $user
  • $data is an alias for $variables
  • $fields may be supported in some evaluators but is not the canonical form

Template Variables

Use templates in messages and prompts:

  • {{variables.order.id}}
  • {{user.identity.user_name}}
  • {{context.user.entitlements.tier}} (alias)

Example Context Payload

{
"version": "v1",
"context": {
"identity": {
"user_id": "u_123",
"user_name": "John Smith",
"user_email": "john@example.com"
},
"preferences": {
"language": "en",
"timezone": "America/Los_Angeles"
},
"entitlements": {
"tier": "premium"
},
"customAttributes": {
"account_id": "acct_789"
}
}
}

Expression Syntax

Comparison

- if: "$variables.total > 100"
- if: "$user.entitlements.tier == 'premium'"

Logical

- if: "$variables.verified && $variables.total > 0"

Arithmetic

- set:
total_with_tax: "$variables.subtotal * 1.08"

Ternary

- set:
discount: "$user.entitlements.tier == 'premium' ? 0.2 : 0.1"

Where Expressions Are Used

  • if conditions
  • set values
  • action.inputs
  • choice and confirm logic