Skip to content
For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to the page URL.
Primary navigation
Theme

Create an agent environment

beta.agents.environments.create(**kwargs) -> EnvironmentInfo { id, files, object, 4 more }
POST
/agents/environments

Creates an OpenAI-hosted environment before creating a session. Requires access to the prewarming beta.

Parameters
environment: Environment{ type, capability_directories, desktop, 8 more}

The required hosting type and its configuration.

vault_ids: Array[String]

The IDs of up to 10 vaults made available to an OpenAI-hosted environment.

minItems0
maxItems10
idempotency_key: String
minLength1
maxLength256
Returns
class EnvironmentInfo { id, files, object, 4 more }

Safe metadata for a first-class execution environment.

id: String

The ID of the environment.

minLength0
files: Array[HostedEnvironmentFile]

Files installed in the environment, without their contents.

minItems0
maxItems2000
object: :"agent.environment"

The object type. Always agent.environment.

plugins: Array[HostedPlugin { description, name, type } ]

Plugins installed in the environment, without their archive contents.

minItems0
maxItems2000
skills: Array[HostedSkill]

Skills installed in the environment, without their archive contents.

minItems0
maxItems2000
status: :pending | :ready | :connected | 4 more

The current environment connection status.

type: :openai_hosted | :self_hosted

Whether the environment is hosted by OpenAI or by the application.

Create an agent environment

require "openai"

openai = OpenAI::Client.new(api_key: "My API Key")

environment_info = openai.beta.agents.environments.create(environment: {type: :openai_hosted})

puts(environment_info)
201 — Example
{
  "id": "id",
  "files": [
    {
      "id": "id",
      "file_id": "file_id",
      "path": "path",
      "size_bytes": 0,
      "type": "file_id"
    }
  ],
  "object": "agent.environment",
  "plugins": [
    {
      "description": "description",
      "name": "name",
      "type": "inline"
    }
  ],
  "skills": [
    {
      "description": "description",
      "name": "name",
      "skill_id": "skill_id",
      "type": "skill_reference",
      "version": "version"
    }
  ],
  "status": "pending",
  "type": "openai_hosted"
}
Returns Examples
201 — Example
{
  "id": "id",
  "files": [
    {
      "id": "id",
      "file_id": "file_id",
      "path": "path",
      "size_bytes": 0,
      "type": "file_id"
    }
  ],
  "object": "agent.environment",
  "plugins": [
    {
      "description": "description",
      "name": "name",
      "type": "inline"
    }
  ],
  "skills": [
    {
      "description": "description",
      "name": "name",
      "skill_id": "skill_id",
      "type": "skill_reference",
      "version": "version"
    }
  ],
  "status": "pending",
  "type": "openai_hosted"
}