Skip to main content

What a context entry is

A context entry is a labeled, typed piece of structured data formatted into the AI agent’s system prompt. Unlike traits (simple key-value), context entries can hold complex structures: arrays of objects, nested objects, or any JSON value.

Context types

The type field tells the AI formatter how to render the data and gives the AI semantic understanding of what it represents.

list

Arrays of items — events, products, features, or any collection.
AI sees:
The formatter intelligently picks label/name/title as the primary descriptor and shows status separately.

integration

External service connections and their states. Errors are highlighted.
AI sees:

error

Active issues or errors the AI should acknowledge and help with.
AI sees:

status

General status indicators about the user or account.
AI sees:

config

Configuration or settings state.

feature

Feature flags or enabled capabilities.
AI sees:

metric

Numeric KPIs or measurements.
AI sees:

relationship

Entity relationships and cross-references.

custom

Use "custom" (or omit the type entirely) for anything that doesn’t fit the other categories. The formatter auto-detects the best rendering based on the value type.

No type? No problem

If you omit type, the formatter auto-detects from the value:
  • Array — rendered as a bulleted list
  • Object — rendered as key-value pairs
  • String/number/boolean — rendered as a simple value

Best practices

Labels appear as section headers in the AI prompt. Make them clear and specific:
  • Good: "Active Tracking Events", "Connected Integrations"
  • Bad: "Events", "Data", "Stuff"
For lists, include both the machine ID (event_name) and the human label (label). This lets the AI reference items naturally.
When a user asks for help and they have active errors, the AI references them automatically.
Prefer multiple focused entries over one giant blob. Each entry should represent one concept (events, integrations, errors, etc.).
Call setContext() whenever the user’s state changes — connecting an integration, encountering an error, changing a setting. The AI always sees the latest data.

Where to go next

Examples

Full real-world examples for common SaaS patterns.

Context Planning

A step-by-step guide to deciding what to send and how to keep it fresh.