Skip to main content

Context And Identity

Context is structured data you pass to the agent about the user and their account. It is an input to the decision engine and helps the agent personalize responses and skip unnecessary questions.

Core Structure

Context is sent in the Converse API payload:

{
"version": "v1",
"context": {
"identity": {
"user_id": "u_123",
"user_name": "Jane Lee",
"user_email": "jane@example.com"
},
"preferences": {
"preferred_channel": "email",
"language": "en",
"timezone": "America/Los_Angeles"
},
"entitlements": {
"tier": "premium",
"features": ["priority_support"],
"limits": {"refunds_per_month": 5}
},
"customAttributes": {
"plan_tier": "enterprise",
"account_id": "acct_789",
"device_id": "dev_456"
}
}
}

Identity Is Required

The platform expects a user identifier. Provide it as:

  • context.identity.user_id (recommended), or
  • the user-id request header (fallback)

How Context Is Used

  • Routing: capabilities can require specific context fields
  • Personalization: use context in responses and logic
  • Skipping questions: if the value already exists, do not collect it again

Accessing Context In The DSL

Use these in expressions:

  • $user.identity.user_id
  • $user.entitlements.tier
  • $user.customAttributes.account_id

Use these in message templates:

  • {{user.identity.user_name}}
  • {{context.user.entitlements.tier}}

Best Practices

  1. Send only what the agent needs
  2. Keep identity stable across conversations
  3. Store domain specific data under customAttributes
  4. Avoid sensitive data like passwords or full payment details