Compact a conversation
POST/api/v1/llm/compact-conversation
Triggers context compaction, summarizing older conversation messages. The trigger estimate can differ from the next request's actual size, especially after changing prompts or tools. Leave room below the model limit and handle context-limit errors.
When configured for asynchronous compaction, this call returns a pending result
immediately. Use the returned compactionId to inspect the completed record in
conversation-state's compactions array. Compaction can still delay other messages
in the conversation; asynchronous acceptance does not guarantee uninterrupted
concurrent messaging.
See Context and compaction for strategy selection and outcome handling.
Request
Responses
- 200
Compaction completed
Document ID: DOC-MA-conversations-api-compactConversation. Section identities and revisions.
| Section | Stable reference |
|---|---|
| Overview | DOC-MA-conversations-api-compactConversation#overview |
| Request | DOC-MA-conversations-api-compactConversation#request |
| Responses | DOC-MA-conversations-api-compactConversation#responses |