Poll for Work
api/beta/environments/work/poll
Nearest release: v2.1.245, published an hour after this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.
api/beta/environments/work/poll Changed · +19 / -22 lines
# Poll for Work ## Path parameters ## Query parameters ## Headers ## Returns ## Example ### Response (200) ## Poll for Work ### Path Parameters ### Query Parameters ### Header Parameters ### Returns ### Example #### Response
---- -title: Poll for Work -url: https://platform.claude.com/docs/en/api/beta/environments/work/poll ---- +# Poll for Work -## Poll for Work +**GET** `/v1/environments/{environment_id}/work/poll` -**get** `/v1/environments/{environment_id}/work/poll` - Note: these endpoints are called automatically by the pre-built environment worker provided in the SDKs and CLI, for orchestrating sessions with self-hosted sandbox environments. They are included here as a reference; you do not need to invoke them directly. Long poll for work items in the queue. -### Path Parameters +## Path parameters - `environment_id: string` -### Query Parameters +## Query parameters - `block_ms: optional number` How long to wait for work to arrive before returning. Must be 1-999 in milliseconds. Defaults to non-blocking (returns immediately if no work is available). + minimum: 1 + - `reclaim_older_than_ms: optional number` Reclaim unacknowledged work items older than this many milliseconds. If omitted, uses the default (5000ms). -### Header Parameters + minimum: 1 +## Headers + - `"anthropic-beta": optional array of AnthropicBeta` Optional header to specify the beta version(s) you want to use.
Unique identifier for the specific worker polling, used to track aggregated environment-level work metrics in Console -### Returns +## Returns -- `BetaSelfHostedWork object { id, acknowledged_at, created_at, 10 more }` +- `BetaSelfHostedWork object` Work resource representing a unit of work in a self-hosted environment.
Type of work data - - `"session"` - - `environment_id: string` Environment identifier this work belongs to (e.g., `env_...`)
The type of object (always 'work') - - `"work"` + default: work -### Example +## Example -```http +```bash curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID/work/poll \ -H 'anthropic-version: 2023-06-01' \ -H 'anthropic-beta: managed-agents-2026-04-01' \
-H "X-Api-Key: $ANTHROPIC_API_KEY" ``` -#### Response +### Response (200) ```json {