AnthropicClaude 托管智能体

轮询工作项

自托管执行器轮询领取环境任务队列里的下一条任务。

GET /anthropic/v1/environments/{environment_id}/work/poll○ 未支持

请求参数

  • environment_idstring必填

    path: 环境 ID(路径或查询参数)。

  • block_msnumber可选

    query: 没有可领任务时最多等待的毫秒数(1–999)。

  • reclaim_older_than_msnumber可选

    query: 回收租约早于该毫秒数的任务。

  • Anthropic-Worker-IDstring可选

    query: 发起轮询的自托管执行器实例 ID,用于在控制台聚合环境级任务指标。

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

这是自托管执行器领取任务的协议;平台的智能体都在平台上执行,不支持自托管执行器。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringWork identifier (e.g., 'work_...')
acknowledged_atnull | stringRFC 3339 timestamp when work was acknowledged by Environment Manager
created_atstringRFC 3339 timestamp when work was created
dataobjectThe actual work to be performed (session or health check)
data.idstringSession identifier (e.g., 'session_...') / Health check identifier
data.typestringType of work data
environment_idstringEnvironment identifier this work belongs to (e.g., `env_...`)
latest_heartbeat_atnull | stringRFC 3339 timestamp of the most recent heartbeat
metadataobjectUser-provided metadata key-value pairs associated with this work item
secretnull | stringCredential payload used by the environment worker to execute this work item. May be populated when polling for work; null on all other retrieval paths.
started_atnull | stringRFC 3339 timestamp when work execution started
statestringCurrent state of the work item
stop_requested_atnull | stringRFC 3339 timestamp when stop was requested
stopped_atnull | stringRFC 3339 timestamp when work execution stopped
typestringThe type of object (always 'work')