{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/openai/main/json-schema/openai-session-resource-schema.json",
  "title": "SessionResource",
  "description": "A Managed Agents session.",
  "x-generated": "2026-09-23",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/openai-agents-api-openapi.yml#/components/schemas/SessionResource",
  "type": "object",
  "properties": {
    "metadata": {
      "type": "object",
      "additionalProperties": {
        "type": "string",
        "minLength": 0
      },
      "propertyNames": {
        "type": "string",
        "minLength": 0
      },
      "minProperties": 0,
      "description": "Custom string key-value pairs attached to the session."
    },
    "id": {
      "type": "string",
      "minLength": 0,
      "description": "The ID of the session."
    },
    "object": {
      "type": "string",
      "enum": [
        "agent.session"
      ],
      "default": "agent.session",
      "x-stainless-const": true,
      "description": "The object type. Always `agent.session`."
    },
    "created_at": {
      "type": "integer",
      "format": "int64",
      "description": "The Unix timestamp, in seconds, when the session was created."
    },
    "last_active_at": {
      "type": "integer",
      "format": "int64",
      "description": "The Unix timestamp, in seconds, when the session was last active."
    },
    "status": {
      "$ref": "#/$defs/SessionStatusResource",
      "description": "The current status of the session."
    },
    "required_actions": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/SessionRequiredActionResource"
      },
      "minItems": 0,
      "maxItems": 2000,
      "description": "Actions that must be completed before the session can continue."
    },
    "error": {
      "description": "The error that caused the session to fail, if any.",
      "type": [
        "string",
        "null"
      ],
      "minLength": 0
    },
    "agent": {
      "$ref": "#/$defs/SessionAgentResource",
      "description": "The agent running in the session."
    },
    "environment": {
      "$ref": "#/$defs/EnvironmentResource",
      "description": "The execution environment for the session."
    },
    "vault_ids": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 0
      },
      "minItems": 0,
      "maxItems": 2000,
      "description": "The IDs of vaults made available to the session."
    },
    "usage": {
      "anyOf": [
        {
          "$ref": "#/$defs/TokenUsageResource"
        },
        {
          "type": "null"
        }
      ],
      "description": "Best-effort token usage for the session, or null if unknown. Recorded usage may change."
    }
  },
  "required": [
    "metadata",
    "id",
    "object",
    "created_at",
    "last_active_at",
    "status",
    "required_actions",
    "error",
    "agent",
    "environment",
    "vault_ids",
    "usage"
  ],
  "additionalProperties": false,
  "$defs": {
    "AgentToolResource": {
      "oneOf": [
        {
          "$ref": "#/$defs/AgentToolResourceFunction"
        },
        {
          "$ref": "#/$defs/AgentToolResourceProgrammaticToolCalling"
        },
        {
          "$ref": "#/$defs/AgentToolResourceMcp"
        },
        {
          "$ref": "#/$defs/AgentToolResourceWebSearch"
        }
      ],
      "x-oai-discriminator-values": [
        "function",
        "programmatic_tool_calling",
        "mcp",
        "web_search"
      ],
      "description": "A tool available to the agent."
    },
    "AgentToolResourceFunction": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "function"
          ],
          "default": "function",
          "x-stainless-const": true,
          "description": "The type of the object. Always `function`."
        },
        "name": {
          "type": "string",
          "minLength": 0,
          "description": "The name of the function."
        },
        "description": {
          "type": "string",
          "minLength": 0,
          "description": "A description of what the function does."
        },
        "parameters": {
          "type": "object",
          "additionalProperties": {},
          "propertyNames": {
            "type": "string",
            "minLength": 0
          },
          "minProperties": 0,
          "description": "A JSON Schema object describing the function's arguments."
        },
        "defer_loading": {
          "type": "boolean",
          "description": "Whether the function is deferred and discovered through tool search."
        }
      },
      "required": [
        "type",
        "name",
        "description",
        "parameters",
        "defer_loading"
      ],
      "additionalProperties": false,
      "description": "A function defined by the application."
    },
    "AgentToolResourceMcp": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "mcp"
          ],
          "default": "mcp",
          "x-stainless-const": true,
          "description": "The type of the object. Always `mcp`."
        },
        "server_label": {
          "type": "string",
          "minLength": 0,
          "description": "A label used to identify the MCP server in tool calls."
        },
        "credential_id": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 0,
          "description": "The attached vault credential selected for this MCP server, if any. Optional when exactly one attached credential matches the server URL."
        },
        "transport": {
          "$ref": "#/$defs/McpTransportResource",
          "description": "The transport used to connect to the MCP server."
        },
        "request_metadata": {
          "type": "object",
          "additionalProperties": {},
          "propertyNames": {
            "type": "string",
            "minLength": 0
          },
          "minProperties": 0,
          "description": "Metadata included with requests to this MCP server."
        },
        "allowed_tools": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "string",
            "minLength": 0
          },
          "minItems": 0,
          "maxItems": 2000,
          "description": "The MCP tools the agent may call."
        },
        "required": {
          "type": "boolean",
          "description": "Whether this MCP server must initialize before the first turn."
        },
        "connection_origin": {
          "$ref": "#/$defs/McpConnectionOriginResource",
          "description": "Where outbound MCP HTTP connections originate."
        }
      },
      "required": [
        "type",
        "server_label",
        "credential_id",
        "transport",
        "request_metadata",
        "allowed_tools",
        "required",
        "connection_origin"
      ],
      "additionalProperties": false,
      "description": "Tools provided by a remote MCP server."
    },
    "AgentToolResourceProgrammaticToolCalling": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "programmatic_tool_calling"
          ],
          "default": "programmatic_tool_calling",
          "x-stainless-const": true,
          "description": "The type of the object. Always `programmatic_tool_calling`."
        },
        "enabled": {
          "type": "boolean",
          "description": "Whether tools can be called from model-generated code."
        }
      },
      "required": [
        "type",
        "enabled"
      ],
      "additionalProperties": false,
      "description": "Enables calling tools from model-generated code."
    },
    "AgentToolResourceWebSearch": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "web_search"
          ],
          "default": "web_search",
          "x-stainless-const": true,
          "description": "The type of the object. Always `web_search`."
        },
        "mode": {
          "$ref": "#/$defs/WebSearchModeResource",
          "description": "The source used for web search results."
        },
        "context_size": {
          "$ref": "#/$defs/WebSearchContextSizeResource",
          "description": "The amount of search context made available to the model. Defaults to `medium`."
        },
        "allowed_domains": {
          "type": [
            "array",
            "null"
          ],
          "items": {
            "type": "string",
            "minLength": 0
          },
          "minItems": 0,
          "maxItems": 2000,
          "description": "Allowed search domains, or `null` when the search is unrestricted."
        },
        "location": {
          "anyOf": [
            {
              "$ref": "#/$defs/WebSearchLocationResource"
            },
            {
              "type": "null"
            }
          ],
          "description": "Approximate location used to localize search results, if provided."
        }
      },
      "required": [
        "type",
        "mode",
        "context_size",
        "allowed_domains",
        "location"
      ],
      "additionalProperties": false,
      "description": "Web search."
    },
    "EnvironmentPackagesResource": {
      "type": "object",
      "properties": {
        "python": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 0,
            "maxLength": 1048576
          },
          "minItems": 0,
          "maxItems": 16384,
          "description": "Python packages installed in the environment."
        },
        "system": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 0,
            "maxLength": 1048576
          },
          "minItems": 0,
          "maxItems": 16384,
          "description": "System packages installed in the environment."
        },
        "npm": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 0,
            "maxLength": 1048576
          },
          "minItems": 0,
          "maxItems": 16384,
          "description": "npm packages installed globally in the environment."
        }
      },
      "required": [
        "python",
        "system",
        "npm"
      ],
      "additionalProperties": false,
      "description": "Packages installed in an OpenAI-hosted environment."
    },
    "EnvironmentResource": {
      "oneOf": [
        {
          "$ref": "#/$defs/EnvironmentResourceNone"
        },
        {
          "$ref": "#/$defs/EnvironmentResourceOpenaiHosted"
        },
        {
          "$ref": "#/$defs/EnvironmentResourceSelfHosted"
        }
      ],
      "x-oai-discriminator-values": [
        "none",
        "openai_hosted",
        "self_hosted"
      ],
      "description": "The execution environment for a session."
    },
    "EnvironmentResourceNone": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "none"
          ],
          "default": "none",
          "x-stainless-const": true,
          "description": "The type of the object. Always `none`."
        }
      },
      "required": [
        "type"
      ],
      "additionalProperties": false,
      "description": "The session talks to CCA without selecting or provisioning an execution environment."
    },
    "EnvironmentResourceOpenaiHosted": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "openai_hosted"
          ],
          "default": "openai_hosted",
          "x-stainless-const": true,
          "description": "The type of the object. Always `openai_hosted`."
        },
        "id": {
          "type": "string",
          "minLength": 0,
          "description": "The public ID of the environment."
        },
        "packages": {
          "$ref": "#/$defs/EnvironmentPackagesResource",
          "description": "Packages installed in the environment."
        },
        "network": {
          "$ref": "#/$defs/NetworkPolicyResource",
          "description": "The effective network access policy for the environment."
        },
        "capability_directories": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 0
          },
          "minItems": 0,
          "maxItems": 2000,
          "description": "Directories that contain capabilities exposed to the agent."
        },
        "skills": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/HostedSkillResource"
          },
          "minItems": 0,
          "maxItems": 2000,
          "description": "Skills installed in the environment, excluding their archive contents."
        },
        "plugins": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/HostedPluginResource"
          },
          "minItems": 0,
          "maxItems": 2000,
          "description": "Plugins installed in the environment, excluding their archive contents."
        },
        "files": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/HostedEnvironmentFileResource"
          },
          "minItems": 0,
          "maxItems": 50,
          "description": "Files available in the environment, excluding their contents."
        }
      },
      "required": [
        "type",
        "id",
        "packages",
        "network",
        "capability_directories",
        "skills",
        "plugins",
        "files"
      ],
      "additionalProperties": false,
      "description": "An environment hosted by OpenAI."
    },
    "EnvironmentResourceSelfHosted": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "self_hosted"
          ],
          "default": "self_hosted",
          "x-stainless-const": true,
          "description": "The type of the object. Always `self_hosted`."
        },
        "remote_url": {
          "type": "string",
          "minLength": 0,
          "description": "Pass this URL unchanged to `codex exec-server --remote` when connecting this environment."
        },
        "id": {
          "type": "string",
          "minLength": 0,
          "description": "The public ID of the environment."
        },
        "workspace_directory": {
          "type": "string",
          "minLength": 0,
          "description": "The absolute project directory inside the environment. Defaults to `/workspace`."
        },
        "capability_directories": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 0
          },
          "minItems": 0,
          "maxItems": 2000,
          "description": "Directories that contain capabilities exposed to the agent."
        }
      },
      "required": [
        "type",
        "remote_url",
        "id",
        "workspace_directory",
        "capability_directories"
      ],
      "additionalProperties": false,
      "description": "An environment hosted by the application."
    },
    "HostedEnvironmentFileResource": {
      "oneOf": [
        {
          "$ref": "#/$defs/HostedEnvironmentFileResourceFileId"
        },
        {
          "$ref": "#/$defs/HostedEnvironmentFileResourceInline"
        }
      ],
      "x-oai-discriminator-values": [
        "file_id",
        "inline"
      ],
      "description": "Metadata for a file materialized in an OpenAI-hosted execution environment."
    },
    "HostedEnvironmentFileResourceFileId": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "file_id"
          ],
          "default": "file_id",
          "x-stainless-const": true,
          "description": "The type of the object. Always `file_id`."
        },
        "id": {
          "type": "string",
          "minLength": 0,
          "description": "The session-scoped ID of the file in the execution environment."
        },
        "file_id": {
          "type": "string",
          "minLength": 0,
          "description": "The ID of the uploaded file."
        },
        "path": {
          "type": "string",
          "minLength": 0,
          "description": "The file's absolute path inside the environment."
        },
        "size_bytes": {
          "type": "integer",
          "format": "int64",
          "minimum": 0,
          "description": "The decoded file size in bytes."
        }
      },
      "required": [
        "type",
        "id",
        "file_id",
        "path",
        "size_bytes"
      ],
      "additionalProperties": false,
      "description": "A file copied from the OpenAI Files API."
    },
    "HostedEnvironmentFileResourceInline": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "inline"
          ],
          "default": "inline",
          "x-stainless-const": true,
          "description": "The type of the object. Always `inline`."
        },
        "id": {
          "type": "string",
          "minLength": 0,
          "description": "The session-scoped ID of the file in the execution environment."
        },
        "path": {
          "type": "string",
          "minLength": 0,
          "description": "The file's absolute path inside the environment."
        },
        "size_bytes": {
          "type": "integer",
          "format": "int64",
          "minimum": 0,
          "description": "The decoded file size in bytes."
        }
      },
      "required": [
        "type",
        "id",
        "path",
        "size_bytes"
      ],
      "additionalProperties": false,
      "description": "A file supplied inline when the session was created."
    },
    "HostedPluginResource": {
      "oneOf": [
        {
          "$ref": "#/$defs/HostedPluginResourceInline"
        }
      ],
      "x-oai-discriminator-values": [
        "inline"
      ],
      "description": "A plugin installed in an OpenAI-hosted environment."
    },
    "HostedPluginResourceInline": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "inline"
          ],
          "default": "inline",
          "x-stainless-const": true,
          "description": "The type of the object. Always `inline`."
        },
        "name": {
          "type": "string",
          "minLength": 0,
          "description": "The installed plugin name."
        },
        "description": {
          "type": "string",
          "minLength": 0,
          "description": "The installed plugin description."
        }
      },
      "required": [
        "type",
        "name",
        "description"
      ],
      "additionalProperties": false,
      "description": "A plugin installed from an inline ZIP archive."
    },
    "HostedSkillResource": {
      "oneOf": [
        {
          "$ref": "#/$defs/HostedSkillResourceSkillReference"
        },
        {
          "$ref": "#/$defs/HostedSkillResourceInline"
        }
      ],
      "x-oai-discriminator-values": [
        "skill_reference",
        "inline"
      ],
      "description": "A skill installed in an OpenAI-hosted environment."
    },
    "HostedSkillResourceInline": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "inline"
          ],
          "default": "inline",
          "x-stainless-const": true,
          "description": "The type of the object. Always `inline`."
        },
        "name": {
          "type": "string",
          "minLength": 0,
          "description": "The installed skill name."
        },
        "description": {
          "type": "string",
          "minLength": 0,
          "description": "The installed skill description."
        }
      },
      "required": [
        "type",
        "name",
        "description"
      ],
      "additionalProperties": false,
      "description": "A skill installed from an inline ZIP archive."
    },
    "HostedSkillResourceSkillReference": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "skill_reference"
          ],
          "default": "skill_reference",
          "x-stainless-const": true,
          "description": "The type of the object. Always `skill_reference`."
        },
        "skill_id": {
          "type": "string",
          "minLength": 0,
          "description": "The referenced skill ID."
        },
        "version": {
          "type": "string",
          "minLength": 0,
          "description": "The concrete skill version installed for this session."
        },
        "name": {
          "type": "string",
          "minLength": 0,
          "description": "The installed skill name."
        },
        "description": {
          "type": "string",
          "minLength": 0,
          "description": "The installed skill description."
        }
      },
      "required": [
        "type",
        "skill_id",
        "version",
        "name",
        "description"
      ],
      "additionalProperties": false,
      "description": "A skill installed from the Skills API."
    },
    "InputTokensDetailsResource": {
      "type": "object",
      "properties": {
        "cached_tokens": {
          "type": "integer",
          "format": "int64",
          "description": "The number of input tokens retrieved from the prompt cache."
        }
      },
      "required": [
        "cached_tokens"
      ],
      "additionalProperties": false,
      "description": "A breakdown of input token usage for a session or turn."
    },
    "McpConnectionOriginResource": {
      "type": "string",
      "enum": [
        "service",
        "environment"
      ],
      "description": "Where outbound MCP HTTP connections originate."
    },
    "McpTransportResource": {
      "oneOf": [
        {
          "$ref": "#/$defs/McpTransportResourceHttp"
        },
        {
          "$ref": "#/$defs/McpTransportResourceStdio"
        }
      ],
      "x-oai-discriminator-values": [
        "http",
        "stdio"
      ],
      "description": "The transport used to connect to an MCP server."
    },
    "McpTransportResourceHttp": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "http"
          ],
          "default": "http",
          "x-stainless-const": true,
          "description": "The type of the object. Always `http`."
        },
        "server_url": {
          "type": "string",
          "minLength": 0,
          "description": "The URL of the MCP server."
        }
      },
      "required": [
        "type",
        "server_url"
      ],
      "additionalProperties": false,
      "description": "Connects to an MCP server over HTTP."
    },
    "McpTransportResourceStdio": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "stdio"
          ],
          "default": "stdio",
          "x-stainless-const": true,
          "description": "The type of the object. Always `stdio`."
        },
        "command": {
          "type": "string",
          "minLength": 0,
          "description": "The command used to start the MCP server."
        },
        "args": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 0
          },
          "minItems": 0,
          "maxItems": 2000,
          "description": "Arguments passed to the MCP server command."
        },
        "cwd": {
          "type": "string",
          "minLength": 0,
          "description": "The working directory used to start the MCP server."
        },
        "env_vars": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 0
          },
          "minItems": 0,
          "maxItems": 2000,
          "description": "Environment variable names inherited from the execution environment."
        }
      },
      "required": [
        "type",
        "command",
        "args",
        "cwd",
        "env_vars"
      ],
      "additionalProperties": false,
      "description": "Starts an MCP server as a local process."
    },
    "MultiAgentConfigResource": {
      "type": "object",
      "properties": {
        "enabled": {
          "type": "boolean",
          "description": "Whether subagent tools are enabled. Defaults to false."
        },
        "max_concurrent_subagents": {
          "type": [
            "integer",
            "null"
          ],
          "format": "int64",
          "minimum": 1,
          "maximum": 4294967295,
          "description": "Maximum number of subagents that may run concurrently, or null when disabled. Defaults to 6 when enabled."
        }
      },
      "required": [
        "enabled",
        "max_concurrent_subagents"
      ],
      "additionalProperties": false,
      "description": "The resolved configuration for creating and coordinating subagents."
    },
    "NetworkAccessResource": {
      "type": "string",
      "enum": [
        "enabled",
        "disabled",
        "restricted"
      ],
      "x-enumDescriptions": [
        "Allows unrestricted network access.",
        "Disables network access.",
        "Allows access only to configured domains."
      ],
      "description": "The network access mode for an OpenAI-hosted environment."
    },
    "NetworkPolicyResource": {
      "type": "object",
      "properties": {
        "access": {
          "$ref": "#/$defs/NetworkAccessResource",
          "description": "The environment's network access mode."
        },
        "allowed_domains": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 0
          },
          "minItems": 0,
          "maxItems": 2000,
          "description": "Domains the environment may access when network access is restricted."
        }
      },
      "required": [
        "access",
        "allowed_domains"
      ],
      "additionalProperties": false,
      "description": "Network access for an OpenAI-hosted environment."
    },
    "OutputTokensDetailsResource": {
      "type": "object",
      "properties": {
        "reasoning_tokens": {
          "type": "integer",
          "format": "int64",
          "description": "The number of output tokens used for reasoning."
        }
      },
      "required": [
        "reasoning_tokens"
      ],
      "additionalProperties": false,
      "description": "A breakdown of output token usage for a session or turn."
    },
    "ReasoningEffortResource": {
      "type": "string",
      "enum": [
        "none",
        "minimal",
        "low",
        "medium",
        "high",
        "xhigh",
        "max"
      ],
      "description": "The amount of reasoning effort used by an agent."
    },
    "ReasoningResource": {
      "type": "object",
      "properties": {
        "effort": {
          "anyOf": [
            {
              "$ref": "#/$defs/ReasoningEffortResource"
            },
            {
              "type": "null"
            }
          ],
          "description": "The requested reasoning effort, or `null` when the model selects its own default."
        },
        "summary": {
          "anyOf": [
            {
              "$ref": "#/$defs/ReasoningSummaryResource"
            },
            {
              "type": "null"
            }
          ],
          "description": "The requested reasoning summary format, or `null` when summaries are disabled."
        }
      },
      "required": [
        "effort",
        "summary"
      ],
      "additionalProperties": false,
      "description": "The reasoning configuration used by an agent."
    },
    "ReasoningSummaryResource": {
      "type": "string",
      "enum": [
        "concise",
        "detailed",
        "auto"
      ],
      "x-enumDescriptions": [
        "Returns a concise reasoning summary when supported.",
        "Returns a detailed reasoning summary when supported.",
        "Automatically selects the most detailed summary supported by the model."
      ],
      "description": "The reasoning summary format requested from an agent."
    },
    "ServiceTierResource": {
      "type": "string",
      "enum": [
        "auto",
        "default",
        "flex",
        "priority",
        "fast"
      ],
      "description": "The service-tier policy configured for an agent."
    },
    "SessionAgentResource": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "minLength": 0,
          "description": "The ID of the agent."
        },
        "name": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 0,
          "description": "The reusable agent's name when the session was created, or null if no name was saved. Later changes to the agent's name do not affect this value."
        },
        "model": {
          "type": "string",
          "minLength": 0,
          "description": "The model used by the agent."
        },
        "reasoning": {
          "$ref": "#/$defs/ReasoningResource",
          "description": "The agent's reasoning configuration."
        },
        "text": {
          "$ref": "#/$defs/TextResource",
          "description": "Configuration for text generated by the agent."
        },
        "service_tier": {
          "$ref": "#/$defs/ServiceTierResource",
          "description": "The effective service-tier policy for model requests. Defaults to `auto`."
        },
        "instructions": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 0,
          "description": "Custom instructions appended to the agent's default base instructions."
        },
        "tools": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AgentToolResource"
          },
          "minItems": 0,
          "maxItems": 2000,
          "description": "Tools available to the agent."
        },
        "multi_agent": {
          "$ref": "#/$defs/MultiAgentConfigResource",
          "description": "Configuration for creating and coordinating subagents."
        }
      },
      "required": [
        "id",
        "name",
        "model",
        "reasoning",
        "text",
        "service_tier",
        "instructions",
        "tools",
        "multi_agent"
      ],
      "additionalProperties": false,
      "description": "The effective agent configuration for a session."
    },
    "SessionRequiredActionResource": {
      "oneOf": [
        {
          "$ref": "#/$defs/SessionRequiredActionResourceFunctionCall"
        },
        {
          "$ref": "#/$defs/SessionRequiredActionResourceEnvironmentConnection"
        }
      ],
      "x-oai-discriminator-values": [
        "function_call",
        "environment_connection"
      ],
      "description": "An action that must be completed before a session can continue."
    },
    "SessionRequiredActionResourceEnvironmentConnection": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "environment_connection"
          ],
          "default": "environment_connection",
          "x-stainless-const": true,
          "description": "The type of the object. Always `environment_connection`."
        },
        "environment_id": {
          "type": "string",
          "minLength": 0,
          "description": "The ID of the environment to reconnect."
        }
      },
      "required": [
        "type",
        "environment_id"
      ],
      "additionalProperties": false,
      "description": "Reconnect a session environment."
    },
    "SessionRequiredActionResourceFunctionCall": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "function_call"
          ],
          "default": "function_call",
          "x-stainless-const": true,
          "description": "The type of the object. Always `function_call`."
        },
        "turn_id": {
          "type": "string",
          "minLength": 0,
          "description": "The ID of the turn that requested the function call."
        },
        "call_id": {
          "type": "string",
          "minLength": 0,
          "description": "The ID to include when submitting the function result."
        },
        "name": {
          "type": "string",
          "minLength": 0,
          "description": "The function name."
        },
        "arguments": {
          "description": "The arguments supplied by the model."
        }
      },
      "required": [
        "type",
        "turn_id",
        "call_id",
        "name",
        "arguments"
      ],
      "additionalProperties": false,
      "description": "Run a function tool and submit its result."
    },
    "SessionStatusResource": {
      "type": "string",
      "enum": [
        "idle",
        "in_progress",
        "requires_action",
        "failed"
      ],
      "x-enumDescriptions": [
        "The session has no turn in progress and is ready for input. A hosted environment may still be provisioning.",
        "The session is processing a turn.",
        "The session is waiting for one or more required actions.",
        "The session failed."
      ],
      "description": "The current status of a session."
    },
    "TextFormatResource": {
      "oneOf": [
        {
          "$ref": "#/$defs/TextFormatResourceText"
        },
        {
          "$ref": "#/$defs/TextFormatResourceJsonSchema"
        }
      ],
      "x-oai-discriminator-values": [
        "text",
        "json_schema"
      ],
      "description": "The effective output format for generated text."
    },
    "TextFormatResourceJsonSchema": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "json_schema"
          ],
          "default": "json_schema",
          "x-stainless-const": true,
          "description": "The type of the object. Always `json_schema`."
        },
        "schema": {
          "type": "object",
          "additionalProperties": {},
          "propertyNames": {
            "type": "string",
            "minLength": 0
          },
          "minProperties": 0,
          "description": "The JSON Schema that generated text must match."
        }
      },
      "required": [
        "type",
        "schema"
      ],
      "additionalProperties": false,
      "description": "Constrains generated text to a JSON Schema."
    },
    "TextFormatResourceText": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "text"
          ],
          "default": "text",
          "x-stainless-const": true,
          "description": "The type of the object. Always `text`."
        }
      },
      "required": [
        "type"
      ],
      "additionalProperties": false,
      "description": "Generates ordinary text without a structured-output constraint."
    },
    "TextResource": {
      "type": "object",
      "properties": {
        "format": {
          "$ref": "#/$defs/TextFormatResource",
          "description": "The effective output format. Defaults to ordinary text."
        },
        "verbosity": {
          "$ref": "#/$defs/VerbosityResource",
          "description": "The amount of text produced by the agent. Defaults to `medium`."
        }
      },
      "required": [
        "format",
        "verbosity"
      ],
      "additionalProperties": false,
      "description": "The text configuration used by an agent."
    },
    "TokenUsageResource": {
      "type": "object",
      "properties": {
        "input_tokens": {
          "type": "integer",
          "format": "int64",
          "description": "The number of input tokens used by the agent."
        },
        "input_tokens_details": {
          "$ref": "#/$defs/InputTokensDetailsResource",
          "description": "A breakdown of the agent's input token usage."
        },
        "output_tokens": {
          "type": "integer",
          "format": "int64",
          "description": "The number of output tokens generated by the agent."
        },
        "output_tokens_details": {
          "$ref": "#/$defs/OutputTokensDetailsResource",
          "description": "A breakdown of the agent's output token usage."
        },
        "total_tokens": {
          "type": "integer",
          "format": "int64",
          "description": "The total number of input and output tokens used by the agent."
        }
      },
      "required": [
        "input_tokens",
        "input_tokens_details",
        "output_tokens",
        "output_tokens_details",
        "total_tokens"
      ],
      "additionalProperties": false,
      "description": "Recorded token usage for a session or turn. Usage is best effort and may change."
    },
    "VerbosityResource": {
      "type": "string",
      "enum": [
        "low",
        "medium",
        "high"
      ],
      "description": "The amount of text produced by an agent."
    },
    "WebSearchContextSizeResource": {
      "type": "string",
      "enum": [
        "low",
        "medium",
        "high"
      ],
      "description": "The amount of web search context made available to the model."
    },
    "WebSearchLocationResource": {
      "type": "object",
      "properties": {
        "country": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 0,
          "description": "The two-letter ISO country code, such as `US`."
        },
        "region": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 0,
          "description": "The region or state name."
        },
        "city": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 0,
          "description": "The city name."
        },
        "timezone": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 0,
          "description": "The IANA timezone, such as `America/Los_Angeles`."
        }
      },
      "required": [
        "country",
        "region",
        "city",
        "timezone"
      ],
      "additionalProperties": false,
      "description": "Approximate user location used to localize web search results."
    },
    "WebSearchModeResource": {
      "type": "string",
      "enum": [
        "disabled",
        "cached",
        "live"
      ],
      "description": "The source used for web search results."
    }
  }
}