Inspect conversation context
See the conversation history the avatar actually receives, and how much the summary saves.
In long conversations, the avatar does not reread every message. Tolky keeps a summary of the older part and sends it together with the most recent exchanges. This keeps answers fast and costs low without losing what was said earlier.
This call shows that context for one conversation: the messages and summary the avatar would receive, how many exchanges were kept, and how many characters and tokens the summary saved.
When to use it
- To check that the avatar still "remembers" something said early in a long conversation.
- To compare the full history with the optimized one while you tune your avatar.
- To measure the savings of the summary in your own monitoring.
ReferenceTechnical details
POST /api/externalAPIs/public/smartContext/inspect
Authentication: host token (required). The account always comes from the token; the conversation must belong to it.
| Parameter | Type | Required | Description |
|---|---|---|---|
conversationId | string (UUID) | Yes | Conversation to inspect. |
avatarId | string (UUID) | No | Uses the context settings of this avatar. |
boxes | integer or null | No | How many recent customer and avatar exchanges to return. null returns all. |
format | string | No | array (default), json-string or toon (a compact text format). |
includeSummary | boolean | No | Default true. With false, returns the recent exchanges without the summary. |
forceFullDialogue | boolean | No | Default false. With true, returns the whole history, with no cut and no summary. |
waitForSummary | boolean | No | Default true. With false, the call never waits for a new summary: it returns the last one available plus the recent history, and the summary is refreshed in the background. |
curl -X POST "https://api.tolky.to/api/externalAPIs/public/smartContext/inspect" \
-H "Authorization: Bearer $TOLKY_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "conversationId": "3f0c2a8e-...", "boxes": 5 }'{
"code": 200,
"message": "OK",
"data": {
"data": ["..."],
"boxCount": 5,
"totalBoxes": 23,
"summaryInjected": true,
"summaryPending": false,
"pinnedMessageCount": 0,
"source": "database",
"cacheHit": false,
"savings": {
"originalCharCount": 18200,
"returnedCharCount": 4100,
"savedCharCount": 14100,
"savedPercent": 77.5,
"estimatedOriginalTokens": 4550,
"estimatedReturnedTokens": 1025,
"estimatedSavedTokens": 3525
},
"error": null
}
}| Field | Description |
|---|---|
data | The context, as an array or a string depending on format. |
boxCount, totalBoxes | Exchanges returned and exchanges in the whole conversation. |
summaryInjected | true when a summary was included. |
summaryPending | true when the summary returned is out of date and a refresh was queued. |
pinnedMessageCount | Messages always kept in the context. |
source | Where the history came from: globalData, cache, database or rawDialogue. |
cacheHit | true when the result came from the cache. |
savings | Characters and estimated tokens before and after optimization. |
error | Error text, or null. |
| Status | When |
|---|---|
400 | conversationId is missing or format is invalid. |
401 | The token is invalid or does not belong to an account. |
403 | No token was sent. |
404 | The conversation does not exist in your account. |
500 | Internal error. |