OpenAI 列出智能体环境模板

2026-11-18 17:53 更新

get /agents/environments/templates

列出可复用的环境模板。响应省略机密值。参见复用托管配置。

查询参数

  • after: optional string

按选定顺序返回此资源 ID 之后的资源。

minLength: 0, maxLength: 1048576

  • limit: optional integer (default: 20)

返回资源的最大数量,范围为 1 至 100,默认为 20。

format: int64, minimum: 1, maximum: 100

  • order: optional "asc" or "desc" (default: "desc")

返回资源的排序方式,默认为 desc。

  • "asc"

按升序返回资源。

  • "desc"

按降序返回资源。

返回值

  • data: array of EnvironmentTemplate

本页返回的资源,按指定顺序排列。

minItems: 0, maxItems: 2000

  • id: string

可复用的环境模板 ID。

minLength: 0

  • capability_directories: array of string

用于向智能体提供能力的目录。

minItems: 0, maxItems: 2000

  • created_at: integer

模板创建时的 Unix 时间戳,单位为秒。

format: int64

  • desktop: object { enabled }

每个 OpenAI 托管环境的桌面配置。

  • enabled: boolean

环境是否配置桌面及浏览器代理。

  • files: array of FileID { file_id, path, type } or Inline { path, size_bytes, type }

可返回的文件元数据,省略文件内容和会话范围的文件 ID。

minItems: 0, maxItems: 50

  • FileID object { file_id, path, type }

项目范围内的 Files API 引用,每个会话独立解析。

  • file_id: string

已上传文件的 ID。

minLength: 0

  • path: string

文件在环境内的绝对路径。

minLength: 0

  • type: "file_id" (default: "file_id")

对象类型,固定为 file_id。

  • "file_id"

  • Inline object { path, size_bytes, type }

机密内联文件内容的元数据。

  • path: string

文件在环境内的绝对路径。

minLength: 0

  • size_bytes: integer

内联文件解码后的大小,单位为字节。

format: int64, minimum: 0

  • type: "inline" (default: "inline")

对象类型,固定为 inline。

  • "inline"

  • name: string or null

模板的可选显示名称。

minLength: 0

  • network: object { access, allowed_domains }

每个 OpenAI 托管环境的运行时网络访问配置。

  • access: "enabled" or "disabled" or "restricted"

环境的网络访问模式。

  • "enabled"

允许不受限制的网络访问。

  • "disabled"

关闭网络访问。

  • "restricted"

应用配置的域名访问限制。

  • allowed_domains: array of string

网络访问受限时,环境可以访问的域名。

minItems: 0, maxItems: 2000

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

对象类型,固定为 agent.environment.template。

  • "agent.environment.template"

  • packages: object { npm, python, system }

每次新建 OpenAI 托管环境时安装的软件包。

  • npm: array of string

在环境中全局安装的 npm 软件包。

minItems: 0, maxItems: 16384

  • python: array of string

已安装到环境中的 Python 软件包。

minItems: 0, maxItems: 16384

  • system: array of string

已安装到环境中的系统软件包。

minItems: 0, maxItems: 16384

  • plugins: array of HostedPlugin

可返回的插件元数据,省略内联归档内容。

minItems: 0, maxItems: 32

  • description: string

已安装插件的描述。

minLength: 0

  • name: string

已安装插件的名称。

minLength: 0

  • type: "inline" (default: "inline")

对象类型,固定为 inline。

  • "inline"

  • skills: array of SkillReference { skill_id, type, version } or Inline { description, name, type }

可返回的技能元数据,保留尚未解析的版本选择值。

minItems: 0, maxItems: 200

  • SkillReference object { skill_id, type, version }

每次启动会话时都通过 Skills API 重新解析的技能。

  • skill_id: string

引用的技能 ID。

minLength: 0

  • type: "skill_reference" (default: "skill_reference")

对象类型,固定为 skill_reference。

  • "skill_reference"

  • version: string or null

请求的版本选择值,包含 latest 选项。

minLength: 0

  • Inline object { description, name, type }

可以安全返回的内联技能归档元数据。

  • description: string

SKILL.md 中声明的技能描述。

minLength: 0

  • name: string

SKILL.md 中声明的技能名称。

minLength: 0

  • type: "inline" (default: "inline")

对象类型,固定为 inline。

  • "inline"

  • updated_at: integer

模板上次更新时的 Unix 时间戳,单位为秒。

format: int64

  • first_id: string or null

data 中第一项的资源 ID。当前页为空时为 null。

minLength: 0

  • has_more: boolean

当前页之后是否还有可获取的资源。

  • last_id: string or null

data 中最后一项的资源 ID。当前页为空时为 null。翻页时,将它作为 after 传入,并保持排序和筛选条件一致。

minLength: 0

  • object: "list" (default: "list")

对象类型,恒为 list。

  • "list"

示例

## 从环境变量读取 API 密钥。
curl https://api.openai.com/v1/agents/environments/templates \
    -H 'OpenAI-Beta: agents=v1' \
    -H "Authorization: Bearer $OPENAI_API_KEY"

200 响应示例

字段名、类型值和示例标识均按接口定义保留。

{
  "data": [
    {
      "id": "id",
      "capability_directories": [
        "string"
      ],
      "created_at": 0,
      "desktop": {
        "enabled": true
      },
      "files": [
        {
          "file_id": "file_id",
          "path": "path",
          "type": "file_id"
        }
      ],
      "name": "name",
      "network": {
        "access": "enabled",
        "allowed_domains": [
          "string"
        ]
      },
      "object": "agent.environment.template",
      "packages": {
        "npm": [
          "string"
        ],
        "python": [
          "string"
        ],
        "system": [
          "string"
        ]
      },
      "plugins": [
        {
          "description": "description",
          "name": "name",
          "type": "inline"
        }
      ],
      "skills": [
        {
          "skill_id": "skill_id",
          "type": "skill_reference",
          "version": "version"
        }
      ],
      "updated_at": 0
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id",
  "object": "list"
}
以上内容是否对您有帮助:
在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号