environment: EnvironmentParam

An inline execution environment or a reference to an environment template.

One of the following:
EnvironmentParamNone { type }

Runs the agent without an execution environment.

type: "none"

The type of the object. Always none.

EnvironmentParamOpenAIHosted { type, capability_directories, container_size, 10 more }

An existing OpenAI-hosted environment or new inline/template-based hosted configuration.

type: "openai_hosted"

The type of the object. Always openai_hosted.

capability_directories?: Array<string> | null

Directories that contain capabilities exposed to the agent. Defaults to an empty list.

minItems0
maxItems16384
container_size?: "small" | "medium" | "large"

The hosted container size. Omission selects the medium tier.

One of the following:
"small"
"medium"
"large"
desktop?: Desktop | null

Desktop provisioning. Omission or null inherits the template setting, or defaults to disabled.

enabled: boolean

Whether to provision the desktop and its browser proxy.

env?: Record<string, string> | null

Environment variables made available to the agent.

environment_id?: string

An existing prewarmed environment. Cannot be combined with a template or inline configuration.

minLength9
maxLength256
environment_template_id?: string

A reusable hosted template applied before inline session configuration. Omitted fields inherit the template; network overrides cannot broaden its policy.

minLength0
maxLength64
files?: Array<HostedEnvironmentFileParam> | null

Files available before the agent starts. Defaults to an empty list.

minItems0
maxItems50
One of the following:
HostedEnvironmentFileParamFileID { file_id, path, type }

A file previously uploaded through the OpenAI Files API.

file_id: string

The ID of the uploaded file.

minLength1
maxLength256
path: string

The absolute destination path inside /workspace.

minLength1
maxLength4096
type: "file_id"

The type of the object. Always file_id.

HostedEnvironmentFileParamInline { data, path, type }

A file supplied directly as standard-base64 data.

data: string

The standard-base64-encoded file contents.

minLength0
maxLength6990508
path: string

The absolute destination path inside /workspace.

minLength1
maxLength4096
type: "inline"

The type of the object. Always inline.

network?: Network | null

Network access policy for the environment. If omitted, the API version determines whether network access is enabled or disabled.

access: "enabled" | "disabled" | "restricted"

The environment’s network access mode.

One of the following:
"enabled"

Allows unrestricted network access.

"disabled"

Disables network access.

"restricted"

Applies the configured domain restrictions.

allowed_domains?: Array<string> | null

Domains the environment may access when network access is restricted.

minItems0
maxItems16384
blocked_domains?: Array<string> | null

Domains blocked for both executor and browser when access is restricted. A nonempty list requires access: restricted and cannot be combined with nonempty allowed_domains. Wildcard domains are not supported.

minItems0
maxItems100
packages?: Packages | null

Packages to install in the environment. Defaults to empty package lists.

npm?: Array<string> | null

npm packages to install globally. Defaults to an empty list.

minItems0
maxItems16384
python?: Array<string> | null

Python packages to install. Defaults to an empty list.

minItems0
maxItems16384
system?: Array<string> | null

System packages to install. Defaults to an empty list.

minItems0
maxItems16384
plugins?: Array<HostedPluginParam { description, name, source, type } > | null

Plugins provided as inline ZIP archives. Defaults to an empty list.

minItems0
maxItems32
description: string

The plugin description declared in .codex-plugin/plugin.json.

minLength0
maxLength1048576
name: string

The plugin name declared in .codex-plugin/plugin.json.

minLength1
maxLength64
source: InlineCapabilitySourceParam { data, media_type, type }

Provides ZIP bytes encoded with standard base64.

data: string

Standard-base64 encoded ZIP archive bytes.

minLength1
maxLength70254592
media_type: "application/zip"

The archive media type, always application/zip.

type: "base64"

The type of the object. Always base64.

type: "inline"

The type of the object. Always inline.

setup_commands?: Array<SetupCommandParam { command, cwd } > | null

Ordered, confidential setup commands. Command bodies are never returned.

minItems0
maxItems16
command: string

The shell command to execute.

minLength0
maxLength65536
cwd?: string | null

The absolute working directory. Defaults to /workspace.

minLength0
maxLength4096
skills?: Array<HostedSkillParam> | null

Skills referenced by ID or provided as inline ZIP archives. Defaults to an empty list.

minItems0
maxItems200
One of the following:
HostedSkillParamSkillReference { skill_id, type, version }

References a skill uploaded through the Skills API.

skill_id: string

The ID of the skill created through /v1/skills.

minLength1
maxLength64
type: "skill_reference"

The type of the object. Always skill_reference.

version?: string | null

The skill version, a positive integer or latest; omission selects the default.

minLength0
maxLength1048576
HostedSkillParamInline { description, name, source, type }

Supplies a skill ZIP directly in the session request.

description: string

The skill description declared in SKILL.md.

minLength0
maxLength1048576
name: string

The skill name declared in SKILL.md.

minLength1
maxLength64
source: InlineCapabilitySourceParam { data, media_type, type }

Provides ZIP bytes encoded with standard base64.

data: string

Standard-base64 encoded ZIP archive bytes.

minLength1
maxLength70254592
media_type: "application/zip"

The archive media type, always application/zip.

type: "base64"

The type of the object. Always base64.

type: "inline"

The type of the object. Always inline.

EnvironmentParamSelfHosted { type, workspace_directory, capability_directories }

An application-hosted environment configured inline.

type: "self_hosted"

The type of the object. Always self_hosted.

workspace_directory: string

Absolute project directory inside the self-hosted environment.

minLength0
maxLength1048576
capability_directories?: Array<string> | null

Directories that contain capabilities exposed to the agent. Defaults to an empty list.

minItems0
maxItems16384
agent?: Agent

Agent configuration. With agent_id, supplied fields override the saved agent for this session. Without agent_id, model is required.

compaction?: Compaction | null

Context compaction settings. Omit to keep the current settings. A supplied object replaces the settings; null or an empty object enables background compaction.

async?: boolean | null

Whether to compact context in the background. Omission or null defaults to true. Set to false to use blocking compaction. Background compaction may increase token usage.

experimental?: Experimental { time_awareness }

Experimental settings to merge by key. Omitted settings keep their current values.

time_awareness?: boolean

Whether to give the model periodic current-time reminders. Omit to keep the current setting.

instructions?: string | null

Additional instructions appended to the agent’s default base instructions. Omit to leave unchanged.

minLength0
maxLength1048576
model?: string

The model to use for the agent. The requested model name is preserved.

minLength0
maxLength1048576
multi_agent?: MultiAgentConfigParam { enabled, max_concurrent_subagents } | null

Configuration for creating and coordinating subagents.

enabled: boolean

Whether subagent tools are enabled.

max_concurrent_subagents?: number

Maximum number of subagents that may run concurrently. Defaults to 6.

formatint64
minimum1
maximum4294967295
reasoning?: AgentReasoningParam { effort, summary } | null

Configuration for model reasoning. Omit to keep the current settings; pass null to reset to the model’s default effort.

effort?: "none" | "minimal" | "low" | 4 more | null

The amount of reasoning effort the model should use. Omission lets the model select it.

One of the following:
"none"
"minimal"
"low"
"medium"
"high"
"xhigh"
"max"
summary?: "concise" | "detailed" | "auto" | null

Controls whether the response includes a reasoning summary.

One of the following:
"concise"

Returns a concise reasoning summary when supported.

"detailed"

Returns a detailed reasoning summary when supported.

"auto"

Automatically selects the most detailed summary supported by the model.

service_tier?: "auto" | "default" | "flex" | 3 more | null

The service tier used for model requests.

  • auto - Selects the service tier automatically.
  • default - Uses the default service tier.
  • flex - Uses the flex service tier.
  • priority - Uses the priority service tier.
  • fast - Uses the fast service tier.
  • ultrafast - Uses the ultrafast service tier.
One of the following:
"auto"

