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