Letta · Schema
CompactionStats
Statistics about a memory compaction operation.
AIAgentsStateful AgentsMemoryMemGPTContinual LearningMCPMulti-AgentRAGOpen Source
Properties
| Name | Type | Description |
|---|---|---|
| trigger | string | What triggered the compaction (e.g., 'context_window_exceeded', 'post_step_context_check') |
| context_tokens_before | object | Token count before compaction (from LLM usage stats, includes full context sent to LLM) |
| context_tokens_after | object | Token count after compaction (message tokens only, does not include tool definitions) |
| context_window | integer | The model's context window size |
| messages_count_before | integer | Number of messages before compaction |
| messages_count_after | integer | Number of messages after compaction |
JSON Schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "#/components/schemas/CompactionStats",
"title": "CompactionStats",
"properties": {
"trigger": {
"type": "string",
"title": "Trigger",
"description": "What triggered the compaction (e.g., 'context_window_exceeded', 'post_step_context_check')"
},
"context_tokens_before": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Context Tokens Before",
"description": "Token count before compaction (from LLM usage stats, includes full context sent to LLM)"
},
"context_tokens_after": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"title": "Context Tokens After",
"description": "Token count after compaction (message tokens only, does not include tool definitions)"
},
"context_window": {
"type": "integer",
"title": "Context Window",
"description": "The model's context window size"
},
"messages_count_before": {
"type": "integer",
"title": "Messages Count Before",
"description": "Number of messages before compaction"
},
"messages_count_after": {
"type": "integer",
"title": "Messages Count After",
"description": "Number of messages after compaction"
}
},
"type": "object",
"required": [
"trigger",
"context_window",
"messages_count_before",
"messages_count_after"
],
"description": "Statistics about a memory compaction operation."
}