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

client.beta.agents.environments.list(query?, options?): CursorPage<EnvironmentInfo { id, files, object, 4 more } >
GET
/agents/environments

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

Parameters
query: EnvironmentListParams { after, limit, order, type }
after?: string

Return resources after this resource ID in the selected order.

minLength0
maxLength1048576
limit?: number

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

formatint64
minimum1
maximum100
order?: "asc" | "desc"

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

type?: "openai_hosted"

The hosting type to list. Defaults to openai_hosted.

Returns
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.

List agent environments

import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});

// Automatically fetches more pages as needed.
for await (const environmentInfo of client.beta.agents.environments.list()) {
  console.log(environmentInfo.id);
}
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"
}
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"
}