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

List agent environments

GET
/agents/environments

Lists OpenAI-hosted environments owned by the authenticated principal. Requires access to the prewarming beta.

List agent environments

curl https://api.openai.com/v1/agents/environments \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"
200 — Example
{
  "data": [
    {
      "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"
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id",
  "object": "list"
}
Query Parameters
after: optional string

Return resources after this resource ID in the selected order.

minLength0
maxLength1048576
limit: optional integer (default: 20)

The maximum number of resources to return, between 1 and 100. Defaults to 20.

formatint64
minimum1
maximum100
order: optional "asc" or "desc" (default: "desc")

The order in which resources are returned. Defaults to desc.

One of the following:
"asc"

Returns resources in ascending order.

"desc"

Returns resources in descending order.

type: optional "openai_hosted"

The hosting type to list. Defaults to openai_hosted.

Returns
data: array of EnvironmentInfo { id, files, object, 4 more }

The resources returned in this page, in the requested sort order.

minItems0
maxItems2000
id: string

The ID of the environment.

minLength0
files: array of HostedEnvironmentFile

Files installed in the environment, without their contents.

minItems0
maxItems2000
One of the following:
HostedEnvironmentFileID object { id, file_id, path, 2 more }

A file copied from the OpenAI Files API.

id: string

The session-scoped ID of the file in the execution environment.

minLength0
file_id: string

The ID of the uploaded file.

minLength0
path: string

The file’s absolute path inside the environment.

minLength0
size_bytes: integer

The decoded file size in bytes.

formatint64
minimum0
type: "file_id" (default: "file_id")

The type of the object. Always file_id.

Inline object { id, path, size_bytes, type }

A file supplied inline when the session was created.

id: string

The session-scoped ID of the file in the execution environment.

minLength0
path: string

The file’s absolute path inside the environment.

minLength0
size_bytes: integer

The decoded file size in bytes.

formatint64
minimum0
type: "inline" (default: "inline")

The type of the object. Always inline.

object: "agent.environment" (default: "agent.environment")

The object type. Always agent.environment.

plugins: array of HostedPlugin { description, name, type }

Plugins installed in the environment, without their archive contents.

minItems0
maxItems2000
description: string

The installed plugin description.

minLength0
name: string

The installed plugin name.

minLength0
type: "inline" (default: "inline")

The type of the object. Always inline.

skills: array of HostedSkill

Skills installed in the environment, without their archive contents.

minItems0
maxItems2000
One of the following:
HostedSkillReference object { description, name, skill_id, 2 more }

A skill installed from the Skills API.

description: string

The installed skill description.

minLength0
name: string

The installed skill name.

minLength0
skill_id: string

The referenced skill ID.

minLength0
type: "skill_reference" (default: "skill_reference")

The type of the object. Always skill_reference.

version: string

The concrete skill version installed for this session.

minLength0
Inline object { description, name, type }

A skill installed from an inline ZIP archive.

description: string

The installed skill description.

minLength0
name: string

The installed skill name.

minLength0
type: "inline" (default: "inline")

The type of the object. Always inline.

status: "pending" or "ready" or "connected" or 4 more

The current environment connection status.

One of the following:
"pending"
"ready"

Provisioning succeeded and the environment is available for attachment or use.

"connected"
"disconnected"
"suspended"

The sandbox is stopped and can be resumed from its private checkpoint.

"expired"
"failed"
type: "openai_hosted" or "self_hosted"

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

One of the following:
"openai_hosted"
"self_hosted"
first_id: string or null

The ID of the first resource in data, or null if the page is empty.

minLength0
has_more: boolean

Whether there are more resources to retrieve after this page.

last_id: string or null

The ID of the last resource in data, or null if the page is empty. Pass this as after with the same order and filters.

minLength0
object: "list" (default: "list")

The object type, which is always list.

Returns Examples
200 — Example
{
  "data": [
    {
      "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"
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id",
  "object": "list"
}