Skip to content

Agents and multimodal systemsGuide

Agents API background compaction and auto review: what to re-measure

On October 30 OpenAI made context compaction run in the background by default in the Agents API beta, and added an automatic review mode that bills extra tokens. This guide lists which numbers to re-baseline, which spans and cost lines to add, and how to keep spend caps honest.

By INFRO Editorial

Published

10 min read

A glowing autonomous agent core coordinating tools, memory, and multiple AI model routes

In short

Two October 30 changes move tokens out of the turns you already count: compaction now runs in the background by default and may raise token usage, and automatic review bills reviewer tokens on top of the agent's model usage 12. Re-baseline per-session tokens with compaction.async both ways, add compaction and review as separate spans and cost lines, and check caps against the provider's own cost figures.

Key takeaways

  • Since Oct 30, 2026 Agents API compaction runs in the background by default, and OpenAI says this may increase token usage; compaction.async set to false restores blocking compaction 1.
  • Automatic review (review set to auto_review) bills reviewer tokens in addition to the agent's model usage, and it applies to root turns and to subagents 2.
  • Measure the same replay set four ways, with compaction async on and off and review on and off, before changing any cap.
  • Give compaction and review their own spans and cost lines so a rising bill can be traced to a cause rather than to 'the agent'.
  • Treat the provider's own cost figures as the check on your per-turn counts, because work that happens between turns is the easiest to miss.

What changed on October 30

Two entries in OpenAI's changelog, both dated October 30, 2026, touch the accounting of an Agents API loop. The first says context compaction now runs in the background by default, that you set compaction.async to false for blocking compaction, and that background compaction may increase token usage1. The second adds automatic review for eligible Agents API projects: set the session's review field to "auto_review" and a model approves or denies supported tool and permission requests based on conversation intent and risk1.

Both are in the Agents API public beta. Neither requires a code change to keep working, which is the reason to look at them: a default that moves work out of the turn you were counting, and a mode that adds a second model to the loop. If your token accounting, traces and spend caps were calibrated before October 30, the numbers they produce may now describe a different system.

This guide does not cover how the compaction itself is performed or how its usage is reported in API responses, because those pages were not read for this article. The measurement plan below is written so that it does not depend on those details: it compares totals you can read from the provider's own figures before and after each setting.

Why background compaction changes your token accounting

Compaction shrinks a session's accumulated context so a long run keeps fitting in the model's window. In a blocking design the work sits inside the turn that triggers it. You can see it as extra latency in that turn, and whatever tokens it consumes show up beside that turn's other usage.

With the background default, that attribution gets weaker. OpenAI's changelog states the consequence in one sentence: background compaction may increase token usage1. It does not give a mechanism or a size. One plausible reason, which is an inference and not something the changelog says, is that work done off the critical path is not tied to a single turn's result and may run when a blocking design would not have, or alongside the next turn. Whatever the reason, treat the size as unknown until you measure it on your own traffic.

Four things in your accounting can go wrong:

  • Per-turn token sums stop matching the session total. If you add up usage per turn and compare with the session or invoice figure, a gap can appear that was not there before.
  • Latency and cost move apart. A turn may look as fast as before while the session consumes more tokens, because the compaction cost is no longer on that turn's path.
  • Cost per successful task rises with no change in task mix. The extra tokens land on the denominator-free side of the ratio, and the dashboard shows 'the agent got more expensive'.
  • Caps that count per-turn usage under-count. A cap fed only by turn-level figures will trip later than the real spend line.

None of these is an error. They are drift, and drift is found by comparing against a baseline, so the baseline is the first thing to build.

What automatic review adds to the loop

Automatic review is the Codex harness's 'Approve for me' behavior brought to Agents API sessions. When an agent's action raises an approval request, an OpenAI-managed reviewer model uses the conversation context to assess what the action would do, what risk it carries and whether it matches the user's intent, then approves or denies it2. The guide's examples of requests that can arise are shell commands needing approval, file changes, broader filesystem or network access, network access subject to the environment's restrictions, and MCP tool calls whose rules require confirmation2.

For accounting, the relevant lines are short:

  • Tokens used for review are billed in addition to your agent's model usage2.
  • The setting applies to root turns and to any subagents they create2. A multi-agent run therefore multiplies review calls with its fan-out.
  • Omitting review defaults to "none", and the value persists when the session resumes2. A session created before you turned the feature on does not change by itself, but a session you resume keeps whatever it last had.
  • Review does not override the environment's outbound network restrictions2.
  • It is not supported when reusing an existing hosted environment through environment_id, and a project without access has the request rejected with review named as the affected parameter2.

There is also a behavioral change to measure, separate from cost. Denials and approvals now happen without your application's handlers: the guide says automatic review does not require new approval event handlers2. That is convenient, and it also means a denied action may only be visible as an event in the session's history. If your traces only record model calls and tool results, a denial leaves no mark.

A before/after measurement plan

