Automatic review approves or denies supported approval requests as an agent works, much like the automatic approval function in ChatGPT and Codex. Configure it using the review field when you create a session for your agent. The setting applies to root turns and any subagents they create.
-
Review actions
Automatically approve or deny supported requests from the agent and its subagents.
-
Change review between tasks
Choose the review mode for the next root turn.
-
Keep network restrictions
Review does not override the environment’s outbound network restrictions.
API resources
-
/v1/agents/sessionsSet the review mode and inspect pending actions.
-
/v1/agentsReuse the instructions and tools for the task.
-
/v1/agents/environments/templatesReuse the execution environment’s configuration.
-
/v1/agents/sessions/{session_id}/eventsFollow progress and check how the turn ended.
How it works
Automatic review brings the “Approve for me” functionality of the Codex harness to your agents. During a session, approval requests can arise when an agent’s intended action requests additional permissions. Some example actions that could raise approval requests:
- Shell commands and terminal input that require approval, such as permission escalation or potentially dangerous commands.
- File changes that require approval.
- Additional permission requests, such as broader filesystem or network access.
- Network access requests that trigger approval, subject to the environment’s network restrictions.
- MCP tool calls whose approval rules require confirmation.
An OpenAI-managed reviewer model uses the conversation context to assess what the action would do, what risks it poses, and whether the action aligns with the user’s intent. The model then approves or denies the request.
Tokens used for review are billed in addition to your agent’s model usage.
Your application still handles browser origin-access and sign-in requests. MCP forms that require input and requests that direct the user to a URL follow their existing flows. Automatic review does not require new approval event handlers. See Events and items to follow the agent’s progress and check the turn’s outcome.
Choose a review mode
Set the session’s review field to choose the behavior:
| Value | Behavior |
|---|---|
"auto_review" |
Automatically approve or deny supported requests based on the action’s risks and the user’s instructions in the conversation. |
"none" |
Automatic review is not applied. Most actions execute directly, subject to the environment’s permissions and restrictions. |
Omitting review defaults to "none". The setting persists when the session
resumes. To change it, send "auto_review" or "none"; null is not accepted.
Setting review to "none" does not send those actions to your application for
manual approval.
Prepare the execution environment
For OpenAI-hosted execution, create the session with a new environment, optionally
from an environment template.
Automatic review is not supported when reusing an existing hosted environment
through environment_id.
For self-hosted execution, follow the
self-hosted environment setup
and the sandbox prerequisites for your operating system
before enabling automatic review. Setting review alone does not configure
sandboxing in your environment.
Automatic review does not change the environment’s network restrictions. Configure outbound access through the environment’s network settings. Browser origin approval does not override those restrictions.
Create a session with automatic review
Set review to "auto_review" when you create a session. This example asks the
agent to run npm install in /workspace.
With your API key and SDK configured,
use an existing agent and an environment template that provides Node.js and a
project containing /workspace/package.json. Replace the example agent and
template IDs with your own.
from openai import OpenAI
client = OpenAI()
session = client.beta.agents.sessions.create(
agent_id="agt_123",
environment={
"type": "openai_hosted",
"environment_template_id": "envtmpl_123",
},
review="auto_review",
input="Run npm install in /workspace.",
)
print(session.id)Use the returned session id to change the review mode
between tasks. See the Create session reference
for the request fields.
Your project must have access to automatic review. If it is unavailable, the API
rejects requests to enable it and identifies review as the affected parameter.
Change the review mode
Update the session’s review field between tasks. The main task must be idle and
input submission must have settled before you change the mode. This example
turns off automatic review. Replace sess_123 with the session ID returned above:
updated_session = client.beta.agents.sessions.update("sess_123", review="none")
print(updated_session.id)The update returns 200 OK and the updated session. Omit review from other
session updates to leave it unchanged. To enable automatic review again, send
"review": "auto_review". See the Update session reference
for the request fields.
A request to change the mode while the main task is active or input submission
has not settled returns 409 Conflict. None of the updates in that request are
applied. Retry after the task is idle and input submission has settled. Handle
409 even after checking the session’s status, because new input can arrive
before the update. Sending the current review value is allowed while work is
active.
Retrieve or
list sessions to inspect
the saved review value. If the response omits the field, treat it as "none".