Heartbeat aufzeichnen
POST/v1/environments/{environment_id}/work/{work_id}/heartbeat
Hinweis: Diese Endpunkte werden automatisch vom vorgefertigten Environment-Worker aufgerufen, der in den SDKs und der CLI bereitgestellt wird, um Sessions mit selbst gehosteten Sandbox-Umgebungen zu orchestrieren. Sie sind hier als Referenz aufgeführt; du musst sie nicht direkt aufrufen.
Zeichne einen Heartbeat für ein Arbeitselement auf, um die Lease aufrechtzuerhalten.
Parameters
Returns
Heartbeat aufzeichnen
package com.anthropic.example;
import com.anthropic.client.AnthropicClient;
import com.anthropic.client.okhttp.AnthropicOkHttpClient;
import com.anthropic.models.beta.environments.work.BetaSelfHostedWorkHeartbeatResponse;
import com.anthropic.models.beta.environments.work.WorkHeartbeatParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
AnthropicClient client = AnthropicOkHttpClient.fromEnv();
WorkHeartbeatParams params = WorkHeartbeatParams.builder()
.environmentId("env_011CZkZ9X2dpNyB7HsEFoRfW")
.workId("work_id")
.build();
BetaSelfHostedWorkHeartbeatResponse betaSelfHostedWorkHeartbeatResponse = client.beta().environments().work().heartbeat(params);
}
}Response 200
{
"last_heartbeat": "last_heartbeat",
"lease_extended": true,
"state": "queued",
"ttl_seconds": 0,
"type": "work_heartbeat"
}Returns Examples
Response 200
{
"last_heartbeat": "last_heartbeat",
"lease_extended": true,
"state": "queued",
"ttl_seconds": 0,
"type": "work_heartbeat"
}