OpenAI 获取会话子智能体
get /agents/sessions/{session_id}/subagents/{subagent_id}
获取属于此会话的子智能体。参见子智能体工作流。
路径参数
session_id: string
会话 ID。
minLength: 0, maxLength: 1048576
subagent_id: string
此会话中的子智能体 ID。
minLength: 0, maxLength: 1048576
返回值
Subagent object { id, closed_at, instructions, 6 more }
在会话中创建的子智能体。
id: string
子智能体 ID。
minLength: 0
closed_at: integer or null
子智能体关闭时的 Unix 时间戳,单位为秒。子智能体活动期间为 null,恢复运行后也适用。
format: int64
instructions: array of AgentContent or null
初始任务内容。无法取得时为 null。仅能提供预览时,文本可包含图像或音频的占位符。
minItems: 0, maxItems: 2000
OutputText object { text, type }
智能体生成的一段文本内容。
text: string
智能体生成的文本。
minLength: 0
type: "output_text" (default: "output_text")
内容类型,固定为 output_text。
"output_text"
EncryptedContent object { encrypted_content, type }
智能体之间交换的加密内容。
encrypted_content: string
加密内容载荷。
minLength: 0
type: "encrypted_content" (default: "encrypted_content")
内容类型,固定为 encrypted_content。
"encrypted_content"
name: string or null
运行器分配的昵称。无法取得时为 null。
minLength: 0
object: "agent.session.subagent" (default: "agent.session.subagent")
对象类型,固定为 agent.session.subagent。
"agent.session.subagent"
opened_at: integer
子智能体首次打开时的 Unix 时间戳,单位为秒。恢复运行时此值保持不变。
format: int64
parent_agent_id: string
创建此子智能体的智能体 ID。
minLength: 0
session_id: string
所属会话的 ID。
minLength: 0
status: "active" or "closed"
子智能体当前的状态。
"active"
子智能体仍可使用,包括在两轮之间空闲时。
"closed"
子智能体已关闭。
示例
## 从环境变量读取 API 密钥。
## 将 SESSION_ID 设置为目标会话的 ID。
## 将 SUBAGENT_ID 设置为目标子智能体的 ID。
curl https://api.openai.com/v1/agents/sessions/$SESSION_ID/subagents/$SUBAGENT_ID \
-H 'OpenAI-Beta: agents=v1' \
-H "Authorization: Bearer $OPENAI_API_KEY"
200 响应示例
字段名、类型值和示例标识均按接口定义保留。
{
"id": "id",
"closed_at": 0,
"instructions": [
{
"text": "text",
"type": "output_text"
}
],
"name": "name",
"object": "agent.session.subagent",
"opened_at": 0,
"parent_agent_id": "parent_agent_id",
"session_id": "session_id",
"status": "active"
}
需要查看其交互进度时,可列出子智能体轮次。

TRAE-AI编程


更多建议: