Skip to main content
POST
cURL
任务默认启用,创建成功后会按计划调用模型与工具,并将任务和执行结果保存到 TOS。核对消息、触发时间与访问权限后再提交;如需先保存而不执行,将 enabled 设为 false
需要使用 AgentKit CLI 0.54.0 部署并启用定时任务的 Harness Runtime schedule.cron 与 schedule.at 必须且只能设置一个非 null 值。创建启用的一次性任务时,at 必须在未来且包含时区偏移 建议提供稳定的 idempotency_key。相同键和相同请求返回同一任务,状态仍为 201;相同键对应不同请求返回 422。省略幂等键时,每次请求都会新建任务 harness 使用本页的任务覆盖结构,未提供字段继承部署配置。每次执行使用独立会话,最终输出保存在 TOS

授权

Authorization
string
header
必填

服务鉴权 Harness 的 Runtime 访问凭证,例如 Runtime API Key;共享 OAuth 部署不支持后台定时任务

请求体

application/json

创建任务的请求;未声明字段会被拒绝

name
string
必填

任务名称,1–128 个字符

Required string length: 1 - 128
prompt
string
必填

每次执行发送给智能体的消息,1–65536 个字符

Required string length: 1 - 65536
schedule
Schedule · object
必填

触发计划

harness
JobHarnessOverrides · object | null

任务级配置覆盖;使用 AgentKit CLI 部署版的字段,例如 mcp_servers

enabled
boolean
默认值:true

是否启用后续调度

timeout_seconds
integer
默认值:1800

单次执行超时,单位为秒;超时记为 failed,不自动重试该次执行

必填范围: 1 <= x <= 10800
misfire_policy
enum<string>
默认值:latest

latest 补跑最近一次错过的触发;skip 仅在该次触发未超出宽限时间时执行。两者均不逐次补跑所有历史触发

可用选项:
latest,
skip
misfire_grace_seconds
integer
默认值:120

skip 策略允许的最大延迟,单位为秒

必填范围: 0 <= x <= 86400
idempotency_key
string | null

可选幂等键。相同键和相同请求返回同一任务;同键不同请求返回 422。省略时每次创建新任务

Required string length: 1 - 128

响应

成功;相同幂等请求再次提交也返回 201

name
string
必填

任务名称,1–128 个字符

Required string length: 1 - 128
prompt
string
必填

每次执行发送给智能体的消息,1–65536 个字符

Required string length: 1 - 65536
schedule
Schedule · object
必填

触发计划

harness
CronjobHarnessPublicOverrides · object | null
必填

该任务每次执行时应用的配置,仅应用显式提供的字段,未提供字段继承已部署智能体

enabled
boolean
必填

是否启用后续调度

timeout_seconds
integer
必填

单次执行超时,单位为秒;超时记为 failed,不自动重试该次执行

必填范围: 1 <= x <= 10800
misfire_policy
enum<string>
必填

latest 补跑最近一次错过的触发;skip 仅在该次触发未超出宽限时间时执行。两者均不逐次补跑所有历史触发

可用选项:
latest,
skip
misfire_grace_seconds
integer
必填

skip 策略允许的最大延迟,单位为秒

必填范围: 0 <= x <= 86400
cronjob_id
string
必填

所属任务 ID

Pattern: ^[a-f0-9]{32}$
revision
integer
必填

任务修订号

created_at
string<date-time>
必填

任务创建时间,UTC

updated_at
string<date-time>
必填

任务最近更新时间,UTC

next_run_at
string<date-time> | null
必填

下次计划触发时间,UTC;没有后续触发时为 null

active
object | null
必填

当前排队、运行中或正在保存最终结果的执行

last_run
object | null
必填

最近已保存到历史的执行摘要

最后修改于 2026年9月19日