Skip to main content
POST
记录心跳
每个请求都必须发送 ?beta=true

授权

X-Api-Key
string
header
默认值:sk-ant-local-default
必填

OMA 工作区 API 密钥。

请求头

anthropic-beta
string

用于指定要使用的 beta 版本的可选请求头。

要使用多个 beta,请使用逗号分隔的列表(如 beta1,beta2),或为每个 beta 分别指定该请求头。

anthropic-version
string

你想使用的 OMA API 版本。

在此处阅读更多关于版本控制和我们版本历史的信息。

authorization
string | null

路径参数

environment_id
string
必填
work_id
string
必填

查询参数

beta
enum<boolean>
必填

为此接口启用 Beta API 合同,必须为 true

可用选项:
true
desired_ttl_seconds
integer | null

期望的 TTL(秒)

expected_last_heartbeat
string | null

用于条件更新(乐观并发)的预期 last_heartbeat。使用字面量 'NO_HEARTBEAT' 来认领尚未被认领的租约(首次心跳)。对于后续心跳,请原样回显服务端先前的 last_heartbeat 值。如果实际值不匹配,返回 412 Precondition Failed。

响应

成功的响应

为 worker 记录心跳后的响应。

last_heartbeat
string
必填

来自数据库的实际心跳的 RFC 3339 时间戳

lease_extended
boolean
必填

心跳是否成功延长了租约

state
enum<string>
必填

worker 的当前状态(active/stopping/stopped)

可用选项:
queued,
starting,
active,
stopping,
stopped
ttl_seconds
integer
必填

应用于租约的有效 TTL

type
string
默认值:work_heartbeat
必填

响应类型

Allowed value: "work_heartbeat"