summarizeHistory
Purpose and behavior
Section titled “Purpose and behavior”Create a context strategy that, once the serialized history exceeds triggerCharacters, replaces the older messages with a model-written summary and keeps the first prompt and the recent messages. Each summary is one extra model request counted in usage and budgets; an empty or cut-off summary fails the turn with code response.
Complete example and detailed rules.
Parameters and properties
Section titled “Parameters and properties”optionsOptionalSummarizeHistoryOptions | undefinedHistory size that triggers a summary and number of recent messages kept.options.triggerCharactersOptionalnumber | undefinedLength of the JSON-serialized history above which a summary is made, default 400000 characters.options.keepRecentMessagesOptionalnumber | undefinedMinimum number of recent messages kept after the summary, default 6; the cut moves back to the previous assistant message.