DEV Community

Cover image for OpenAI's Agents API Adds Auto Review, Off by Default. Background Compaction Is On
Gabriel Anhaia
Gabriel Anhaia

Posted on Edited on AI-assisted

OpenAI's Agents API Adds Auto Review, Off by Default. Background Compaction Is On


Background compaction is on by default in openai-python 3.42.0, released October 31. Auto review and time awareness, the other two new switches for the beta Agents API, start off.

Three of the release's ten features are for that API. The one that starts on is also the one OpenAI's own sessions API reference flags for token cost.

If you run sessions on the Agents API, the defaults are the part to read, because one of them may raise your token bill.

What shipped, and where it is written down

AICoder reports five Agents API updates OpenAI shared that week: auto review of commands, async compaction, experimental time awareness, mid-session tool updates, and automatic system prompt caching across sessions. The API changelog doesn't list them; its entries for October 28 and October 30 cover API credits for ChatGPT subscribers and GPT-6 Rosalind.

So the most precise record is the SDK. The settings landed in three pull requests: #4209 for compaction and #4211 for time awareness, both merged October 29, and #4217 for review and tool settings, merged October 31.

It is still a beta API. The Agents API overview calls it through client.beta.agents and sends an OpenAI-Beta: agents=v1 header in its curl example. AICoder dates the public beta to September 10.

Auto review: off unless you set it

Sessions get a review field with two values, none and auto_review (sessions reference). Leave it out and you get none, described as "Keep the existing execution behavior without automatic action review."

The reference describes auto_review in two short sentences: "Review eligible actions automatically. Deny manual approval fallbacks." It doesn't list which actions are eligible. My reading of the second sentence is that in this mode, an action that would otherwise wait for a person gets denied instead. That's an inference from one line, so check it against your own tools before you depend on it.

AICoder describes it as Codex-style auto review of commands before they run.

Switching it mid-session has a limited reach. The SDK's sessions.update() docstring says review sets the "Default action review for new root turns. Existing turns and their subagents keep their review mode" (commit a63c4cd). Turn it on mid-session and the turn already running stays unreviewed, along with its subagents.

A gatekeeper figure at a narrow gate inspecting a stream of command cards, waving most through while one card is stopped at a closed barrier
Auto review checks eligible actions before they run. It stays off unless you set review to auto_review.

Background compaction: on, and it can cost more

Compaction is how the managed harness handles a long session. The overview lists "Summarizing previous work to manage its context window" among the things it does. The new compaction.async flag decides whether that work blocks the agent or runs in the background.

The sessions reference says null or an empty object "enables background compaction," and the effective setting reports "Whether context is compacted in the background. Defaults to true." You set async to false "to use blocking compaction." Then the warning: "Background compaction may increase token usage."

OpenAI doesn't say by how much. AICoder notes that OpenAI published no latency or cost-saving numbers either. So you're trading waiting time against an unmeasured token cost, and the default picks speed.

In Python the field is async_, because async is a reserved word, and the SDK sends it as async on the wire (commit f552fcf). An update that turns on blocking compaction and time reminders looks like this. I haven't run it against the API myself:

from openai import OpenAI

client = OpenAI()

client.beta.agents.update(
    "agent_123",
    compaction={"async_": False},
    experimental={"time_awareness": True},
)
Enter fullscreen mode Exit fullscreen mode

The two objects update differently. A supplied compaction object "replaces the settings," per the agents reference, so sending {} later turns background compaction back on. Experimental settings "merge by key. Omitted settings keep their current values" (commit 10f9dd0).

A long conveyor of paper notes feeding into a compactor that folds them into a small block while a worker keeps typing beside it, a small orange meter climbing on the side
Background compaction lets the agent keep working while its context is summarized.

Time awareness and tool swaps

experimental.time_awareness is a boolean: "Whether to give the model periodic current-time reminders. Defaults to false." The SDK types add that "All experimental features default to disabled" (commit 10f9dd0). AICoder's example use is an instruction like "timebox CI fixes to 10 minutes", which only works if the model knows how much time has passed.

Tool replacement arrives on session updates through agent.tools (PR #4217). The OpenAPI text in that commit says it "Replaces the session tools. Functions and MCP servers change on the next model call." Built-in tools "change by the next turn." Omit the field to keep the current tools; pass null or an empty array to clear them.

Send one tool and the session has one tool; whatever you leave out is gone.

The configuration guide hasn't caught up. It still says "You cannot update reasoning.summary, text, tools, instructions, or multi_agent through this endpoint." The SDK and its OpenAPI spec now say tools can be replaced. Until the guide changes, try it on a throwaway session before a real one.

A callable API-key change, even if you don't use agents

The release also changes callable API keys. PR #4216 says it will "Keep overlapping requests from using another request's callable API-key result," so each result stays "with its own HTTP request or WebSocket connection, including Azure API-key authentication." If you pass a function as the API key, read that PR. It doesn't describe the old behavior in more detail, so I can't tell you how often it happened.

The same PR flags two things for anyone who subclasses the client: private _auth_headers overrides "may need updates because prepared credentials take precedence," and _configure_realtime overrides "must accept the new api_key keyword."

pip install --upgrade "openai==3.42.0"
Enter fullscreen mode Exit fullscreen mode

Before you upgrade

  1. If you turn on auto_review, test what happens to an action that used to wait for your approval.
  2. Watch token usage on long sessions; background compaction is the default.
  3. If you subclass the client, check your _auth_headers and _configure_realtime overrides.

Would you leave compaction in the background and pay the tokens, or turn it to blocking and wait? Tell me in the comments.


If this was useful

Background compaction is the kind of default you notice on the invoice: a setting you never touched, and a token count that can creep up across long sessions. Observability for LLM Applications is about catching that early, with traces, evals and cost tracking for LLM features in production. If you run agents for real users, it's the book I'd hand you: Observability for LLM Applications.

I build Hermes IDE, a free, source-available IDE for running Claude Code, Codex and other coding agents side by side on macOS, Windows and Linux, so weigh that mention accordingly. Download it or star it on GitHub.

Observability for LLM Applications — the book

Top comments (0)