Skip to content
Hands-on4 min readPublished 2026-11-30Reviewed 2027-11-30

Compaction now runs in the background by default: what "may increase token usage" actually costs ​

Applies to: the Agents API public beta (v1/agents, v1/agents/sessions). The change shipped on 2026-10-30; documentation checked 2026-11-30. The same official note gives one sentence and one default — "Context compaction now runs in the background by default. Set compaction.async to false for blocking compaction. Background compaction may increase token usage." The default is testable. The "may increase" is the part you have to cost out.

What the default actually changed ​

One sentence: compaction used to happen inside the turn; now it is handed to the background by default. Getting blocking behaviour back requires an explicit compaction.async: false.

Three direct consequences for anyone writing code against it:

  1. "Input has been compacted" is no longer guaranteed within the turn. What you read right after a response returns may not match what goes into the model on the next turn.
  2. Failure moves from "the request failed" to "compaction silently did not happen". A blocking compaction failure shows up in that turn; a background failure shows up as a session that never got smaller, until you hit the ceiling.
  3. The cost profile changed, and not in the cheaper direction. The note says "may increase token usage", not decrease. Background compaction runs a summarisation step, that step consumes tokens, and it happens outside your request.

That third point deserves its own paragraph. "Background" reads like "optimisation" to most people. On latency it is. On the bill it may not be.

Two compaction paths, do not mix them ​

There are in fact two compaction paths on the Responses API, released two months apart, with different semantics:

PathFirst shippedTriggerReturns
Client-side /responses/compact2025-12-11You call it when you decide toCompacted items you splice into the next turn
Server-side context_management2026-02-23Set compact_threshold; the server compacts when the count crosses itAn encrypted compaction item in the response stream

Server-side usage means passing context_management: [{ type: "compaction", compact_threshold: ... }] on POST /responses. Once the rendered token count crosses the threshold, the server compacts; no separate /responses/compact call is needed. The docs also give a tail-latency tip: drop items that came before the most recent compaction item, because the latest one already carries what is needed to continue. With previous_response_id chaining, do not prune by hand.

A compaction item is not a summary — it has three hard constraints ​

The common misreading is treating a compaction item as "history that got summarised". The docs describe it as opaque and not intended to be human-interpretable, and there are edges that bite:

  • A compaction item produced by the explicit compaction_trigger does not carry earlier additional_tools declarations. Resuming from it means supplying the tools you need in the request's tools array — otherwise the tools are simply gone.
  • /responses/compact rejects histories containing configuration_update items, including ones inherited through previous_response_id. You have to drop the update items in order, save the latest reasoning.effort and text.format separately, compact, then append a fresh update.
  • A standalone summary does not restore tools. After server-side compaction the API emits one fresh configuration_update right after the compaction item (only if the history had updates), and the order has to be replayed as-is.

Together these say one thing: compaction turns a continuous conversation into "an opaque state plus a set of configuration you must re-declare". Asynchronous compaction only moves the moment that state is produced out of your sight. It does not remove the obligation to replay it correctly.

When to turn background compaction off ​

The decision is not "compact or not", it is "can you tolerate an invisible compaction moment". These cases should set compaction.async: false:

  • Per-turn billing products: every turn's tokens have to reconcile, and background compaction makes a few turns mysteriously longer.
  • Reproducible evaluations: run the same conversation twice, get different compaction moments, get incomparable results.
  • Scenarios where a compaction failure must page someone: a blocking failure is an exception, a background failure is silence.
  • Workflows tightly coupled to tool declarations: when a compaction item drops additional_tools, the symptom is not an error but "the model suddenly cannot use tools", which is far harder to trace.

Conversely, long-running background jobs, offline batch work, and interactive long sessions where latency costs more than the bill are exactly where the default is right — what you save is the blocking time on every turn.

Closing ​

The change itself is small: one default plus one warning. What has to move is in three places — treat compaction.async as a cost parameter that must be declared explicitly, treat a compaction item as opaque state rather than a summary and write the tool re-declaration accordingly, and give "this session is not being compacted" its own metric, because a background failure never raises.

A single "may increase token usage" in an official note is easy to scroll past. It corresponds to an extra model call you pay for, switched on by default.

OpenAIChat · Full-stack engineering for LLM-powered conversations and apps