Run this on a replay set, not on live traffic. Pick 30 to 100 representative sessions, weighted toward long ones, because compaction only matters once context grows. For how to replay safely, see replaying production traffic.

  1. Freeze the variables. Pin the model snapshot, the tool list and the environment template. A tool-list update changes behavior on the next model call for function tools and MCP servers, and by the next turn for built-in tools1, so do not edit tools mid-experiment.
  2. Build a four-cell matrix. Run each session with compaction.async true and false, and with review set to "none" and "auto_review". Create the sessions fresh for each cell, using a new environment for the review cells since reuse through environment_id is not supported with review2.
  3. Record per session, not per turn: total input, cached input, output and reasoning tokens as the provider reports them, wall-clock duration, turn count, number of approval requests, number of denials, and whether the task succeeded by your own check.
  4. Take the provider's total as ground truth. After each batch, read the spend for the window from the provider's own cost data and compare it with your summed figures. The difference is your unattributed share.
  5. Compare cells. The async-off, review-none cell is closest to pre-October 30 behavior and is your baseline. Report each other cell as a ratio to it, per session and as a median and a high percentile.
  6. Repeat on a second day. Background work may depend on timing, so one run is a sample, not a measurement.

Spans to add

Most agent traces have one span per model call and one per tool call. Add spans for the work that now happens beside them. The attribute names below are our own suggestions with an agent. prefix. OpenTelemetry's GenAI semantic conventions have moved to their own repository3, so check there for the current standard names for model, operation and token-usage attributes before choosing yours, and use those where they exist.

SpanWhen to open itAttributes worth keeping
agent.sessionCreate and resumesession id, agent.review_mode, agent.compaction_async, agent id, environment type
agent.turnEach root turnturn index, duration, tokens as reported, end reason
agent.compactionWhen a compaction is observed in session eventssession id, turn index it overlapped, tokens if reported, blocking or background
agent.reviewEach approval request resolved by reviewrequest kind, decision, subagent or root, reviewer tokens if reported
agent.toolEach tool calltool name, duration, whether a review preceded it
agent.reconcileBatch job after a window closessession total from provider, summed span total, unattributed difference

Two choices matter more than the names. First, record review_mode and compaction_async on the session span so a change in either is visible as a dimension, not inferred from a deploy date. Second, link compaction and review spans to the turn they overlapped rather than nesting them inside it, because a background job can outlive the turn. OpenAI's session events and item history, including per-turn item retrieval added on October 21, are the place to read what actually happened; the spans should be built from them, not from your client's guess.

Cost lines to add

Cost lines are what finance sees. If compaction and review tokens are folded into a single 'agent' line, a rise cannot be explained. Split them.

LineWhat goes in itWhy separate
Agent model usageTokens of the agent's own model callsThe baseline you already have
CompactionTokens attributed to compaction, plus any unattributed difference you assign to itOpenAI flags it as a possible increase1
Automatic reviewReviewer tokensBilled in addition to the agent's usage2
Sandbox computeOpenAI-hosted sandbox timeBilled during active turns, no longer for idle time between turns, since October 91
Server-side toolsSearch, fetch and other tool callsA separate meter; see what server-side tools cost

Keep an explicit 'unattributed' line equal to the provider total minus everything above it. A line that is usually near zero and then grows is the cheapest alarm you can build. Group all of them by project and by end-user id so the answer to 'which customer's sessions got more expensive' is a query, not an investigation.

If you use a service tier such as ultrafast on agents, record it as a dimension as well, since the changelog lists agent.service_tier as the switch1; the arithmetic for that is in ultrafast mode in an agent loop.

Keeping spend caps accurate

A cap is only as good as the counter behind it. Three adjustments follow from the above.

Count at the session level, with a margin. If your cap reads per-turn usage, add a reserve for work that is not attributed to a turn, sized from the unattributed share in your matrix. The ratio from your own replay is the input, not a number from this article.

Cap review separately when you can. A fan-out of subagents under auto_review gives each subagent's requests a reviewer pass2. A step limit that counts model turns will not bound that. Add a limit on approval requests per session, and treat a spike in requests as a signal that the agent is stuck asking for permissions it is not going to get. Bounds in general are covered in bounding agent loops.

Expect the cap to trip mid-session. A hard cap on a provider-held session means the next call fails while the session still holds state. Decide in advance whether that ends the session, pauses it for a human, or lets the current turn finish. Test it, including the 409 case: changing review while a task is active returns 409 Conflict and applies none of the updates in that request2, so a cap handler that tries to switch review off under load has to retry after the task is idle.

Failure modes to test

  • Resumed sessions keep old settings. Because review persists on resume2, a session created last week with review on keeps billing reviewer tokens after you thought you turned it off in config. Retrieve or list sessions and read the saved value; if the response omits the field, treat it as "none"2.
  • Blocking and background compare unfairly across days. Run both settings in the same window, interleaved, not one this week and one next.
  • A denial counted as a failure. A task that stops because review denied an action is a different outcome from a model error. Record it separately or your success rate and cost per successful task will mislead; see cost per successful task.
  • Experimental time awareness. The same October 30 entry added experimental.time_awareness, off by default, which gives the model periodic current-time reminders1. Leave it off during the matrix so it does not add a third variable.
  • Retention of your own records. If you rely on a vendor-side or gateway-side history window to run the comparison, check how long it is before the second-day repeat.

