Claude Platform Docs

工作

获取工作项
$client->beta->environments->work->retrieve(string workID, string environmentID, ?list<AnthropicBeta> betas, ?string workspaceID): SelfHostedWork
GET/v1/environments/{environment_id}/work/{work_id}

注意:这些端点由 SDK 和 CLI 中提供的预构建环境工作器自动调用,用于编排使用自托管沙箱环境的会话。此处列出仅供参考;您无需直接调用它们。

轮询工作
$client->beta->environments->work->poll(string environmentID, ?int blockMs, ?int reclaimOlderThanMs, ?list<AnthropicBeta> betas, ?string anthropicWorkerID): SelfHostedWork
GET/v1/environments/{environment_id}/work/poll

注意:这些端点由 SDK 和 CLI 中提供的预构建环境工作器自动调用,用于编排使用自托管沙箱环境的会话。此处列出仅供参考;您无需直接调用它们。

确认工作
$client->beta->environments->work->ack(string workID, string environmentID, ?list<AnthropicBeta> betas): SelfHostedWork
POST/v1/environments/{environment_id}/work/{work_id}/ack

注意:这些端点由 SDK 和 CLI 中提供的预构建环境工作器自动调用,用于编排使用自托管沙箱环境的会话。此处列出仅供参考;您无需直接调用它们。

记录心跳
$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

注意:这些端点由 SDK 和 CLI 中提供的预构建环境工作器自动调用,用于编排使用自托管沙箱环境的会话。此处列出仅供参考;您无需直接调用它们。

停止工作
$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

注意:这些端点由 SDK 和 CLI 中提供的预构建环境工作器自动调用,用于编排使用自托管沙箱环境的会话。此处列出仅供参考;您无需直接调用它们。

列出工作项
$client->beta->environments->work->list(string environmentID, ?int limit, ?string page, ?list<AnthropicBeta> betas): PageCursor<SelfHostedWork>
GET/v1/environments/{environment_id}/work

注意:这些端点由 SDK 和 CLI 中提供的预构建环境工作器自动调用,用于编排使用自托管沙箱环境的会话。此处列出仅供参考;您无需直接调用它们。

更新工作项
$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}

注意:这些端点由 SDK 和 CLI 中提供的预构建环境工作器自动调用,用于编排使用自托管沙箱环境的会话。此处列出仅供参考;您无需直接调用它们。

获取队列统计信息
$client->beta->environments->work->stats(string environmentID, ?list<AnthropicBeta> betas, ?string workspaceID): SelfHostedWorkQueueStats
GET/v1/environments/{environment_id}/work/stats

获取某个环境的工作队列统计信息。

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_...')