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(ctx, query) (*CursorPage[EnvironmentInfo], error)
GET
/agents/environments

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

Parameters
query BetaAgentEnvironmentListParams
After param.Field[string]
Optional

Return resources after this resource ID in the selected order.

minLength0
maxLength1048576
Limit param.Field[int64]
Optional

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

formatint64
minimum1
maximum100
Order param.Field[BetaAgentEnvironmentListParamsOrder]
Optional

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

Type param.Field[BetaAgentEnvironmentListParamsType]
Optional

The hosting type to list. Defaults to openai_hosted.

Returns
type EnvironmentInfo struct{…}

Safe metadata for a first-class execution environment.

ID string

The ID of the environment.

minLength0

Files installed in the environment, without their contents.

minItems0
maxItems2000
Object AgentEnvironment

The object type. Always agent.environment.

Plugins []HostedPlugin

Plugins installed in the environment, without their archive contents.

minItems0
maxItems2000

Skills installed in the environment, without their archive contents.

minItems0
maxItems2000
Status EnvironmentInfoStatus

The current environment connection status.

Type EnvironmentInfoType

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

List agent environments

package main

import (
  "context"
  "fmt"

  "github.com/openai/openai-go"
  "github.com/openai/openai-go/option"
)

func main() {
  client := openai.NewClient(
    option.WithAPIKey("My API Key"),
  )
  page, err := client.Beta.Agents.Environments.List(context.TODO(), openai.BetaAgentEnvironmentListParams{

  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", page)
}
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"
}