工作项心跳
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 格式返回,参见 错误码
请求示例
curl
curl -X POST https://api.deepraxis.com/anthropic/v1/environments/environment_123/work/work_123/heartbeat \
-H "x-api-key: $PRAXIS_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "anthropic-beta: managed-agents-2026-04-01"Python
from anthropic import Anthropic
client = Anthropic(
base_url="https://api.deepraxis.com/anthropic",
api_key="$PRAXIS_API_KEY",
)
# 官方有、平台未支持:调用得到 501(not_implemented_error),无副作用。
result = client.beta.environments.work.heartbeat("work_123", {"environment_id": "environment_123"})
print(result)TypeScript
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
baseURL: "https://api.deepraxis.com/anthropic",
apiKey: "$PRAXIS_API_KEY",
});
// 官方有、平台未支持:调用得到 501(not_implemented_error),无副作用。
const result = await client.beta.environments.work.heartbeat("work_123", { environment_id: "environment_123" });
console.log(result);响应示例 501
{
"type": "error",
"error": {
"type": "not_implemented_error",
"message": "Not implemented: this Managed Agents operation is not implemented on this platform yet (POST /v1/environments/{environment_id}/work/{work_id}/heartbeat); see the docs for the supported subset."
},
"request_id": "b4e1ed6b-a88e-4b24-8b8a-c5e0b7dc045d"
}响应
HTTP 200
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| last_heartbeat | string | RFC 3339 timestamp of the actual heartbeat from DB |
| lease_extended | boolean | Whether the heartbeat succeeded in extending the lease |
| state | string | Current state of the work item (active/stopping/stopped) |
| ttl_seconds | number | Effective TTL applied to the lease |
| type | string | The type of response |