Skip to content

AGUI_CONTEXT_COMPACTED_EVENT

const AGUI_CONTEXT_COMPACTED_EVENT: "context_compacted" = 'context_compacted'

Defined in: _worktrees/docs-release/gaunt-sloth/packages/agent/src/modules/apiAgUiModule.ts:354

[[EXT-174]] — the name of the AG-UI CUSTOM event that tells the client the session folded the older conversation into a summary mid-turn, because the provider rejected the turn for size, and is asking the model again. Its value is an AgUiContextCompactedValue.

At most one per run. Everything the client has rendered for the run stands: the retry continues the same thread from its state, so the tool calls announced before this event ran and their results are what the model continues from. What follows is the same turn with less history behind it, as a new text message. A client that does not handle the name renders a correct turn with the fold unannounced — the degradation the event exists to prevent, and the reason it is CUSTOM rather than a text message a client would show as the assistant’s words and replay to the model.