Selects the service tier automatically.

"default"

Uses the default service tier.

"flex"

Uses the flex service tier.

"priority"

Uses the priority service tier.

"fast"

Uses the fast service tier.

"ultrafast"

Uses the ultrafast service tier.

text?: AgentTextParam { format, verbosity } | null

Configuration for text generated by the agent.

format?: TextFormatParam | null

The output format. Omission uses ordinary text ({"type": "text"}).

One of the following:
TextFormatParamText { type }

Generates ordinary text without a structured-output constraint.

type: "text"

The type of the object. Always text.

TextFormatParamJSONSchema { schema, type }

Constrains generated text to a JSON Schema.

schema: Record<string, unknown>

The JSON Schema that generated text must match.

type: "json_schema"

The type of the object. Always json_schema.

verbosity?: "low" | "medium" | "high" | null

The amount of text the model should produce. Defaults to medium, matching Responses.

One of the following:
"low"

Produces less text.

"medium"

Uses the default amount of text.

"high"

Produces more text.

tools?: Array<AgentToolParam> | null

Tools available to the agent. Omit to inherit, or pass null to clear them. The resolved tool list must fit within 3 MiB (3,145,728 bytes) of compact UTF-8 JSON.

minItems0
maxItems16384
One of the following:
AgentToolConfigParamFunction { description, name, parameters, 3 more }

A function defined by the application.

description: string

A description of what the function does.

minLength0
maxLength1048576
name: string

The name of the function.

minLength0
maxLength1048576
parameters: Record<string, unknown>

A JSON Schema object describing the function’s arguments.

type: "function"

The type of the object. Always function.

async?: boolean

Whether the agent continues without waiting for the function result. Defaults to false.

defer_loading?: boolean

Whether this function is deferred and discovered through tool search. Defaults to false.

AgentToolConfigParamToolSearch { type }

Discovers deferred function tools and loads them into the model context.

type: "tool_search"

The type of the object. Always tool_search.

AgentToolConfigParamProgrammaticToolCalling { type, enabled }

Enables calling tools from model-generated code.

type: "programmatic_tool_calling"

The type of the object. Always programmatic_tool_calling.

enabled?: boolean

Whether tools can be called from model-generated code. Defaults to true.

AgentToolConfigParamMcp { server_label, transport, type, 5 more }

Tools provided by a remote MCP server.

server_label: string

A label used to identify the MCP server in tool calls.

minLength0
maxLength1048576

The transport used to connect to the MCP server.

One of the following:
McpTransportConfigParamHTTP { server_url, type, authorization, headers }

Connects to an MCP server over HTTP.

server_url: string

The URL of the MCP server.

minLength0
maxLength1048576
type: "http"

The type of the object. Always http.

authorization?: string | null

The authorization value sent to the MCP server, if any.

minLength0
maxLength1048576
headers?: Record<string, string> | null

Additional HTTP headers sent to the MCP server.

McpTransportConfigParamStdio { command, cwd, type, 3 more }

Starts an MCP server as a local process.

command: string

The command used to start the MCP server.

minLength0
maxLength1048576
cwd: string

The working directory used to start the MCP server.

minLength0
maxLength1048576
type: "stdio"

The type of the object. Always stdio.

args?: Array<string> | null

Arguments passed to the MCP server command.

minItems0
maxItems16384
env?: Record<string, string> | null

Environment variables set for the MCP server process.

env_vars?: Array<string> | null

Environment variable names to inherit from the selected execution environment.

minItems0
maxItems16384
type: "mcp"

The type of the object. Always mcp.

allowed_tools?: Array<string> | null

The MCP tools the agent may call. All server tools are allowed when omitted.

minItems0
maxItems16384
connection_origin?: "service" | "environment" | null

Selects where outbound MCP HTTP connections originate. Omitted or service uses the Managed Agents service network; environment uses the session’s selected environment.

One of the following:
"service"

Uses the Managed Agents service network.

"environment"

Uses the session’s execution environment.

credential_id?: string | null

