OpenAI 列出智能体环境
get /agents/environments
列出当前身份验证主体拥有的 OpenAI 托管环境。需要预热 Beta 功能的访问权限。
查询参数
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"
按降序返回资源。
type: optional "openai_hosted"
要列出的托管类型,默认为 openai_hosted。
"openai_hosted"
返回值
data: array of EnvironmentInfo
本页返回的资源,按指定顺序排列。
minItems: 0, maxItems: 2000
id: string
环境 ID。
minLength: 0
files: array of HostedEnvironmentFile
环境中已安装的文件。响应省略文件内容。
minItems: 0, maxItems: 2000
HostedEnvironmentFileID object { id, file_id, path, 2 more }
从 OpenAI Files API 复制的文件。
id: string
执行环境中会话范围内的文件 ID。
minLength: 0
file_id: string
已上传文件的 ID。
minLength: 0
path: string
文件在环境内的绝对路径。
minLength: 0
size_bytes: integer
文件解码后的大小,单位为字节。
format: int64, minimum: 0
type: "file_id" (default: "file_id")
对象类型,固定为 file_id。
"file_id"
Inline object { id, path, size_bytes, type }
创建会话时以内联方式提供的文件。
id: string
执行环境中会话范围内的文件 ID。
minLength: 0
path: string
文件在环境内的绝对路径。
minLength: 0
size_bytes: integer
文件解码后的大小,单位为字节。
format: int64, minimum: 0
type: "inline" (default: "inline")
对象类型,固定为 inline。
"inline"
object: "agent.environment" (default: "agent.environment")
对象类型,固定为 agent.environment。
"agent.environment"
plugins: array of HostedPlugin
环境中已安装的插件。响应省略归档内容。
minItems: 0, maxItems: 2000
description: string
已安装插件的描述。
minLength: 0
name: string
已安装插件的名称。
minLength: 0
type: "inline" (default: "inline")
对象类型,固定为 inline。
"inline"
skills: array of HostedSkill
环境中已安装的技能。响应省略归档内容。
minItems: 0, maxItems: 2000
HostedSkillReference object { description, name, skill_id, 2 more }
从 Skills API 安装的技能。
description: string
已安装技能的描述。
minLength: 0
name: string
已安装技能的名称。
minLength: 0
skill_id: string
引用的技能 ID。
minLength: 0
type: "skill_reference" (default: "skill_reference")
对象类型,固定为 skill_reference。
"skill_reference"
version: string
此会话实际安装的技能版本。
minLength: 0
Inline object { description, name, type }
从内联 ZIP 归档安装的技能。
description: string
已安装技能的描述。
minLength: 0
name: string
已安装技能的名称。
minLength: 0
type: "inline" (default: "inline")
对象类型,固定为 inline。
"inline"
status: "pending" or "ready" or "connected" or 4 more
环境当前的连接状态。
"pending"
"ready"
环境已成功配置,可附加到会话或投入使用。
"connected"
"disconnected"
"suspended"
沙箱已停止,可从其私有检查点恢复。
"expired"
"failed"
type: "openai_hosted" or "self_hosted"
环境由 OpenAI 还是由应用托管。
"openai_hosted"
"self_hosted"
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 \
-H 'OpenAI-Beta: agents=v1' \
-H "Authorization: Bearer $OPENAI_API_KEY"
200 响应示例
字段名、类型值和示例标识均按接口定义保留。
{
"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"
}
TRAE-AI编程


更多建议: