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
reviewdefaults 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 withreviewnamed 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.
- 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.
- Build a four-cell matrix. Run each session with
compaction.asynctrue and false, and withreviewset to"none"and"auto_review". Create the sessions fresh for each cell, using a new environment for the review cells since reuse throughenvironment_idis not supported with review2. - 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.
- 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.
- 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.
- 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.
| Span | When to open it | Attributes worth keeping |
|---|---|---|
agent.session | Create and resume | session id, agent.review_mode, agent.compaction_async, agent id, environment type |
agent.turn | Each root turn | turn index, duration, tokens as reported, end reason |
agent.compaction | When a compaction is observed in session events | session id, turn index it overlapped, tokens if reported, blocking or background |
agent.review | Each approval request resolved by review | request kind, decision, subagent or root, reviewer tokens if reported |
agent.tool | Each tool call | tool name, duration, whether a review preceded it |
agent.reconcile | Batch job after a window closes | session 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.
| Line | What goes in it | Why separate |
|---|---|---|
| Agent model usage | Tokens of the agent's own model calls | The baseline you already have |
| Compaction | Tokens attributed to compaction, plus any unattributed difference you assign to it | OpenAI flags it as a possible increase1 |
| Automatic review | Reviewer tokens | Billed in addition to the agent's usage2 |
| Sandbox compute | OpenAI-hosted sandbox time | Billed during active turns, no longer for idle time between turns, since October 91 |
| Server-side tools | Search, fetch and other tool calls | A 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
reviewpersists 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.