The attached vault credential used to authenticate this MCP server. Optional when exactly one attached credential matches the server URL.

minLength0
maxLength1048576
request_metadata?: Record<string, unknown> | null

Metadata included with requests to this MCP server.

required?: boolean

Whether this MCP server must initialize before the first turn. Defaults to false.

AgentToolConfigParamWebSearch { type, allowed_domains, context_size, 2 more }

Web search.

type: "web_search"

The type of the object. Always web_search.

allowed_domains?: Array<string> | null

Domains the search may include.

minItems0
maxItems16384
context_size?: "low" | "medium" | "high" | null

The amount of search context made available to the model. Defaults to medium.

One of the following:
"low"
"medium"
"high"
location?: Location | null

Approximate location used to localize search results.

city?: string | null

The city name.

minLength0
maxLength1048576
country?: string | null

The two-letter ISO country code, such as US.

minLength0
maxLength1048576
region?: string | null

The region or state name.

minLength0
maxLength1048576
timezone?: string | null

The IANA timezone, such as America/Los_Angeles.

minLength0
maxLength1048576
mode?: "disabled" | "cached" | "live" | null

The source used for web search results. Defaults to live.

One of the following:
"disabled"

Disables web search.

"cached"

Uses cached search results.

"live"

Searches the live web.

AgentToolConfigParamComputerUse { type, include_screenshots }

Browser use in an OpenAI-hosted session.

type: "computer_use"

The type of the object. Always computer_use.

include_screenshots?: boolean

Whether computer tool outputs include screenshots. Defaults to false.

AgentToolConfigParamAutomations { type }

Lets the agent manage its own scheduled wakeups.

type: "automations"

The type of the object. Always automations.

agent_id?: string

The ID of a saved reusable agent. Omit agent to use its configuration unchanged.

minLength0
maxLength64
input?: string | Array<AgentSessionInputMessageParam { content, role, type } > | null

Initial input to submit when the session is created. A string is shorthand for a single user message. Required when environment.type is none, or when stream is true for an environment that is not self_hosted; optional for self-hosted and non-streaming execution environments.

One of the following:
string
Array<AgentSessionInputMessageParam { content, role, type } >
content: Array<InputContentParam>

The content of the message.

minItems0
maxItems16384
One of the following:
InputContentParamInputText { text, type }

Text input to the model.

text: string

The text sent to the model.

minLength0
maxLength1048576
type: "input_text"

The type of the object. Always input_text.

InputContentParamInputImage { image_url, type }

Image input to the model.

image_url: string

The URL of the image sent to the model.

minLength0
maxLength1048576
type: "input_image"

The type of the object. Always input_image.

role: "user"

The role of the message author. Always user.

type?: "message"

The type of the input item. Always message.

metadata?: Record<string, string> | null

Up to 16 string key-value pairs, with keys up to 64 and values up to 512 characters. Omission or null defaults to an empty map.

prompt_cache_options?: PromptCacheOptions | null

Default prompt cache lifetime for turns in this session. Omit to use the model default.

ttl?: "30m" | "12h"

Minimum lifetime for new prompt cache entries. Defaults to 30 minutes.

One of the following:
"30m"
"12h"
review?: "none" | "auto_review"

Action review mode. Omit to use none.

One of the following:
"none"

Keep the existing execution behavior without automatic action review.

"auto_review"

Review eligible actions automatically. Deny manual approval fallbacks.

spend_control?: SpendControl | null

Optional spending limit in USD cents. Omission or null creates an unlimited session.

limit: number | null

Positive USD cents, or null to remove the limit.

formatint64
minimum1
maximum4503599627370495
stream?: false

Whether to stream session events as server-sent events. Defaults to false.

stream_options?: StreamOptions

Options for the event stream. Only allowed when stream is true.

include_obfuscation?: boolean

Whether to include obfuscation padding in events on this connection. Defaults to true.

vault_ids?: Array<string> | null

The IDs of vaults made available to the session.

minItems0
maxItems16384