Claude Platform Docs

Trabajo

Obtener elemento de trabajo
$client->beta->environments->work->retrieve(string workID, string environmentID, ?list<AnthropicBeta> betas, ?string workspaceID): SelfHostedWork
GET/v1/environments/{environment_id}/work/{work_id}

Nota: estos endpoints son llamados automáticamente por el worker de entorno prediseñado que se proporciona en los SDK y la CLI, para orquestar sesiones con entornos sandbox autoalojados. Se incluyen aquí como referencia; no necesitas invocarlos directamente.

Sondear en busca de trabajo
$client->beta->environments->work->poll(string environmentID, ?int blockMs, ?int reclaimOlderThanMs, ?list<AnthropicBeta> betas, ?string anthropicWorkerID): SelfHostedWork
GET/v1/environments/{environment_id}/work/poll

Nota: estos endpoints son llamados automáticamente por el worker de entorno prediseñado que se proporciona en los SDK y la CLI, para orquestar sesiones con entornos sandbox autoalojados. Se incluyen aquí como referencia; no necesitas invocarlos directamente.

Confirmar recepción de trabajo
$client->beta->environments->work->ack(string workID, string environmentID, ?list<AnthropicBeta> betas): SelfHostedWork
POST/v1/environments/{environment_id}/work/{work_id}/ack

Nota: estos endpoints son llamados automáticamente por el worker de entorno prediseñado que se proporciona en los SDK y la CLI, para orquestar sesiones con entornos sandbox autoalojados. Se incluyen aquí como referencia; no necesitas invocarlos directamente.

Registrar heartbeat
$client->beta->environments->work->heartbeat(string workID, string environmentID, ?int desiredTTLSeconds, ?string expectedLastHeartbeat, ?list<AnthropicBeta> betas): SelfHostedWorkHeartbeatResponse
POST/v1/environments/{environment_id}/work/{work_id}/heartbeat

Nota: estos endpoints son llamados automáticamente por el worker de entorno prediseñado que se proporciona en los SDK y la CLI, para orquestar sesiones con entornos sandbox autoalojados. Se incluyen aquí como referencia; no necesitas invocarlos directamente.

Detener trabajo
$client->beta->environments->work->stop(string workID, string environmentID, ?bool force, ?list<AnthropicBeta> betas, ?string workspaceID): SelfHostedWork
POST/v1/environments/{environment_id}/work/{work_id}/stop

Nota: estos endpoints son llamados automáticamente por el worker de entorno prediseñado que se proporciona en los SDK y la CLI, para orquestar sesiones con entornos sandbox autoalojados. Se incluyen aquí como referencia; no necesitas invocarlos directamente.

Listar elementos de trabajo
$client->beta->environments->work->list(string environmentID, ?int limit, ?string page, ?list<AnthropicBeta> betas): PageCursor<SelfHostedWork>
GET/v1/environments/{environment_id}/work

Nota: estos endpoints son llamados automáticamente por el worker de entorno prediseñado que se proporciona en los SDK y la CLI, para orquestar sesiones con entornos sandbox autoalojados. Se incluyen aquí como referencia; no necesitas invocarlos directamente.

Actualizar elemento de trabajo
$client->beta->environments->work->update(string workID, string environmentID, array<string,string> metadata, ?list<AnthropicBeta> betas, ?string workspaceID): SelfHostedWork
POST/v1/environments/{environment_id}/work/{work_id}

Nota: estos endpoints son llamados automáticamente por el worker de entorno prediseñado que se proporciona en los SDK y la CLI, para orquestar sesiones con entornos sandbox autoalojados. Se incluyen aquí como referencia; no necesitas invocarlos directamente.

Obtener estadísticas de la cola
$client->beta->environments->work->stats(string environmentID, ?list<AnthropicBeta> betas, ?string workspaceID): SelfHostedWorkQueueStats
GET/v1/environments/{environment_id}/work/stats

Obtiene estadísticas sobre la cola de trabajo de un entorno.

Models
class SelfHostedWork { $type = 'work'; $id; $acknowledgedAt; /* 10 more */ }
class SelfHostedWorkHeartbeatResponse { $type = 'work_heartbeat'; $lastHeartbeat; $leaseExtended; /* 2 more */ }
"work_heartbeat" type

The type of response

string lastHeartbeat

RFC 3339 timestamp of the actual heartbeat from DB

bool leaseExtended

Whether the heartbeat succeeded in extending the lease

State state

Current state of the work item (active/stopping/stopped)

int ttlSeconds

Effective TTL applied to the lease

class SelfHostedWorkListResponse { $data; $nextPage; }
list<SelfHostedWork> data

List of work items

?string nextPage

Opaque cursor for fetching the next page of results

class SelfHostedWorkQueueStats { $type = 'work_queue_stats'; $depth; $oldestQueuedAt; /* 2 more */ }
"work_queue_stats" type

The type of object

int depth

Number of work items waiting to be picked up (lag from consumer group)

?string oldestQueuedAt

RFC 3339 timestamp of oldest item in the work stream (includes both queued and pending items), null if stream empty

int pending

Number of work items being processed (polled but not acknowledged)

?int workersPolling

Number of workers that have polled for work in the last 30 seconds. Requires worker_id to be sent with poll requests.

class SelfHostedWorkStopRequest { $force; }
?bool force

If true, immediately stop work without graceful shutdown

class SelfHostedWorkUpdateRequest { $metadata; }
array<string,string> metadata

Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve existing metadata.

class SessionWorkData { $type = 'session'; $id; }
"session" type

Type of work data

string id

Session identifier (e.g., 'session_...')