OpenAI 列出自动化调用记录
get /agents/automations/{automation_id}/invocations
列出项目所拥有的自动化任务的投递记录。
路径参数
automation_id: string
minLength: 0, maxLength: 1048576
查询参数
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 AutomationInvocation
本页返回的资源,按指定顺序排列。
minItems: 0, maxItems: 2000
id: string
调用 ID。
minLength: 0
automation_id: string
此调用所属的自动化任务。
minLength: 0
created_at: integer
创建时间的 Unix 时间戳,单位为秒。
format: int64
error: object { code, message } or null
不可恢复的投递失败信息。未发生失败时为 null。
code: string
机器可读的错误代码。
minLength: 0
message: string
对投递失败原因的公开说明。
minLength: 0
object: "agent.automation.invocation" (default: "agent.automation.invocation")
固定为 agent.automation.invocation。
"agent.automation.invocation"
scheduled_at: integer or null
预定触发时间的 Unix 时间戳,单位为秒。手动运行时为 null。
format: int64
session_id: string or null
目标会话或新建会话的 ID。会话尚未确定时为 null。
minLength: 0
skip_reason: "pending_delivery" or null (default: "pending_delivery")
本次触发被跳过的原因。未跳过时为 null。
"pending_delivery"
source: AutomationInvocationSource
该调用是手动触发还是按计划触发。
Manual object { type }
type: "manual" (default: "manual")
对象类型,固定为 manual。
"manual"
Automation object { automation, type }
automation: Automation
本次触发时的自动化任务快照,返回内容省略机密值。
PeriodicAutomation object { id, created_at, created_by, 9 more }
周期性和一次性自动化任务共有的字段。
id: string
自动化任务 ID。
minLength: 0
created_at: integer
创建时间的 Unix 时间戳,单位为秒。
format: int64
created_by: AutomationCreatedBy
服务记录的来源信息,调用方不能设置此字段。
Developer object { type }
type: "developer" (default: "developer")
对象类型,固定为 developer。
"developer"
Agent object { session_id, tool_call_id, type }
session_id: string
创建该自动化任务的会话,也是任务的目标会话。
minLength: 0
tool_call_id: string
创建自动化任务的工具调用。
minLength: 0
type: "agent" (default: "agent")
对象类型,固定为 agent。
"agent"
expression: string
确定计划触发时间的 cron 表达式。
minLength: 0
metadata: map[string]
附加到自动化任务的自定义字符串键值对。
name: string
自动化任务的显示名称。
minLength: 0
object: "agent.automation" (default: "agent.automation")
固定为 agent.automation。
"agent.automation"
status: "active" or "paused"
计划投递处于活动还是暂停状态。
"active"
"paused"
target: AutomationTarget
接收调用投递的会话配置或现有会话。
NewSession object { agent, agent_id, environment, 4 more }
agent: AutomationAgentConfig or null
内联智能体配置。配置了 agent_id 时为 null。
instructions: string or null
自定义指令。未设置时为 null。
minLength: 0
model: string
请求的模型名称。
minLength: 0
multi_agent: MultiAgentConfig
创建和协调子智能体的配置。
enabled: boolean
是否启用子智能体工具。默认关闭。
max_concurrent_subagents: integer or null
可同时运行的子智能体数上限。禁用时为 null,启用时默认为 6。
format: int64, minimum: 1, maximum: 4294967295
reasoning: AgentReasoning
配置的推理策略。
effort: "none" or "minimal" or "low" or 4 more or null
请求的推理强度。由模型选择推理强度时为 null。
"none"
"minimal"
"low"
"medium"
"high"
"xhigh"
"max"
summary: "concise" or "detailed" or "auto" or null
请求的推理摘要格式。禁用摘要时为 null。
"concise"
模型支持时,返回简明推理摘要。
"detailed"
模型支持时,返回详细推理摘要。
"auto"
自动选择模型支持的最详细摘要。
service_tier: "auto" or "default" or "flex" or 3 more
配置的服务层级策略。
"auto"
"default"
"flex"
"priority"
"fast"
"ultrafast"
text: AgentText
配置的输出格式和详细程度。
format: TextFormat
当前生效的输出格式,默认为普通文本。
Text object { type }
生成普通文本,无结构化输出限制。
type: "text" (default: "text")
对象类型,恒为 text。
"text"
JSONSchema object { schema, type }
将生成的文本限制为符合指定 JSON Schema。
schema: map[unknown]
生成的文本必须符合的 JSON Schema。
type: "json_schema" (default: "json_schema")
对象类型,恒为 json_schema。
"json_schema"
verbosity: "low" or "medium" or "high"
智能体生成文本的量。默认为 medium。
"low"
"medium"
"high"
tools: array of AgentTool
已配置的工具,返回内容省略机密凭证。
minItems: 0, maxItems: 2000
Function object { defer_loading, description, name, 3 more }
应用定义的函数。
defer_loading: boolean
函数是否延迟加载并通过工具搜索发现。
description: string
说明函数的用途。
minLength: 0
name: string
函数名称。
minLength: 0
parameters: map[unknown]
描述函数参数的 JSON Schema 对象。
type: "function" (default: "function")
对象类型,恒为 function。
"function"
async: optional boolean
智能体是否无需等待函数结果即可继续。
ProgrammaticToolCalling object { enabled, type }
允许模型生成的代码调用工具。
enabled: boolean
是否允许从模型生成的代码调用工具。
type: "programmatic_tool_calling" (default: "programmatic_tool_calling")
对象类型,恒为 programmatic_tool_calling。
"programmatic_tool_calling"
Mcp object { allowed_tools, connection_origin, credential_id, 5 more }
远程 MCP 服务器提供的工具。
allowed_tools: array of string or null
智能体可调用的 MCP 工具。
minItems: 0, maxItems: 2000
connection_origin: "service" or "environment"
出站 MCP HTTP 连接的来源。
"service"
"environment"
credential_id: string or null
为此 MCP 服务器选用的已附加凭证库凭证(如有)。只有一条已附加凭证与服务器 URL 匹配时,可以省略。
minLength: 0
request_metadata: map[unknown]
随请求发送给此 MCP 服务器的元数据。
required: boolean
是否必须在第一轮前初始化此 MCP 服务器。
server_label: string
用于在工具调用中标识 MCP 服务器的标签。
minLength: 0
transport: McpTransport
用于连接 MCP 服务器的传输方式。
HTTP object { server_url, type }
通过 HTTP 连接到 MCP 服务器。
server_url: string
MCP 服务器的 URL。
minLength: 0
type: "http" (default: "http")
对象类型,恒为 http。
"http"
Stdio object { args, command, cwd, 2 more }
以本地进程方式启动 MCP 服务器。
args: array of string
传递给 MCP 服务器启动命令的参数。
minItems: 0, maxItems: 2000
command: string
用于启动 MCP 服务器的命令。
minLength: 0
cwd: string
用于启动 MCP 服务器的工作目录。
minLength: 0
env_vars: array of string
从执行环境继承的环境变量名称。
minItems: 0, maxItems: 2000
type: "stdio" (default: "stdio")
对象类型,恒为 stdio。
"stdio"
type: "mcp" (default: "mcp")
对象类型,恒为 mcp。
"mcp"
WebSearch object { allowed_domains, context_size, location, 2 more }
网页搜索。
allowed_domains: array of string or null
允许搜索的域名。搜索范围不受限制时为 null。
minItems: 0, maxItems: 2000
context_size: "low" or "medium" or "high"
向模型提供的搜索上下文量。默认为 medium。
"low"
"medium"
"high"
location: object { city, country, region, timezone } or null
用于按地理位置调整搜索结果的近似位置(如果提供)。
city: string or null
城市名称。
minLength: 0
country: string or null
两个字母的 ISO 国家或地区代码,例如 US。
minLength: 0
region: string or null
地区或州的名称。
minLength: 0
timezone: string or null
IANA 时区,例如 America/Los_Angeles。
minLength: 0
mode: "disabled" or "cached" or "live"
网页搜索结果的来源。
"disabled"
"cached"
"live"
type: "web_search" (default: "web_search")
对象类型,恒为 web_search。
"web_search"
ComputerUse object { include_screenshots, type }
在 OpenAI 托管会话中使用浏览器。
include_screenshots: boolean
计算机工具的输出是否包含屏幕截图。
type: "computer_use" (default: "computer_use")
对象类型,恒为 computer_use。
"computer_use"
Automations object { type }
允许智能体安排自身的定时唤醒。
type: "automations" (default: "automations")
对象类型,恒为 automations。
"automations"
compaction: optional object { async }
当前生效的上下文压缩配置。
async: boolean
是否在后台压缩上下文。默认为 false。
experimental: optional object { time_awareness }
当前生效的实验性设置。
time_awareness: boolean
模型是否会定期收到当前时间提醒。
agent_id: string or null
已保存智能体的引用。使用内联智能体配置时为 null。
minLength: 0
environment: AutomationEnvironment
用于选择执行环境的配置或引用。
None object { type }
type: "none" (default: "none")
对象类型,固定为 none。
"none"
OpenAIHosted object { capability_directories, container_size, desktop, 8 more }
托管环境的选择配置。返回内容省略机密的初始化命令和变量。
capability_directories: array of string or null
目录配置的覆盖项。传入 null 时继承模板或创建时的默认值。
minItems: 0, maxItems: 2000
container_size: "small" or "medium" or "large" or null
配置的容器规格。传入 null 时使用创建时的默认规格。
"small"
"medium"
"large"
desktop: object { enabled } or null
桌面配置的覆盖项。传入 null 时继承模板或创建时的默认值。
enabled: boolean
环境是否配置桌面及浏览器代理。
environment_id: string or null
现有环境的引用。配置新环境时为 null。
minLength: 0
environment_template_id: string or null
模板引用。未选用模板时为 null。
minLength: 0
files: array of FileID { file_id, path, type } or Inline { path, size_bytes, type } or null
文件配置的覆盖项,返回内容省略文件正文。传入 null 时继承上级配置。
minItems: 0, maxItems: 2000
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"
network: object { access, allowed_domains } or null
网络配置的覆盖项。传入 null 时继承模板或创建时的默认值。
access: "enabled" or "disabled" or "restricted"
环境的网络访问模式。
"enabled"
允许不受限制的网络访问。
"disabled"
关闭网络访问。
"restricted"
应用配置的域名访问限制。
allowed_domains: array of string
网络访问受限时,环境可以访问的域名。
minItems: 0, maxItems: 2000
packages: object { npm, python, system } or null
软件包配置的覆盖项。传入 null 时继承模板或创建时的默认值。
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 or null
插件配置的覆盖项,返回内容省略归档内容。传入 null 时继承上级配置。
minItems: 0, maxItems: 2000
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 } or null
技能配置的覆盖项,返回内容省略归档内容。传入 null 时继承上级配置。
minItems: 0, maxItems: 2000
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"
type: "openai_hosted" (default: "openai_hosted")
对象类型,固定为 openai_hosted。
"openai_hosted"
SelfHosted object { capability_directories, environment_id, type, workspace_directory }
capability_directories: array of string
用于向智能体提供能力的目录。
minItems: 0, maxItems: 2000
environment_id: string or null
现有的环境注册记录。传入 null 时创建会话专属环境。
minLength: 0
type: "self_hosted" (default: "self_hosted")
对象类型,固定为 self_hosted。
"self_hosted"
workspace_directory: string
环境中的项目绝对路径。
minLength: 0
input: array of object { content, role, type }
向每个新会话投递的初始输入。
minItems: 0, maxItems: 2000
content: array of InputContent
消息内容。
minItems: 0, maxItems: 2000
InputText object { text, type }
记录在会话条目中的文本输入。
text: string
提供给智能体的文本。
minLength: 0
type: "input_text" (default: "input_text")
对象类型,固定为 input_text。
"input_text"
InputImage object { image_url, type }
记录在会话条目中的图像输入。
image_url: string
提供给智能体的图像 URL,可以是以 Base64 编码的 data URL。
minLength: 0
type: "input_image" (default: "input_image")
对象类型,固定为 input_image。
"input_image"
role: "user" (default: "user")
消息作者的角色,固定为 user。
"user"
type: "message" (default: "message")
输入条目类型,固定为 message。
"message"
metadata: map[string]
附加到每个新会话的元数据。
type: "new_session" (default: "new_session")
对象类型,固定为 new_session。
"new_session"
vault_ids: array of string
每个新会话可使用的凭证库。
minItems: 0, maxItems: 2000
ExistingSession object { instructions, session_id, type }
instructions: string
保存的指令,以自动化通知形式投递。
minLength: 0
session_id: string
接收每次调用的会话。
minLength: 0
type: "existing_session" (default: "existing_session")
对象类型,固定为 existing_session。
"existing_session"
timezone: string
用于解释此表达式的时区。
minLength: 0
type: "periodic" (default: "periodic")
对象类型,固定为 periodic。
"periodic"
pause_reason: optional "target_session_failed" or null (default: "target_session_failed")
服务暂停当前计划的原因。其他计划为 null。
"target_session_failed"
OneTimeAutomation object { id, created_at, created_by, 8 more }
周期性和一次性自动化任务共有的字段。
id: string
自动化任务 ID。
minLength: 0
created_at: integer
创建时间的 Unix 时间戳,单位为秒。
format: int64
created_by: AutomationCreatedBy
服务记录的来源信息,调用方不能设置此字段。
metadata: map[string]
附加到自动化任务的自定义字符串键值对。
name: string
自动化任务的显示名称。
minLength: 0
object: "agent.automation" (default: "agent.automation")
固定为 agent.automation。
"agent.automation"
run_at: integer
计划触发时间的 Unix 时间戳,单位为秒。
format: int64
status: "active" or "paused" or "completed"
完成状态表示计划已结束。智能体任务的完成状态需单独确认。
"active"
"paused"
"completed"
target: AutomationTarget
接收调用投递的会话配置或现有会话。
type: "once" (default: "once")
对象类型,固定为 once。
"once"
pause_reason: optional "target_session_failed" or null (default: "target_session_failed")
服务暂停当前计划的原因。其他计划为 null。
"target_session_failed"
type: "automation" (default: "automation")
对象类型,固定为 automation。
"automation"
status: "queued" or "completed" or "failed" or "skipped"
投递状态。投递完成后仍需单独确认智能体任务的执行结果。
"queued"
"completed"
"failed"
"skipped"
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 密钥。
## 将 AUTOMATION_ID 设置为目标自动化任务的 ID。
curl https://api.openai.com/v1/agents/automations/$AUTOMATION_ID/invocations \
-H 'OpenAI-Beta: agents=v1' \
-H "Authorization: Bearer $OPENAI_API_KEY"
200 响应示例
返回的示例状态为 pending_delivery,表示尚待投递。
{
"data": [
{
"id": "id",
"automation_id": "automation_id",
"created_at": 0,
"error": {
"code": "code",
"message": "message"
},
"object": "agent.automation.invocation",
"scheduled_at": 0,
"session_id": "session_id",
"skip_reason": "pending_delivery",
"source": {
"type": "manual"
},
"status": "queued"
}
],
"first_id": "first_id",
"has_more": true,
"last_id": "last_id",
"object": "list"
}
TRAE-AI编程


更多建议: