Manage conversation context with compaction in the OCI Responses API
- Services: Generative AI
- Release Date: October 27, 2026
The OCI Responses API now supports explicit and automatic context compaction for long-running conversations and agent workflows. Compaction reduces accumulated conversation history to a smaller representation that you can use in later requests.
Call POST /responses/compact to control when an application compacts history, or enable automatic compaction on POST /responses with context_management and a token threshold. Both modes are supported by all models available through the OCI Responses API, including supported imported models. Compaction is available in Enterprise AI regions for on-demand inference and dedicated hosting, according to each model's availability, and requires an OCI Generative AI project OCID.
A new tutorial shows how to set up the OpenAI Python SDK with OCI credentials, run both compaction modes, continue a conversation with the returned context, and use either mode with a dedicated AI cluster endpoint. Follow the examples to check retained context and troubleshoot common issues.
To get started, see the OCI Responses API Compaction Tutorial. For behavior and limits, see Manage Context with Compaction.