AnthropicClaude 托管智能体

工作项心跳

自托管执行器定期上报心跳,续租任务租约防止被回收。

POST /anthropic/v1/environments/{environment_id}/work/{work_id}/heartbeat○ 未支持

请求参数

  • environment_idstring必填

    path: 环境 ID(路径或查询参数)。

  • work_idstring必填

    path: 路径参数:任务 ID。

  • environment_idstring必填

    query: 环境 ID(路径或查询参数)。

  • desired_ttl_secondsnumber可选

    query: 期望的任务租约有效期(秒)。

  • expected_last_heartbeatstring可选

    query: 期望的最后心跳时间,用于并发保护。

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

这是自托管执行器领取任务的协议;平台的智能体都在平台上执行,不支持自托管执行器。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
last_heartbeatstringRFC 3339 timestamp of the actual heartbeat from DB
lease_extendedbooleanWhether the heartbeat succeeded in extending the lease
statestringCurrent state of the work item (active/stopping/stopped)
ttl_secondsnumberEffective TTL applied to the lease
typestringThe type of response