You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: developer/agents/chat-metadata.md
+57-59Lines changed: 57 additions & 59 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ Pass arbitrary context alongside chat messages to any AI Mentor so it can tailor
6
6
7
7
## Overview
8
8
9
-
The chat metadata feature lets you pass arbitrary context alongside chat messages to any IBL Mentor. This context (e.g., product group, licensing level, state) is automatically injected into the mentor's awareness, allowing it to tailor responses to the user's exact situation without the user having to explain their context manually.
9
+
The chat metadata feature lets you pass arbitrary context alongside chat messages to any IBL Mentor. This context (e.g., product name, plan tier, user role) is automatically injected into the mentor's awareness, allowing it to tailor responses to the user's exact situation without the user having to explain their context manually.
10
10
11
11
**Key points:**
12
12
- The `metadata` field is a **free-form JSON object** — any key-value pairs are accepted, no enforced schema
@@ -21,7 +21,7 @@ The chat metadata feature lets you pass arbitrary context alongside chat message
Mentor (LLM) receives the user's message with context appended:
34
34
35
-
"What are the licensing requirements?"
35
+
"How do I set up SSO?"
36
36
37
37
<CONTEXT METADATA> Here is additional context metadata for this conversation:
38
-
productGroup: LICENSING
39
-
productLevel: LH
40
-
stateCode: CA
38
+
product: Analytics
39
+
planTier: Enterprise
40
+
userRole: Admin
41
+
region: EU
41
42
</END CONTEXT METADATA>
42
43
```
43
44
44
-
The mentor sees this context and responds accordingly — e.g., answering about Health insurance licensing in California rather than generic insurance topics.
45
+
The mentor sees this context and responds accordingly — e.g., answering with Enterprise-tier SSO setup steps for the Analytics product with EU data-residency considerations, rather than generic help.
-**Send once** — metadata persists automatically for the rest of the session
@@ -133,16 +135,13 @@ Metadata is **cached per session** and only needs to be sent once. Here's how it
133
135
134
136
The metadata field accepts **any** JSON object. There is no enforced schema — use whatever keys make sense for your application.
135
137
136
-
**Example: Insurance education platform**
138
+
**Example: SaaS customer support**
137
139
```json
138
140
{
139
-
"productGroup": "LICENSING",
140
-
"productLevel": "LH",
141
-
"productLevelDisplay": "Life & Health",
142
-
"productFamily": "INSURANCE",
143
-
"productFamilyDisplay": null,
144
-
"stateCode": "CA",
145
-
"name": "Health"
141
+
"product": "Analytics",
142
+
"planTier": "Enterprise",
143
+
"userRole": "Admin",
144
+
"region": "EU"
146
145
}
147
146
```
148
147
@@ -156,13 +155,13 @@ The metadata field accepts **any** JSON object. There is no enforced schema —
156
155
}
157
156
```
158
157
159
-
**Example: K-12 education**
158
+
**Example: E-commerce product advisor**
160
159
```json
161
160
{
162
-
"gradeLevel": 10,
163
-
"subject": "Biology",
164
-
"unit": "Cell Division",
165
-
"standard": "NGSS HS-LS1-4"
161
+
"category": "Laptops",
162
+
"brand": "ThinkPad",
163
+
"priceRange": "1000-2000",
164
+
"customerSegment": "Business"
166
165
}
167
166
```
168
167
@@ -174,10 +173,10 @@ The metadata is appended to the user's prompt as context. The mentor's **system
174
173
175
174
**Example system prompt excerpt:**
176
175
```
177
-
You are a licensing exam preparation assistant. When the user's context
178
-
includes a stateCode, always tailor your answers to that state's specific
179
-
licensing requirements. When productLevel is provided, focus your answers
180
-
on that specific license type.
176
+
You are a product support assistant. When the user's context includes a
177
+
product name, tailor your answers to that specific product's features and
178
+
documentation. When planTier is provided, only suggest features available
179
+
on that plan. When region is EU, highlight GDPR and data-residency details.
181
180
```
182
181
183
182
---
@@ -197,9 +196,10 @@ Response:
197
196
{
198
197
"summary": {
199
198
"client_context": {
200
-
"productGroup": "LICENSING",
201
-
"stateCode": "CA",
202
-
"productLevel": "LH"
199
+
"product": "Analytics",
200
+
"planTier": "Enterprise",
201
+
"userRole": "Admin",
202
+
"region": "EU"
203
203
}
204
204
}
205
205
}
@@ -233,43 +233,41 @@ The full `Session.metadata` object is included, which contains the `client_conte
233
233
234
234
## Example: Single Mentor Serving Multiple Contexts
235
235
236
-
**Scenario:** One mentor handles all insurance licensing questions, but users are on different product/state pages.
236
+
**Scenario:** One support mentor handles questions across your entire SaaS platform, but users are on different product pages with different plans.
237
237
238
-
**Page: Health Insurance Licensing in California**
238
+
**Page: Analytics product — Enterprise plan**
239
239
240
240
The frontend sends:
241
241
```json
242
242
{
243
243
"metadata": {
244
-
"productGroup": "LICENSING",
245
-
"productLevel": "LH",
246
-
"productLevelDisplay": "Life & Health",
247
-
"stateCode": "CA",
248
-
"name": "Health"
244
+
"product": "Analytics",
245
+
"planTier": "Enterprise",
246
+
"userRole": "Admin",
247
+
"region": "EU"
249
248
}
250
249
}
251
250
```
252
251
253
-
**User asks:** "What topics are on the exam?"
252
+
**User asks:** "How do I set up SSO?"
254
253
255
-
**Mentor responds** with California-specific Life & Health exam topics — not generic insurance information.
254
+
**Mentor responds** with Enterprise-tier SSO setup steps for the Analytics product, noting EU data-residency requirements — not generic help docs.
256
255
257
-
**Page: Property & Casualty in New York**
256
+
**Page: Payments product — Starter plan**
258
257
259
258
The frontend sends:
260
259
```json
261
260
{
262
261
"metadata": {
263
-
"productGroup": "LICENSING",
264
-
"productLevel": "PC",
265
-
"productLevelDisplay": "Property & Casualty",
266
-
"stateCode": "NY",
267
-
"name": "Property & Casualty"
262
+
"product": "Payments",
263
+
"planTier": "Starter",
264
+
"userRole": "Developer",
265
+
"region": "US"
268
266
}
269
267
}
270
268
```
271
269
272
-
**Same mentor** now responds with New York-specific P&C content.
270
+
**Same mentor** now responds with Starter-plan Payments integration guides, and notes that SSO requires upgrading to the Pro plan.
273
271
274
272
If the mentor's responses don't align with the expected behavior, adjust the **system prompt** to instruct the mentor on how to use the metadata fields.
0 commit comments