Where a gateway helps, and where it does not

Whether a gateway sees compaction and review work depends on whether those calls pass through it. For provider-held sessions, much of that work happens inside the provider, so a gateway log can show less than the provider's bill. Provider-held threads or your own history goes through the ownership question.

INFRO's documentation lists POST /v1/responses among its agent API endpoints, and pointing the OpenAI Agents SDK at INFRO is a change of base URL and key4. I did not confirm that the Agents API's /v1/agents/sessions resource is served this way, so check before assuming it is. Where traffic does go through INFRO, per-request usage and estimated provider cost, budgets and spend attribution are available, and spans can be pushed to your own collector over OTLP/HTTP with token counts and estimated cost; the docs say trace delivery is best effort and should not be the sole accounting record5. Daily reconciliation of estimated spend against OpenAI's cost API is the check that catches the unattributed share described above. Use it as a cross-check on the matrix, not a replacement for it.

Questions readers ask

Do I have to turn automatic review on?
No. Omitting the review field defaults to none, and the setting persists when a session resumes 2. Note that none does not route actions to your application for manual approval, so decide deliberately what your approval path is.
Can I change review in the middle of a task?
Not while the main task is active or input submission has not settled: the request returns 409 Conflict and none of the updates in it are applied 2. Retry when the session is idle, and handle the 409 even if you checked status first.

From the team that builds it

Where this shows up in INFRO

INFRO is a control plane in front of the provider accounts you already hold. The capabilities below are the parts of it this article touches, each with the documentation that defines its behaviour.

  • OpenTelemetry export

    Available with a plan

    Spans pushed to your own collector from the request path, with the endpoint and headers set in the console. Included on every plan.

    Read the documentation for OpenTelemetry export
  • Usage and cost per request

    Available with a plan

    Every request records its model, latency, token or unit counts, and estimated provider cost, queryable by project and key.

    Read the documentation for Usage and cost per request
  • Budgets and spend ceilings

    Available with a plan

    A hard cap per organization, project, member, and key, with alerts at your own thresholds.

    Read the documentation for Budgets and spend ceilings
  • Provider cost reconciliation

    Available with a plan

    Daily comparison of estimated spend against the cost reported by OpenAI's and Anthropic's own cost APIs, using a separate admin credential, with the likely cause of a persistent gap and a suggested rate you can apply. Included on every plan.

    Read the documentation for Provider cost reconciliation
  • Claude Code and Codex through INFRO

    Available with a plan

    Point Claude Code, the Claude Agent SDK, Codex or the OpenAI Agents SDK at INFRO by changing the base URL and the key. Anthropic's Messages API and OpenAI's Responses API, with routing, budgets refused before the call, guardrails and the request log applied as on every other request.

  • Spend attribution

    Available with a plan

    Group cost by model, project, key, or an end-user id you attach to the request.

    Read the documentation for Spend attribution
  • Usage, request and FOCUS exports

    Available with a plan

    GET /v1/usage and GET /v1/requests on any gateway key, the request log and usage series as CSV, plus a FOCUS v1.4 Cost and Usage dataset as JSON or CSV, so AI spend lands in your FinOps platform beside the rest of your cloud cost.

    Read the documentation for Usage, request and FOCUS exports

INFRO accounts are self-serve. Provider usage is billed to you by your providers; INFRO charges a software subscription and takes 0% of model spend. See plans.

Sources

Numbered in order of first citation. Each was opened and checked against the claim on the date shown.

  1. 1.Changelog (OpenAI API), entries of Oct 30, Oct 9 and Oct 16, 2026 (opens in a new tab) — OpenAI. Accessed Nov 8, 2026.
  2. 2.Automatic review (Agents API sessions) (opens in a new tab) — OpenAI. Accessed Nov 8, 2026.
  3. 3.Generative AI semantic conventions (moved notice) (opens in a new tab) — OpenTelemetry. Accessed Nov 8, 2026.
  4. 4.INFRO documentation overview (opens in a new tab) — INFRO. Accessed Nov 8, 2026.
  5. 5.Exports & OpenTelemetry (opens in a new tab) — INFRO. Accessed Nov 8, 2026.

About this article

Read on 2026-11-08: OpenAI's API changelog (Oct 30 entries), the Agents API automatic review guide, OpenTelemetry's GenAI conventions page, and INFRO's docs overview and exports page. OpenAI's /api and /news pages returned HTTP 403, and the compaction and Agents API observability guides were not read, so how compaction usage is reported in responses is left out as unconfirmed.

Last checked against its sources on . The next review is due by . No separate named reviewer is recorded for this article.

How articles are written, sourced and corrected is set out in the editorial standards.