SPB Git

Repository Public

environments.md 89.6 KB 4,253 lines markdown

1---2title: Environments3url: https://platform.claude.com/docs/en/api/beta/environments4---56# Environments78## Create Environment910**POST** `/v1/environments`1112Create a new environment with the specified configuration.1314### Headers1516- `"anthropic-beta": optional array of AnthropicBeta`1718  Optional header to specify the beta version(s) you want to use.1920  - `string`2122  - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 43 more`2324    - `"message-batches-2024-09-24"`2526    - `"prompt-caching-2024-07-31"`2728    - `"computer-use-2024-10-22"`2930    - `"computer-use-2025-01-24"`3132    - `"pdfs-2024-09-25"`3334    - `"token-counting-2024-11-01"`3536    - `"token-efficient-tools-2025-02-19"`3738    - `"output-128k-2025-02-19"`3940    - `"files-api-2025-04-14"`4142    - `"mcp-client-2025-04-04"`4344    - `"mcp-client-2025-11-20"`4546    - `"dev-full-thinking-2025-05-14"`4748    - `"interleaved-thinking-2025-05-14"`4950    - `"code-execution-2025-05-22"`5152    - `"extended-cache-ttl-2025-04-11"`5354    - `"context-1m-2025-08-07"`5556    - `"context-management-2025-06-27"`5758    - `"model-context-window-exceeded-2025-08-26"`5960    - `"skills-2025-10-02"`6162    - `"fast-mode-2026-02-01"`6364    - `"output-300k-2026-03-24"`6566    - `"user-profiles-2026-03-24"`6768    - `"user-profiles-2026-08-18"`6970    - `"user-profiles-2026-09-04"`7172    - `"advisor-tool-2026-03-01"`7374    - `"managed-agents-2026-04-01"`7576    - `"cache-diagnosis-2026-04-07"`7778    - `"dreaming-2026-04-21"`7980    - `"thinking-token-count-2026-05-13"`8182    - `"server-side-fallback-2026-06-01"`8384    - `"server-side-fallback-2026-07-01"`8586    - `"fallback-credit-2026-06-01"`8788    - `"fallback-credit-2026-07-01"`8990    - `"agent-memory-2026-07-22"`9192    - `"mid-conversation-tool-changes-2026-07-01"`9394    - `"compact-2026-01-12"`9596    - `"computer-use-2025-11-24"`9798    - `"mcp-tunnels-2026-06-22"`99100    - `"structured-outputs-2025-11-13"`101102    - `"task-budgets-2026-03-13"`103104    - `"thinking-display-updates-2026-08-18"`105106    - `"ce-user-management-2026-07-13"`107108    - `"mid-conversation-output-config-2026-07-01"`109110    - `"thinking-binding-controls-2026-08-01"`111112    - `"mid-conversation-system-clear-at-2026-08-21"`113114    - `"compact-2026-09-04"`115116- `"anthropic-workspace-id": optional string`117118### Body parameters119120- `name: string`121122  Human-readable name for the environment123124  maxLength: 256, minLength: 1125126- `config: optional BetaCloudConfigParams or BetaSelfHostedConfigParams or null`127128  Environment configuration129130  - `BetaCloudConfigParams object`131132    Request params for `cloud` environment configuration.133134    Fields default to null; on update, omitted fields preserve the135    existing value.136137    - `type: "cloud"`138139      Environment type140141    - `networking: optional BetaUnrestrictedNetwork or BetaLimitedNetworkParams or null`142143      Network configuration policy. Omit on update to preserve the existing value.144145      - `BetaUnrestrictedNetwork object`146147        Unrestricted network access.148149        - `type: "unrestricted"`150151          Network policy type152153      - `BetaLimitedNetworkParams object`154155        Limited network request params.156157        Fields default to null; on update, omitted fields preserve the158        existing value.159160        - `type: "limited"`161162          Network policy type163164        - `allow_mcp_servers: optional boolean or null`165166          Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`.167168        - `allow_package_managers: optional boolean or null`169170          Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false` on creation. Must be `true` when `packages` are specified.171172        - `allowed_hosts: optional array of string or null`173174          Specifies domains the container can reach.175176    - `packages: optional BetaPackagesParams or null`177178      Specify packages (and optionally their versions) available in this environment.179180      When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest.181182      Under `limited` networking, requires `networking.allow_package_managers` to be `true`.183184      - `type: optional "packages"`185186        Package configuration type187188        default: packages189190      - `apt: optional array of string or null`191192        Ubuntu/Debian packages to install193194      - `cargo: optional array of string or null`195196        Rust packages to install197198      - `gem: optional array of string or null`199200        Ruby packages to install201202      - `go: optional array of string or null`203204        Go packages to install205206      - `npm: optional array of string or null`207208        Node.js packages to install209210      - `pip: optional array of string or null`211212        Python packages to install213214  - `BetaSelfHostedConfigParams object`215216    Request params for `self_hosted` environment configuration.217218    - `type: "self_hosted"`219220      Environment type221222- `description: optional string or null`223224  Optional description of the environment225226  maxLength: 1024227228- `metadata: optional map[string]`229230  User-provided metadata key-value pairs231232- `scope: optional "organization" or "account" or null`233234  The visibility scope for this environment. 'organization' makes the environment visible to all accounts. 'account' restricts visibility to the owning account only. API organizations support only 'organization'; 'account' is rejected. If not specified, defaults based on organization type.235236  - `"organization"`237238  - `"account"`239240### Returns241242- `BetaEnvironment object`243244  Unified Environment resource for both cloud and self-hosted environments.245246  - `type: "environment"`247248    The type of object (always 'environment')249250    default: environment251252  - `id: string`253254    Environment identifier (e.g., 'env_...')255256  - `archived_at: string or null`257258    RFC 3339 timestamp when environment was archived, or null if not archived259260  - `config: BetaCloudConfig or BetaSelfHostedConfig`261262    Environment configuration (either Anthropic Cloud or self-hosted)263264    - `BetaCloudConfig object`265266      `cloud` environment configuration.267268      - `type: "cloud"`269270        Environment type271272      - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork`273274        Network configuration policy.275276        - `BetaUnrestrictedNetwork object`277278          Unrestricted network access.279280          - `type: "unrestricted"`281282            Network policy type283284        - `BetaLimitedNetwork object`285286          Limited network access.287288          - `type: "limited"`289290            Network policy type291292          - `allow_mcp_servers: boolean`293294            Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array.295296          - `allow_package_managers: boolean`297298            Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array.299300          - `allowed_hosts: array of string`301302            Specifies domains the container can reach.303304      - `packages: BetaPackages`305306        Package manager configuration.307308        - `type: optional "packages"`309310          Package configuration type311312          default: packages313314        - `apt: array of string`315316          Ubuntu/Debian packages to install317318        - `cargo: array of string`319320          Rust packages to install321322        - `gem: array of string`323324          Ruby packages to install325326        - `go: array of string`327328          Go packages to install329330        - `npm: array of string`331332          Node.js packages to install333334        - `pip: array of string`335336          Python packages to install337338    - `BetaSelfHostedConfig object`339340      Configuration for self-hosted environments.341342      - `type: "self_hosted"`343344        Environment type345346  - `created_at: string`347348    RFC 3339 timestamp when environment was created349350  - `description: string or null`351352    User-provided description for the environment; null when unset353354  - `metadata: map[string]`355356    User-provided metadata key-value pairs357358  - `name: string`359360    Human-readable name for the environment361362  - `updated_at: string`363364    RFC 3339 timestamp when environment was last updated365366  - `scope: optional "organization" or "account"`367368    The visibility scope for this environment. 'organization' means visible to all accounts. 'account' means visible only to the owning account.369370    - `"organization"`371372    - `"account"`373374### Example375376```bash377curl https://api.anthropic.com/v1/environments \378    -H 'Content-Type: application/json' \379    -H 'anthropic-version: 2023-06-01' \380    -H 'anthropic-beta: managed-agents-2026-04-01' \381    -H "X-Api-Key: $ANTHROPIC_API_KEY" \382    -d '{383          "name": "python-data-analysis",384          "config": {385            "type": "cloud",386            "networking": {387              "type": "limited",388              "allow_package_managers": true,389              "allowed_hosts": [390                "api.example.com"391              ]392            },393            "packages": {394              "pip": [395                "pandas",396                "numpy"397              ]398            }399          },400          "description": "Python environment with data-analysis packages."401        }'402```403404#### Response (200)405406```json407{408  "id": "env_011CZkZ9X2dpNyB7HsEFoRfW",409  "archived_at": null,410  "config": {411    "networking": {412      "allow_mcp_servers": false,413      "allow_package_managers": true,414      "allowed_hosts": [415        "api.example.com"416      ],417      "type": "limited"418    },419    "packages": {420      "apt": [421        "string"422      ],423      "cargo": [424        "string"425      ],426      "gem": [427        "string"428      ],429      "go": [430        "string"431      ],432      "npm": [433        "string"434      ],435      "pip": [436        "pandas",437        "numpy"438      ],439      "type": "packages"440    },441    "type": "cloud"442  },443  "created_at": "2026-03-15T10:00:00Z",444  "description": "Python environment with data-analysis packages.",445  "metadata": {},446  "name": "python-data-analysis",447  "type": "environment",448  "updated_at": "2026-03-15T10:00:00Z",449  "scope": "organization"450}451```452453## List Environments454455**GET** `/v1/environments`456457List environments with pagination support.458459### Query parameters460461- `include_archived: optional boolean`462463  Include archived environments in the response464465  default: false466467- `limit: optional number`468469  Maximum number of environments to return470471  default: 20, maximum: 1000, minimum: 1472473- `page: optional string`474475  Opaque cursor from previous response for pagination. Pass the `next_page` value from the previous response.476477### Headers478479- `"anthropic-beta": optional array of AnthropicBeta`480481  Optional header to specify the beta version(s) you want to use.482483  - `string`484485  - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 43 more`486487    - `"message-batches-2024-09-24"`488489    - `"prompt-caching-2024-07-31"`490491    - `"computer-use-2024-10-22"`492493    - `"computer-use-2025-01-24"`494495    - `"pdfs-2024-09-25"`496497    - `"token-counting-2024-11-01"`498499    - `"token-efficient-tools-2025-02-19"`500501    - `"output-128k-2025-02-19"`502503    - `"files-api-2025-04-14"`504505    - `"mcp-client-2025-04-04"`506507    - `"mcp-client-2025-11-20"`508509    - `"dev-full-thinking-2025-05-14"`510511    - `"interleaved-thinking-2025-05-14"`512513    - `"code-execution-2025-05-22"`514515    - `"extended-cache-ttl-2025-04-11"`516517    - `"context-1m-2025-08-07"`518519    - `"context-management-2025-06-27"`520521    - `"model-context-window-exceeded-2025-08-26"`522523    - `"skills-2025-10-02"`524525    - `"fast-mode-2026-02-01"`526527    - `"output-300k-2026-03-24"`528529    - `"user-profiles-2026-03-24"`530531    - `"user-profiles-2026-08-18"`532533    - `"user-profiles-2026-09-04"`534535    - `"advisor-tool-2026-03-01"`536537    - `"managed-agents-2026-04-01"`538539    - `"cache-diagnosis-2026-04-07"`540541    - `"dreaming-2026-04-21"`542543    - `"thinking-token-count-2026-05-13"`544545    - `"server-side-fallback-2026-06-01"`546547    - `"server-side-fallback-2026-07-01"`548549    - `"fallback-credit-2026-06-01"`550551    - `"fallback-credit-2026-07-01"`552553    - `"agent-memory-2026-07-22"`554555    - `"mid-conversation-tool-changes-2026-07-01"`556557    - `"compact-2026-01-12"`558559    - `"computer-use-2025-11-24"`560561    - `"mcp-tunnels-2026-06-22"`562563    - `"structured-outputs-2025-11-13"`564565    - `"task-budgets-2026-03-13"`566567    - `"thinking-display-updates-2026-08-18"`568569    - `"ce-user-management-2026-07-13"`570571    - `"mid-conversation-output-config-2026-07-01"`572573    - `"thinking-binding-controls-2026-08-01"`574575    - `"mid-conversation-system-clear-at-2026-08-21"`576577    - `"compact-2026-09-04"`578579- `"anthropic-workspace-id": optional string`580581### Returns582583- `data: array of BetaEnvironment`584585  List of environments.586587  - `type: "environment"`588589    The type of object (always 'environment')590591    default: environment592593  - `id: string`594595    Environment identifier (e.g., 'env_...')596597  - `archived_at: string or null`598599    RFC 3339 timestamp when environment was archived, or null if not archived600601  - `config: BetaCloudConfig or BetaSelfHostedConfig`602603    Environment configuration (either Anthropic Cloud or self-hosted)604605    - `BetaCloudConfig object`606607      `cloud` environment configuration.608609      - `type: "cloud"`610611        Environment type612613      - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork`614615        Network configuration policy.616617        - `BetaUnrestrictedNetwork object`618619          Unrestricted network access.620621          - `type: "unrestricted"`622623            Network policy type624625        - `BetaLimitedNetwork object`626627          Limited network access.628629          - `type: "limited"`630631            Network policy type632633          - `allow_mcp_servers: boolean`634635            Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array.636637          - `allow_package_managers: boolean`638639            Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array.640641          - `allowed_hosts: array of string`642643            Specifies domains the container can reach.644645      - `packages: BetaPackages`646647        Package manager configuration.648649        - `type: optional "packages"`650651          Package configuration type652653          default: packages654655        - `apt: array of string`656657          Ubuntu/Debian packages to install658659        - `cargo: array of string`660661          Rust packages to install662663        - `gem: array of string`664665          Ruby packages to install666667        - `go: array of string`668669          Go packages to install670671        - `npm: array of string`672673          Node.js packages to install674675        - `pip: array of string`676677          Python packages to install678679    - `BetaSelfHostedConfig object`680681      Configuration for self-hosted environments.682683      - `type: "self_hosted"`684685        Environment type686687  - `created_at: string`688689    RFC 3339 timestamp when environment was created690691  - `description: string or null`692693    User-provided description for the environment; null when unset694695  - `metadata: map[string]`696697    User-provided metadata key-value pairs698699  - `name: string`700701    Human-readable name for the environment702703  - `updated_at: string`704705    RFC 3339 timestamp when environment was last updated706707  - `scope: optional "organization" or "account"`708709    The visibility scope for this environment. 'organization' means visible to all accounts. 'account' means visible only to the owning account.710711    - `"organization"`712713    - `"account"`714715- `next_page: string or null`716717  Token for fetching the next page of results. If `null`, there are no more results available. Pass this value to the `page` parameter in the next request.718719### Example720721```bash722curl https://api.anthropic.com/v1/environments \723    -H 'anthropic-version: 2023-06-01' \724    -H 'anthropic-beta: managed-agents-2026-04-01' \725    -H "X-Api-Key: $ANTHROPIC_API_KEY"726```727728#### Response (200)729730```json731{732  "data": [733    {734      "id": "env_011CZkZ9X2dpNyB7HsEFoRfW",735      "archived_at": null,736      "config": {737        "networking": {738          "allow_mcp_servers": false,739          "allow_package_managers": true,740          "allowed_hosts": [741            "api.example.com"742          ],743          "type": "limited"744        },745        "packages": {746          "apt": [747            "string"748          ],749          "cargo": [750            "string"751          ],752          "gem": [753            "string"754          ],755          "go": [756            "string"757          ],758          "npm": [759            "string"760          ],761          "pip": [762            "pandas",763            "numpy"764          ],765          "type": "packages"766        },767        "type": "cloud"768      },769      "created_at": "2026-03-15T10:00:00Z",770      "description": "Python environment with data-analysis packages.",771      "metadata": {},772      "name": "python-data-analysis",773      "type": "environment",774      "updated_at": "2026-03-15T10:00:00Z",775      "scope": "organization"776    }777  ],778  "next_page": "page_MjAyNS0wNS0xNFQwMDowMDowMFo="779}780```781782## Get Environment783784**GET** `/v1/environments/{environment_id}`785786Retrieve a specific environment by ID.787788### Path parameters789790- `environment_id: string`791792### Headers793794- `"anthropic-beta": optional array of AnthropicBeta`795796  Optional header to specify the beta version(s) you want to use.797798  - `string`799800  - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 43 more`801802    - `"message-batches-2024-09-24"`803804    - `"prompt-caching-2024-07-31"`805806    - `"computer-use-2024-10-22"`807808    - `"computer-use-2025-01-24"`809810    - `"pdfs-2024-09-25"`811812    - `"token-counting-2024-11-01"`813814    - `"token-efficient-tools-2025-02-19"`815816    - `"output-128k-2025-02-19"`817818    - `"files-api-2025-04-14"`819820    - `"mcp-client-2025-04-04"`821822    - `"mcp-client-2025-11-20"`823824    - `"dev-full-thinking-2025-05-14"`825826    - `"interleaved-thinking-2025-05-14"`827828    - `"code-execution-2025-05-22"`829830    - `"extended-cache-ttl-2025-04-11"`831832    - `"context-1m-2025-08-07"`833834    - `"context-management-2025-06-27"`835836    - `"model-context-window-exceeded-2025-08-26"`837838    - `"skills-2025-10-02"`839840    - `"fast-mode-2026-02-01"`841842    - `"output-300k-2026-03-24"`843844    - `"user-profiles-2026-03-24"`845846    - `"user-profiles-2026-08-18"`847848    - `"user-profiles-2026-09-04"`849850    - `"advisor-tool-2026-03-01"`851852    - `"managed-agents-2026-04-01"`853854    - `"cache-diagnosis-2026-04-07"`855856    - `"dreaming-2026-04-21"`857858    - `"thinking-token-count-2026-05-13"`859860    - `"server-side-fallback-2026-06-01"`861862    - `"server-side-fallback-2026-07-01"`863864    - `"fallback-credit-2026-06-01"`865866    - `"fallback-credit-2026-07-01"`867868    - `"agent-memory-2026-07-22"`869870    - `"mid-conversation-tool-changes-2026-07-01"`871872    - `"compact-2026-01-12"`873874    - `"computer-use-2025-11-24"`875876    - `"mcp-tunnels-2026-06-22"`877878    - `"structured-outputs-2025-11-13"`879880    - `"task-budgets-2026-03-13"`881882    - `"thinking-display-updates-2026-08-18"`883884    - `"ce-user-management-2026-07-13"`885886    - `"mid-conversation-output-config-2026-07-01"`887888    - `"thinking-binding-controls-2026-08-01"`889890    - `"mid-conversation-system-clear-at-2026-08-21"`891892    - `"compact-2026-09-04"`893894- `"anthropic-workspace-id": optional string`895896### Returns897898- `BetaEnvironment object`899900  Unified Environment resource for both cloud and self-hosted environments.901902  - `type: "environment"`903904    The type of object (always 'environment')905906    default: environment907908  - `id: string`909910    Environment identifier (e.g., 'env_...')911912  - `archived_at: string or null`913914    RFC 3339 timestamp when environment was archived, or null if not archived915916  - `config: BetaCloudConfig or BetaSelfHostedConfig`917918    Environment configuration (either Anthropic Cloud or self-hosted)919920    - `BetaCloudConfig object`921922      `cloud` environment configuration.923924      - `type: "cloud"`925926        Environment type927928      - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork`929930        Network configuration policy.931932        - `BetaUnrestrictedNetwork object`933934          Unrestricted network access.935936          - `type: "unrestricted"`937938            Network policy type939940        - `BetaLimitedNetwork object`941942          Limited network access.943944          - `type: "limited"`945946            Network policy type947948          - `allow_mcp_servers: boolean`949950            Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array.951952          - `allow_package_managers: boolean`953954            Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array.955956          - `allowed_hosts: array of string`957958            Specifies domains the container can reach.959960      - `packages: BetaPackages`961962        Package manager configuration.963964        - `type: optional "packages"`965966          Package configuration type967968          default: packages969970        - `apt: array of string`971972          Ubuntu/Debian packages to install973974        - `cargo: array of string`975976          Rust packages to install977978        - `gem: array of string`979980          Ruby packages to install981982        - `go: array of string`983984          Go packages to install985986        - `npm: array of string`987988          Node.js packages to install989990        - `pip: array of string`991992          Python packages to install993994    - `BetaSelfHostedConfig object`995996      Configuration for self-hosted environments.997998      - `type: "self_hosted"`9991000        Environment type10011002  - `created_at: string`10031004    RFC 3339 timestamp when environment was created10051006  - `description: string or null`10071008    User-provided description for the environment; null when unset10091010  - `metadata: map[string]`10111012    User-provided metadata key-value pairs10131014  - `name: string`10151016    Human-readable name for the environment10171018  - `updated_at: string`10191020    RFC 3339 timestamp when environment was last updated10211022  - `scope: optional "organization" or "account"`10231024    The visibility scope for this environment. 'organization' means visible to all accounts. 'account' means visible only to the owning account.10251026    - `"organization"`10271028    - `"account"`10291030### Example10311032```bash1033curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID \1034    -H 'anthropic-version: 2023-06-01' \1035    -H 'anthropic-beta: managed-agents-2026-04-01' \1036    -H "X-Api-Key: $ANTHROPIC_API_KEY"1037```10381039#### Response (200)10401041```json1042{1043  "id": "env_011CZkZ9X2dpNyB7HsEFoRfW",1044  "archived_at": null,1045  "config": {1046    "networking": {1047      "allow_mcp_servers": false,1048      "allow_package_managers": true,1049      "allowed_hosts": [1050        "api.example.com"1051      ],1052      "type": "limited"1053    },1054    "packages": {1055      "apt": [1056        "string"1057      ],1058      "cargo": [1059        "string"1060      ],1061      "gem": [1062        "string"1063      ],1064      "go": [1065        "string"1066      ],1067      "npm": [1068        "string"1069      ],1070      "pip": [1071        "pandas",1072        "numpy"1073      ],1074      "type": "packages"1075    },1076    "type": "cloud"1077  },1078  "created_at": "2026-03-15T10:00:00Z",1079  "description": "Python environment with data-analysis packages.",1080  "metadata": {},1081  "name": "python-data-analysis",1082  "type": "environment",1083  "updated_at": "2026-03-15T10:00:00Z",1084  "scope": "organization"1085}1086```10871088## Update Environment10891090**POST** `/v1/environments/{environment_id}`10911092Update an existing environment's configuration.10931094### Path parameters10951096- `environment_id: string`10971098### Headers10991100- `"anthropic-beta": optional array of AnthropicBeta`11011102  Optional header to specify the beta version(s) you want to use.11031104  - `string`11051106  - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 43 more`11071108    - `"message-batches-2024-09-24"`11091110    - `"prompt-caching-2024-07-31"`11111112    - `"computer-use-2024-10-22"`11131114    - `"computer-use-2025-01-24"`11151116    - `"pdfs-2024-09-25"`11171118    - `"token-counting-2024-11-01"`11191120    - `"token-efficient-tools-2025-02-19"`11211122    - `"output-128k-2025-02-19"`11231124    - `"files-api-2025-04-14"`11251126    - `"mcp-client-2025-04-04"`11271128    - `"mcp-client-2025-11-20"`11291130    - `"dev-full-thinking-2025-05-14"`11311132    - `"interleaved-thinking-2025-05-14"`11331134    - `"code-execution-2025-05-22"`11351136    - `"extended-cache-ttl-2025-04-11"`11371138    - `"context-1m-2025-08-07"`11391140    - `"context-management-2025-06-27"`11411142    - `"model-context-window-exceeded-2025-08-26"`11431144    - `"skills-2025-10-02"`11451146    - `"fast-mode-2026-02-01"`11471148    - `"output-300k-2026-03-24"`11491150    - `"user-profiles-2026-03-24"`11511152    - `"user-profiles-2026-08-18"`11531154    - `"user-profiles-2026-09-04"`11551156    - `"advisor-tool-2026-03-01"`11571158    - `"managed-agents-2026-04-01"`11591160    - `"cache-diagnosis-2026-04-07"`11611162    - `"dreaming-2026-04-21"`11631164    - `"thinking-token-count-2026-05-13"`11651166    - `"server-side-fallback-2026-06-01"`11671168    - `"server-side-fallback-2026-07-01"`11691170    - `"fallback-credit-2026-06-01"`11711172    - `"fallback-credit-2026-07-01"`11731174    - `"agent-memory-2026-07-22"`11751176    - `"mid-conversation-tool-changes-2026-07-01"`11771178    - `"compact-2026-01-12"`11791180    - `"computer-use-2025-11-24"`11811182    - `"mcp-tunnels-2026-06-22"`11831184    - `"structured-outputs-2025-11-13"`11851186    - `"task-budgets-2026-03-13"`11871188    - `"thinking-display-updates-2026-08-18"`11891190    - `"ce-user-management-2026-07-13"`11911192    - `"mid-conversation-output-config-2026-07-01"`11931194    - `"thinking-binding-controls-2026-08-01"`11951196    - `"mid-conversation-system-clear-at-2026-08-21"`11971198    - `"compact-2026-09-04"`11991200- `"anthropic-workspace-id": optional string`12011202### Body parameters12031204- `config: optional BetaCloudConfigParams or BetaSelfHostedConfigParams or null`12051206  Updated environment configuration12071208  - `BetaCloudConfigParams object`12091210    Request params for `cloud` environment configuration.12111212    Fields default to null; on update, omitted fields preserve the1213    existing value.12141215    - `type: "cloud"`12161217      Environment type12181219    - `networking: optional BetaUnrestrictedNetwork or BetaLimitedNetworkParams or null`12201221      Network configuration policy. Omit on update to preserve the existing value.12221223      - `BetaUnrestrictedNetwork object`12241225        Unrestricted network access.12261227        - `type: "unrestricted"`12281229          Network policy type12301231      - `BetaLimitedNetworkParams object`12321233        Limited network request params.12341235        Fields default to null; on update, omitted fields preserve the1236        existing value.12371238        - `type: "limited"`12391240          Network policy type12411242        - `allow_mcp_servers: optional boolean or null`12431244          Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`.12451246        - `allow_package_managers: optional boolean or null`12471248          Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false` on creation. Must be `true` when `packages` are specified.12491250        - `allowed_hosts: optional array of string or null`12511252          Specifies domains the container can reach.12531254    - `packages: optional BetaPackagesParams or null`12551256      Specify packages (and optionally their versions) available in this environment.12571258      When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest.12591260      Under `limited` networking, requires `networking.allow_package_managers` to be `true`.12611262      - `type: optional "packages"`12631264        Package configuration type12651266        default: packages12671268      - `apt: optional array of string or null`12691270        Ubuntu/Debian packages to install12711272      - `cargo: optional array of string or null`12731274        Rust packages to install12751276      - `gem: optional array of string or null`12771278        Ruby packages to install12791280      - `go: optional array of string or null`12811282        Go packages to install12831284      - `npm: optional array of string or null`12851286        Node.js packages to install12871288      - `pip: optional array of string or null`12891290        Python packages to install12911292  - `BetaSelfHostedConfigParams object`12931294    Request params for `self_hosted` environment configuration.12951296    - `type: "self_hosted"`12971298      Environment type12991300- `description: optional string or null`13011302  Updated description of the environment. Omit to preserve; null clears to null; an empty string is stored as an empty string.13031304  maxLength: 102413051306- `metadata: optional map[string]`13071308  User-provided metadata key-value pairs. Set a value to null or empty string to delete the key.13091310- `name: optional string or null`13111312  Updated name for the environment13131314  maxLength: 256, minLength: 113151316- `scope: optional "organization" or "account" or null`13171318  The visibility scope for this environment. 'organization' makes the environment visible to all accounts. 'account' restricts visibility to the owning account only.13191320  - `"organization"`13211322  - `"account"`13231324### Returns13251326- `BetaEnvironment object`13271328  Unified Environment resource for both cloud and self-hosted environments.13291330  - `type: "environment"`13311332    The type of object (always 'environment')13331334    default: environment13351336  - `id: string`13371338    Environment identifier (e.g., 'env_...')13391340  - `archived_at: string or null`13411342    RFC 3339 timestamp when environment was archived, or null if not archived13431344  - `config: BetaCloudConfig or BetaSelfHostedConfig`13451346    Environment configuration (either Anthropic Cloud or self-hosted)13471348    - `BetaCloudConfig object`13491350      `cloud` environment configuration.13511352      - `type: "cloud"`13531354        Environment type13551356      - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork`13571358        Network configuration policy.13591360        - `BetaUnrestrictedNetwork object`13611362          Unrestricted network access.13631364          - `type: "unrestricted"`13651366            Network policy type13671368        - `BetaLimitedNetwork object`13691370          Limited network access.13711372          - `type: "limited"`13731374            Network policy type13751376          - `allow_mcp_servers: boolean`13771378            Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array.13791380          - `allow_package_managers: boolean`13811382            Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array.13831384          - `allowed_hosts: array of string`13851386            Specifies domains the container can reach.13871388      - `packages: BetaPackages`13891390        Package manager configuration.13911392        - `type: optional "packages"`13931394          Package configuration type13951396          default: packages13971398        - `apt: array of string`13991400          Ubuntu/Debian packages to install14011402        - `cargo: array of string`14031404          Rust packages to install14051406        - `gem: array of string`14071408          Ruby packages to install14091410        - `go: array of string`14111412          Go packages to install14131414        - `npm: array of string`14151416          Node.js packages to install14171418        - `pip: array of string`14191420          Python packages to install14211422    - `BetaSelfHostedConfig object`14231424      Configuration for self-hosted environments.14251426      - `type: "self_hosted"`14271428        Environment type14291430  - `created_at: string`14311432    RFC 3339 timestamp when environment was created14331434  - `description: string or null`14351436    User-provided description for the environment; null when unset14371438  - `metadata: map[string]`14391440    User-provided metadata key-value pairs14411442  - `name: string`14431444    Human-readable name for the environment14451446  - `updated_at: string`14471448    RFC 3339 timestamp when environment was last updated14491450  - `scope: optional "organization" or "account"`14511452    The visibility scope for this environment. 'organization' means visible to all accounts. 'account' means visible only to the owning account.14531454    - `"organization"`14551456    - `"account"`14571458### Example14591460```bash1461curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID \1462    -H 'Content-Type: application/json' \1463    -H 'anthropic-version: 2023-06-01' \1464    -H 'anthropic-beta: managed-agents-2026-04-01' \1465    -H "X-Api-Key: $ANTHROPIC_API_KEY" \1466    -d '{1467          "description": "Python environment with data-analysis packages."1468        }'1469```14701471#### Response (200)14721473```json1474{1475  "id": "env_011CZkZ9X2dpNyB7HsEFoRfW",1476  "archived_at": null,1477  "config": {1478    "networking": {1479      "allow_mcp_servers": false,1480      "allow_package_managers": true,1481      "allowed_hosts": [1482        "api.example.com"1483      ],1484      "type": "limited"1485    },1486    "packages": {1487      "apt": [1488        "string"1489      ],1490      "cargo": [1491        "string"1492      ],1493      "gem": [1494        "string"1495      ],1496      "go": [1497        "string"1498      ],1499      "npm": [1500        "string"1501      ],1502      "pip": [1503        "pandas",1504        "numpy"1505      ],1506      "type": "packages"1507    },1508    "type": "cloud"1509  },1510  "created_at": "2026-03-15T10:00:00Z",1511  "description": "Python environment with data-analysis packages.",1512  "metadata": {},1513  "name": "python-data-analysis",1514  "type": "environment",1515  "updated_at": "2026-03-15T10:00:00Z",1516  "scope": "organization"1517}1518```15191520## Delete Environment15211522**DELETE** `/v1/environments/{environment_id}`15231524Delete an environment by ID. Returns a confirmation of the deletion.15251526### Path parameters15271528- `environment_id: string`15291530### Headers15311532- `"anthropic-beta": optional array of AnthropicBeta`15331534  Optional header to specify the beta version(s) you want to use.15351536  - `string`15371538  - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 43 more`15391540    - `"message-batches-2024-09-24"`15411542    - `"prompt-caching-2024-07-31"`15431544    - `"computer-use-2024-10-22"`15451546    - `"computer-use-2025-01-24"`15471548    - `"pdfs-2024-09-25"`15491550    - `"token-counting-2024-11-01"`15511552    - `"token-efficient-tools-2025-02-19"`15531554    - `"output-128k-2025-02-19"`15551556    - `"files-api-2025-04-14"`15571558    - `"mcp-client-2025-04-04"`15591560    - `"mcp-client-2025-11-20"`15611562    - `"dev-full-thinking-2025-05-14"`15631564    - `"interleaved-thinking-2025-05-14"`15651566    - `"code-execution-2025-05-22"`15671568    - `"extended-cache-ttl-2025-04-11"`15691570    - `"context-1m-2025-08-07"`15711572    - `"context-management-2025-06-27"`15731574    - `"model-context-window-exceeded-2025-08-26"`15751576    - `"skills-2025-10-02"`15771578    - `"fast-mode-2026-02-01"`15791580    - `"output-300k-2026-03-24"`15811582    - `"user-profiles-2026-03-24"`15831584    - `"user-profiles-2026-08-18"`15851586    - `"user-profiles-2026-09-04"`15871588    - `"advisor-tool-2026-03-01"`15891590    - `"managed-agents-2026-04-01"`15911592    - `"cache-diagnosis-2026-04-07"`15931594    - `"dreaming-2026-04-21"`15951596    - `"thinking-token-count-2026-05-13"`15971598    - `"server-side-fallback-2026-06-01"`15991600    - `"server-side-fallback-2026-07-01"`16011602    - `"fallback-credit-2026-06-01"`16031604    - `"fallback-credit-2026-07-01"`16051606    - `"agent-memory-2026-07-22"`16071608    - `"mid-conversation-tool-changes-2026-07-01"`16091610    - `"compact-2026-01-12"`16111612    - `"computer-use-2025-11-24"`16131614    - `"mcp-tunnels-2026-06-22"`16151616    - `"structured-outputs-2025-11-13"`16171618    - `"task-budgets-2026-03-13"`16191620    - `"thinking-display-updates-2026-08-18"`16211622    - `"ce-user-management-2026-07-13"`16231624    - `"mid-conversation-output-config-2026-07-01"`16251626    - `"thinking-binding-controls-2026-08-01"`16271628    - `"mid-conversation-system-clear-at-2026-08-21"`16291630    - `"compact-2026-09-04"`16311632- `"anthropic-workspace-id": optional string`16331634### Returns16351636- `BetaEnvironmentDeleteResponse object`16371638  Response after deleting an environment.16391640  - `type: "environment_deleted"`16411642    The type of response16431644    default: environment_deleted16451646  - `id: string`16471648    Environment identifier16491650### Example16511652```bash1653curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID \1654    -X DELETE \1655    -H 'anthropic-version: 2023-06-01' \1656    -H 'anthropic-beta: managed-agents-2026-04-01' \1657    -H "X-Api-Key: $ANTHROPIC_API_KEY"1658```16591660#### Response (200)16611662```json1663{1664  "id": "env_011CZkZ9X2dpNyB7HsEFoRfW",1665  "type": "environment_deleted"1666}1667```16681669## Archive Environment16701671**POST** `/v1/environments/{environment_id}/archive`16721673Archive an environment by ID. Archived environments cannot be used to create new sessions.16741675### Path parameters16761677- `environment_id: string`16781679### Headers16801681- `"anthropic-beta": optional array of AnthropicBeta`16821683  Optional header to specify the beta version(s) you want to use.16841685  - `string`16861687  - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 43 more`16881689    - `"message-batches-2024-09-24"`16901691    - `"prompt-caching-2024-07-31"`16921693    - `"computer-use-2024-10-22"`16941695    - `"computer-use-2025-01-24"`16961697    - `"pdfs-2024-09-25"`16981699    - `"token-counting-2024-11-01"`17001701    - `"token-efficient-tools-2025-02-19"`17021703    - `"output-128k-2025-02-19"`17041705    - `"files-api-2025-04-14"`17061707    - `"mcp-client-2025-04-04"`17081709    - `"mcp-client-2025-11-20"`17101711    - `"dev-full-thinking-2025-05-14"`17121713    - `"interleaved-thinking-2025-05-14"`17141715    - `"code-execution-2025-05-22"`17161717    - `"extended-cache-ttl-2025-04-11"`17181719    - `"context-1m-2025-08-07"`17201721    - `"context-management-2025-06-27"`17221723    - `"model-context-window-exceeded-2025-08-26"`17241725    - `"skills-2025-10-02"`17261727    - `"fast-mode-2026-02-01"`17281729    - `"output-300k-2026-03-24"`17301731    - `"user-profiles-2026-03-24"`17321733    - `"user-profiles-2026-08-18"`17341735    - `"user-profiles-2026-09-04"`17361737    - `"advisor-tool-2026-03-01"`17381739    - `"managed-agents-2026-04-01"`17401741    - `"cache-diagnosis-2026-04-07"`17421743    - `"dreaming-2026-04-21"`17441745    - `"thinking-token-count-2026-05-13"`17461747    - `"server-side-fallback-2026-06-01"`17481749    - `"server-side-fallback-2026-07-01"`17501751    - `"fallback-credit-2026-06-01"`17521753    - `"fallback-credit-2026-07-01"`17541755    - `"agent-memory-2026-07-22"`17561757    - `"mid-conversation-tool-changes-2026-07-01"`17581759    - `"compact-2026-01-12"`17601761    - `"computer-use-2025-11-24"`17621763    - `"mcp-tunnels-2026-06-22"`17641765    - `"structured-outputs-2025-11-13"`17661767    - `"task-budgets-2026-03-13"`17681769    - `"thinking-display-updates-2026-08-18"`17701771    - `"ce-user-management-2026-07-13"`17721773    - `"mid-conversation-output-config-2026-07-01"`17741775    - `"thinking-binding-controls-2026-08-01"`17761777    - `"mid-conversation-system-clear-at-2026-08-21"`17781779    - `"compact-2026-09-04"`17801781- `"anthropic-workspace-id": optional string`17821783### Returns17841785- `BetaEnvironment object`17861787  Unified Environment resource for both cloud and self-hosted environments.17881789  - `type: "environment"`17901791    The type of object (always 'environment')17921793    default: environment17941795  - `id: string`17961797    Environment identifier (e.g., 'env_...')17981799  - `archived_at: string or null`18001801    RFC 3339 timestamp when environment was archived, or null if not archived18021803  - `config: BetaCloudConfig or BetaSelfHostedConfig`18041805    Environment configuration (either Anthropic Cloud or self-hosted)18061807    - `BetaCloudConfig object`18081809      `cloud` environment configuration.18101811      - `type: "cloud"`18121813        Environment type18141815      - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork`18161817        Network configuration policy.18181819        - `BetaUnrestrictedNetwork object`18201821          Unrestricted network access.18221823          - `type: "unrestricted"`18241825            Network policy type18261827        - `BetaLimitedNetwork object`18281829          Limited network access.18301831          - `type: "limited"`18321833            Network policy type18341835          - `allow_mcp_servers: boolean`18361837            Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array.18381839          - `allow_package_managers: boolean`18401841            Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array.18421843          - `allowed_hosts: array of string`18441845            Specifies domains the container can reach.18461847      - `packages: BetaPackages`18481849        Package manager configuration.18501851        - `type: optional "packages"`18521853          Package configuration type18541855          default: packages18561857        - `apt: array of string`18581859          Ubuntu/Debian packages to install18601861        - `cargo: array of string`18621863          Rust packages to install18641865        - `gem: array of string`18661867          Ruby packages to install18681869        - `go: array of string`18701871          Go packages to install18721873        - `npm: array of string`18741875          Node.js packages to install18761877        - `pip: array of string`18781879          Python packages to install18801881    - `BetaSelfHostedConfig object`18821883      Configuration for self-hosted environments.18841885      - `type: "self_hosted"`18861887        Environment type18881889  - `created_at: string`18901891    RFC 3339 timestamp when environment was created18921893  - `description: string or null`18941895    User-provided description for the environment; null when unset18961897  - `metadata: map[string]`18981899    User-provided metadata key-value pairs19001901  - `name: string`19021903    Human-readable name for the environment19041905  - `updated_at: string`19061907    RFC 3339 timestamp when environment was last updated19081909  - `scope: optional "organization" or "account"`19101911    The visibility scope for this environment. 'organization' means visible to all accounts. 'account' means visible only to the owning account.19121913    - `"organization"`19141915    - `"account"`19161917### Example19181919```bash1920curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID/archive \1921    -X POST \1922    -H 'anthropic-version: 2023-06-01' \1923    -H 'anthropic-beta: managed-agents-2026-04-01' \1924    -H "X-Api-Key: $ANTHROPIC_API_KEY"1925```19261927#### Response (200)19281929```json1930{1931  "id": "env_011CZkZ9X2dpNyB7HsEFoRfW",1932  "archived_at": null,1933  "config": {1934    "networking": {1935      "allow_mcp_servers": false,1936      "allow_package_managers": true,1937      "allowed_hosts": [1938        "api.example.com"1939      ],1940      "type": "limited"1941    },1942    "packages": {1943      "apt": [1944        "string"1945      ],1946      "cargo": [1947        "string"1948      ],1949      "gem": [1950        "string"1951      ],1952      "go": [1953        "string"1954      ],1955      "npm": [1956        "string"1957      ],1958      "pip": [1959        "pandas",1960        "numpy"1961      ],1962      "type": "packages"1963    },1964    "type": "cloud"1965  },1966  "created_at": "2026-03-15T10:00:00Z",1967  "description": "Python environment with data-analysis packages.",1968  "metadata": {},1969  "name": "python-data-analysis",1970  "type": "environment",1971  "updated_at": "2026-03-15T10:00:00Z",1972  "scope": "organization"1973}1974```19751976## Domain types19771978### Beta Cloud Config19791980- `BetaCloudConfig object`19811982  `cloud` environment configuration.19831984  - `type: "cloud"`19851986    Environment type19871988  - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork`19891990    Network configuration policy.19911992    - `BetaUnrestrictedNetwork object`19931994      Unrestricted network access.19951996      - `type: "unrestricted"`19971998        Network policy type19992000    - `BetaLimitedNetwork object`20012002      Limited network access.20032004      - `type: "limited"`20052006        Network policy type20072008      - `allow_mcp_servers: boolean`20092010        Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array.20112012      - `allow_package_managers: boolean`20132014        Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array.20152016      - `allowed_hosts: array of string`20172018        Specifies domains the container can reach.20192020  - `packages: BetaPackages`20212022    Package manager configuration.20232024    - `type: optional "packages"`20252026      Package configuration type20272028      default: packages20292030    - `apt: array of string`20312032      Ubuntu/Debian packages to install20332034    - `cargo: array of string`20352036      Rust packages to install20372038    - `gem: array of string`20392040      Ruby packages to install20412042    - `go: array of string`20432044      Go packages to install20452046    - `npm: array of string`20472048      Node.js packages to install20492050    - `pip: array of string`20512052      Python packages to install20532054### Beta Cloud Config Params20552056- `BetaCloudConfigParams object`20572058  Request params for `cloud` environment configuration.20592060  Fields default to null; on update, omitted fields preserve the2061  existing value.20622063  - `type: "cloud"`20642065    Environment type20662067  - `networking: optional BetaUnrestrictedNetwork or BetaLimitedNetworkParams or null`20682069    Network configuration policy. Omit on update to preserve the existing value.20702071    - `BetaUnrestrictedNetwork object`20722073      Unrestricted network access.20742075      - `type: "unrestricted"`20762077        Network policy type20782079    - `BetaLimitedNetworkParams object`20802081      Limited network request params.20822083      Fields default to null; on update, omitted fields preserve the2084      existing value.20852086      - `type: "limited"`20872088        Network policy type20892090      - `allow_mcp_servers: optional boolean or null`20912092        Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`.20932094      - `allow_package_managers: optional boolean or null`20952096        Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false` on creation. Must be `true` when `packages` are specified.20972098      - `allowed_hosts: optional array of string or null`20992100        Specifies domains the container can reach.21012102  - `packages: optional BetaPackagesParams or null`21032104    Specify packages (and optionally their versions) available in this environment.21052106    When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest.21072108    Under `limited` networking, requires `networking.allow_package_managers` to be `true`.21092110    - `type: optional "packages"`21112112      Package configuration type21132114      default: packages21152116    - `apt: optional array of string or null`21172118      Ubuntu/Debian packages to install21192120    - `cargo: optional array of string or null`21212122      Rust packages to install21232124    - `gem: optional array of string or null`21252126      Ruby packages to install21272128    - `go: optional array of string or null`21292130      Go packages to install21312132    - `npm: optional array of string or null`21332134      Node.js packages to install21352136    - `pip: optional array of string or null`21372138      Python packages to install21392140### Beta Environment21412142- `BetaEnvironment object`21432144  Unified Environment resource for both cloud and self-hosted environments.21452146  - `type: "environment"`21472148    The type of object (always 'environment')21492150    default: environment21512152  - `id: string`21532154    Environment identifier (e.g., 'env_...')21552156  - `archived_at: string or null`21572158    RFC 3339 timestamp when environment was archived, or null if not archived21592160  - `config: BetaCloudConfig or BetaSelfHostedConfig`21612162    Environment configuration (either Anthropic Cloud or self-hosted)21632164    - `BetaCloudConfig object`21652166      `cloud` environment configuration.21672168      - `type: "cloud"`21692170        Environment type21712172      - `networking: BetaUnrestrictedNetwork or BetaLimitedNetwork`21732174        Network configuration policy.21752176        - `BetaUnrestrictedNetwork object`21772178          Unrestricted network access.21792180          - `type: "unrestricted"`21812182            Network policy type21832184        - `BetaLimitedNetwork object`21852186          Limited network access.21872188          - `type: "limited"`21892190            Network policy type21912192          - `allow_mcp_servers: boolean`21932194            Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array.21952196          - `allow_package_managers: boolean`21972198            Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array.21992200          - `allowed_hosts: array of string`22012202            Specifies domains the container can reach.22032204      - `packages: BetaPackages`22052206        Package manager configuration.22072208        - `type: optional "packages"`22092210          Package configuration type22112212          default: packages22132214        - `apt: array of string`22152216          Ubuntu/Debian packages to install22172218        - `cargo: array of string`22192220          Rust packages to install22212222        - `gem: array of string`22232224          Ruby packages to install22252226        - `go: array of string`22272228          Go packages to install22292230        - `npm: array of string`22312232          Node.js packages to install22332234        - `pip: array of string`22352236          Python packages to install22372238    - `BetaSelfHostedConfig object`22392240      Configuration for self-hosted environments.22412242      - `type: "self_hosted"`22432244        Environment type22452246  - `created_at: string`22472248    RFC 3339 timestamp when environment was created22492250  - `description: string or null`22512252    User-provided description for the environment; null when unset22532254  - `metadata: map[string]`22552256    User-provided metadata key-value pairs22572258  - `name: string`22592260    Human-readable name for the environment22612262  - `updated_at: string`22632264    RFC 3339 timestamp when environment was last updated22652266  - `scope: optional "organization" or "account"`22672268    The visibility scope for this environment. 'organization' means visible to all accounts. 'account' means visible only to the owning account.22692270    - `"organization"`22712272    - `"account"`22732274### Beta Environment Delete Response22752276- `BetaEnvironmentDeleteResponse object`22772278  Response after deleting an environment.22792280  - `type: "environment_deleted"`22812282    The type of response22832284    default: environment_deleted22852286  - `id: string`22872288    Environment identifier22892290### Beta Limited Network22912292- `BetaLimitedNetwork object`22932294  Limited network access.22952296  - `type: "limited"`22972298    Network policy type22992300  - `allow_mcp_servers: boolean`23012302    Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array.23032304  - `allow_package_managers: boolean`23052306    Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array.23072308  - `allowed_hosts: array of string`23092310    Specifies domains the container can reach.23112312### Beta Limited Network Params23132314- `BetaLimitedNetworkParams object`23152316  Limited network request params.23172318  Fields default to null; on update, omitted fields preserve the2319  existing value.23202321  - `type: "limited"`23222323    Network policy type23242325  - `allow_mcp_servers: optional boolean or null`23262327    Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the `allowed_hosts` array. Defaults to `false`.23282329  - `allow_package_managers: optional boolean or null`23302331    Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the `allowed_hosts` array. Defaults to `false` on creation. Must be `true` when `packages` are specified.23322333  - `allowed_hosts: optional array of string or null`23342335    Specifies domains the container can reach.23362337### Beta Packages23382339- `BetaPackages object`23402341  Packages (and their versions) available in this environment.23422343  - `type: optional "packages"`23442345    Package configuration type23462347    default: packages23482349  - `apt: array of string`23502351    Ubuntu/Debian packages to install23522353  - `cargo: array of string`23542355    Rust packages to install23562357  - `gem: array of string`23582359    Ruby packages to install23602361  - `go: array of string`23622363    Go packages to install23642365  - `npm: array of string`23662367    Node.js packages to install23682369  - `pip: array of string`23702371    Python packages to install23722373### Beta Packages Params23742375- `BetaPackagesParams object`23762377  Specify packages (and optionally their versions) available in this environment.23782379  When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest.23802381  Under `limited` networking, requires `networking.allow_package_managers` to be `true`.23822383  - `type: optional "packages"`23842385    Package configuration type23862387    default: packages23882389  - `apt: optional array of string or null`23902391    Ubuntu/Debian packages to install23922393  - `cargo: optional array of string or null`23942395    Rust packages to install23962397  - `gem: optional array of string or null`23982399    Ruby packages to install24002401  - `go: optional array of string or null`24022403    Go packages to install24042405  - `npm: optional array of string or null`24062407    Node.js packages to install24082409  - `pip: optional array of string or null`24102411    Python packages to install24122413### Beta Self Hosted Config24142415- `BetaSelfHostedConfig object`24162417  Configuration for self-hosted environments.24182419  - `type: "self_hosted"`24202421    Environment type24222423### Beta Self Hosted Config Params24242425- `BetaSelfHostedConfigParams object`24262427  Request params for `self_hosted` environment configuration.24282429  - `type: "self_hosted"`24302431    Environment type24322433### Beta Unrestricted Network24342435- `BetaUnrestrictedNetwork object`24362437  Unrestricted network access.24382439  - `type: "unrestricted"`24402441    Network policy type24422443## Environments › Work24442445### Get Work Item24462447**GET** `/v1/environments/{environment_id}/work/{work_id}`24482449Note: 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.24502451Retrieve detailed information about a specific work item.24522453#### Path parameters24542455- `environment_id: string`24562457- `work_id: string`24582459#### Headers24602461- `"anthropic-beta": optional array of AnthropicBeta`24622463  Optional header to specify the beta version(s) you want to use.24642465  - `string`24662467  - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 43 more`24682469    - `"message-batches-2024-09-24"`24702471    - `"prompt-caching-2024-07-31"`24722473    - `"computer-use-2024-10-22"`24742475    - `"computer-use-2025-01-24"`24762477    - `"pdfs-2024-09-25"`24782479    - `"token-counting-2024-11-01"`24802481    - `"token-efficient-tools-2025-02-19"`24822483    - `"output-128k-2025-02-19"`24842485    - `"files-api-2025-04-14"`24862487    - `"mcp-client-2025-04-04"`24882489    - `"mcp-client-2025-11-20"`24902491    - `"dev-full-thinking-2025-05-14"`24922493    - `"interleaved-thinking-2025-05-14"`24942495    - `"code-execution-2025-05-22"`24962497    - `"extended-cache-ttl-2025-04-11"`24982499    - `"context-1m-2025-08-07"`25002501    - `"context-management-2025-06-27"`25022503    - `"model-context-window-exceeded-2025-08-26"`25042505    - `"skills-2025-10-02"`25062507    - `"fast-mode-2026-02-01"`25082509    - `"output-300k-2026-03-24"`25102511    - `"user-profiles-2026-03-24"`25122513    - `"user-profiles-2026-08-18"`25142515    - `"user-profiles-2026-09-04"`25162517    - `"advisor-tool-2026-03-01"`25182519    - `"managed-agents-2026-04-01"`25202521    - `"cache-diagnosis-2026-04-07"`25222523    - `"dreaming-2026-04-21"`25242525    - `"thinking-token-count-2026-05-13"`25262527    - `"server-side-fallback-2026-06-01"`25282529    - `"server-side-fallback-2026-07-01"`25302531    - `"fallback-credit-2026-06-01"`25322533    - `"fallback-credit-2026-07-01"`25342535    - `"agent-memory-2026-07-22"`25362537    - `"mid-conversation-tool-changes-2026-07-01"`25382539    - `"compact-2026-01-12"`25402541    - `"computer-use-2025-11-24"`25422543    - `"mcp-tunnels-2026-06-22"`25442545    - `"structured-outputs-2025-11-13"`25462547    - `"task-budgets-2026-03-13"`25482549    - `"thinking-display-updates-2026-08-18"`25502551    - `"ce-user-management-2026-07-13"`25522553    - `"mid-conversation-output-config-2026-07-01"`25542555    - `"thinking-binding-controls-2026-08-01"`25562557    - `"mid-conversation-system-clear-at-2026-08-21"`25582559    - `"compact-2026-09-04"`25602561- `"anthropic-workspace-id": optional string`25622563#### Returns25642565- `BetaSelfHostedWork object`25662567  Work resource representing a unit of work in a self-hosted environment.25682569  Work items are queued when sessions are created or when long-dormant sessions2570  receive new messages. The environment worker polls for work to execute in a2571  self-hosted sandbox.25722573  - `type: "work"`25742575    The type of object (always 'work')25762577    default: work25782579  - `id: string`25802581    Work identifier (e.g., 'work_...')25822583  - `acknowledged_at: string or null`25842585    RFC 3339 timestamp when the work item was acknowledged and assigned to a self-hosted sandbox25862587  - `created_at: string`25882589    RFC 3339 timestamp when work was created25902591  - `data: BetaSessionWorkData`25922593    The actual work to be performed25942595    - `type: "session"`25962597      Type of work data25982599    - `id: string`26002601      Session identifier (e.g., 'session_...')26022603  - `environment_id: string`26042605    Environment identifier this work belongs to (e.g., `env_...`)26062607  - `latest_heartbeat_at: string or null`26082609    RFC 3339 timestamp of the most recent heartbeat26102611  - `metadata: map[string]`26122613    User-provided metadata key-value pairs associated with this work item26142615  - `secret: string or null`26162617    Credential payload used by the environment worker to execute this work item. May be populated when polling for work; null on all other retrieval paths.26182619  - `started_at: string or null`26202621    RFC 3339 timestamp when work execution started26222623  - `state: "queued" or "starting" or "active" or 2 more`26242625    Current state of the work item26262627    - `"queued"`26282629    - `"starting"`26302631    - `"active"`26322633    - `"stopping"`26342635    - `"stopped"`26362637  - `stop_requested_at: string or null`26382639    RFC 3339 timestamp when stop was requested26402641  - `stopped_at: string or null`26422643    RFC 3339 timestamp when work execution stopped26442645#### Example26462647```bash2648curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID/work/$WORK_ID \2649    -H 'anthropic-version: 2023-06-01' \2650    -H 'anthropic-beta: managed-agents-2026-04-01' \2651    -H "X-Api-Key: $ANTHROPIC_API_KEY"2652```26532654##### Response (200)26552656```json2657{2658  "id": "id",2659  "acknowledged_at": "acknowledged_at",2660  "created_at": "created_at",2661  "data": {2662    "id": "id",2663    "type": "session"2664  },2665  "environment_id": "environment_id",2666  "latest_heartbeat_at": "latest_heartbeat_at",2667  "metadata": {2668    "foo": "string"2669  },2670  "secret": "secret",2671  "started_at": "started_at",2672  "state": "queued",2673  "stop_requested_at": "stop_requested_at",2674  "stopped_at": "stopped_at",2675  "type": "work"2676}2677```26782679### Poll for Work26802681**GET** `/v1/environments/{environment_id}/work/poll`26822683Note: 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.26842685Long poll for work items in the queue.26862687#### Path parameters26882689- `environment_id: string`26902691#### Query parameters26922693- `block_ms: optional number`26942695  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).26962697  minimum: 126982699- `reclaim_older_than_ms: optional number`27002701  Reclaim unacknowledged work items older than this many milliseconds. If omitted, uses the default (5000ms).27022703  minimum: 127042705#### Headers27062707- `"anthropic-beta": optional array of AnthropicBeta`27082709  Optional header to specify the beta version(s) you want to use.27102711  - `string`27122713  - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 43 more`27142715    - `"message-batches-2024-09-24"`27162717    - `"prompt-caching-2024-07-31"`27182719    - `"computer-use-2024-10-22"`27202721    - `"computer-use-2025-01-24"`27222723    - `"pdfs-2024-09-25"`27242725    - `"token-counting-2024-11-01"`27262727    - `"token-efficient-tools-2025-02-19"`27282729    - `"output-128k-2025-02-19"`27302731    - `"files-api-2025-04-14"`27322733    - `"mcp-client-2025-04-04"`27342735    - `"mcp-client-2025-11-20"`27362737    - `"dev-full-thinking-2025-05-14"`27382739    - `"interleaved-thinking-2025-05-14"`27402741    - `"code-execution-2025-05-22"`27422743    - `"extended-cache-ttl-2025-04-11"`27442745    - `"context-1m-2025-08-07"`27462747    - `"context-management-2025-06-27"`27482749    - `"model-context-window-exceeded-2025-08-26"`27502751    - `"skills-2025-10-02"`27522753    - `"fast-mode-2026-02-01"`27542755    - `"output-300k-2026-03-24"`27562757    - `"user-profiles-2026-03-24"`27582759    - `"user-profiles-2026-08-18"`27602761    - `"user-profiles-2026-09-04"`27622763    - `"advisor-tool-2026-03-01"`27642765    - `"managed-agents-2026-04-01"`27662767    - `"cache-diagnosis-2026-04-07"`27682769    - `"dreaming-2026-04-21"`27702771    - `"thinking-token-count-2026-05-13"`27722773    - `"server-side-fallback-2026-06-01"`27742775    - `"server-side-fallback-2026-07-01"`27762777    - `"fallback-credit-2026-06-01"`27782779    - `"fallback-credit-2026-07-01"`27802781    - `"agent-memory-2026-07-22"`27822783    - `"mid-conversation-tool-changes-2026-07-01"`27842785    - `"compact-2026-01-12"`27862787    - `"computer-use-2025-11-24"`27882789    - `"mcp-tunnels-2026-06-22"`27902791    - `"structured-outputs-2025-11-13"`27922793    - `"task-budgets-2026-03-13"`27942795    - `"thinking-display-updates-2026-08-18"`27962797    - `"ce-user-management-2026-07-13"`27982799    - `"mid-conversation-output-config-2026-07-01"`28002801    - `"thinking-binding-controls-2026-08-01"`28022803    - `"mid-conversation-system-clear-at-2026-08-21"`28042805    - `"compact-2026-09-04"`28062807- `"Anthropic-Worker-ID": optional string`28082809  Unique identifier for the specific worker polling, used to track aggregated environment-level work metrics in Console28102811#### Returns28122813- `BetaSelfHostedWork object`28142815  Work resource representing a unit of work in a self-hosted environment.28162817  Work items are queued when sessions are created or when long-dormant sessions2818  receive new messages. The environment worker polls for work to execute in a2819  self-hosted sandbox.28202821  - `type: "work"`28222823    The type of object (always 'work')28242825    default: work28262827  - `id: string`28282829    Work identifier (e.g., 'work_...')28302831  - `acknowledged_at: string or null`28322833    RFC 3339 timestamp when the work item was acknowledged and assigned to a self-hosted sandbox28342835  - `created_at: string`28362837    RFC 3339 timestamp when work was created28382839  - `data: BetaSessionWorkData`28402841    The actual work to be performed28422843    - `type: "session"`28442845      Type of work data28462847    - `id: string`28482849      Session identifier (e.g., 'session_...')28502851  - `environment_id: string`28522853    Environment identifier this work belongs to (e.g., `env_...`)28542855  - `latest_heartbeat_at: string or null`28562857    RFC 3339 timestamp of the most recent heartbeat28582859  - `metadata: map[string]`28602861    User-provided metadata key-value pairs associated with this work item28622863  - `secret: string or null`28642865    Credential payload used by the environment worker to execute this work item. May be populated when polling for work; null on all other retrieval paths.28662867  - `started_at: string or null`28682869    RFC 3339 timestamp when work execution started28702871  - `state: "queued" or "starting" or "active" or 2 more`28722873    Current state of the work item28742875    - `"queued"`28762877    - `"starting"`28782879    - `"active"`28802881    - `"stopping"`28822883    - `"stopped"`28842885  - `stop_requested_at: string or null`28862887    RFC 3339 timestamp when stop was requested28882889  - `stopped_at: string or null`28902891    RFC 3339 timestamp when work execution stopped28922893#### Example28942895```bash2896curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID/work/poll \2897    -H 'anthropic-version: 2023-06-01' \2898    -H 'anthropic-beta: managed-agents-2026-04-01' \2899    -H "X-Api-Key: $ANTHROPIC_API_KEY"2900```29012902##### Response (200)29032904```json2905{2906  "id": "id",2907  "acknowledged_at": "acknowledged_at",2908  "created_at": "created_at",2909  "data": {2910    "id": "id",2911    "type": "session"2912  },2913  "environment_id": "environment_id",2914  "latest_heartbeat_at": "latest_heartbeat_at",2915  "metadata": {2916    "foo": "string"2917  },2918  "secret": "secret",2919  "started_at": "started_at",2920  "state": "queued",2921  "stop_requested_at": "stop_requested_at",2922  "stopped_at": "stopped_at",2923  "type": "work"2924}2925```29262927### Acknowledge Work29282929**POST** `/v1/environments/{environment_id}/work/{work_id}/ack`29302931Note: 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.29322933Acknowledge receipt of a work item, transitioning it from 'queued' to 'starting' and removing it from the queue.29342935#### Path parameters29362937- `environment_id: string`29382939- `work_id: string`29402941#### Headers29422943- `"anthropic-beta": optional array of AnthropicBeta`29442945  Optional header to specify the beta version(s) you want to use.29462947  - `string`29482949  - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 43 more`29502951    - `"message-batches-2024-09-24"`29522953    - `"prompt-caching-2024-07-31"`29542955    - `"computer-use-2024-10-22"`29562957    - `"computer-use-2025-01-24"`29582959    - `"pdfs-2024-09-25"`29602961    - `"token-counting-2024-11-01"`29622963    - `"token-efficient-tools-2025-02-19"`29642965    - `"output-128k-2025-02-19"`29662967    - `"files-api-2025-04-14"`29682969    - `"mcp-client-2025-04-04"`29702971    - `"mcp-client-2025-11-20"`29722973    - `"dev-full-thinking-2025-05-14"`29742975    - `"interleaved-thinking-2025-05-14"`29762977    - `"code-execution-2025-05-22"`29782979    - `"extended-cache-ttl-2025-04-11"`29802981    - `"context-1m-2025-08-07"`29822983    - `"context-management-2025-06-27"`29842985    - `"model-context-window-exceeded-2025-08-26"`29862987    - `"skills-2025-10-02"`29882989    - `"fast-mode-2026-02-01"`29902991    - `"output-300k-2026-03-24"`29922993    - `"user-profiles-2026-03-24"`29942995    - `"user-profiles-2026-08-18"`29962997    - `"user-profiles-2026-09-04"`29982999    - `"advisor-tool-2026-03-01"`30003001    - `"managed-agents-2026-04-01"`30023003    - `"cache-diagnosis-2026-04-07"`30043005    - `"dreaming-2026-04-21"`30063007    - `"thinking-token-count-2026-05-13"`30083009    - `"server-side-fallback-2026-06-01"`30103011    - `"server-side-fallback-2026-07-01"`30123013    - `"fallback-credit-2026-06-01"`30143015    - `"fallback-credit-2026-07-01"`30163017    - `"agent-memory-2026-07-22"`30183019    - `"mid-conversation-tool-changes-2026-07-01"`30203021    - `"compact-2026-01-12"`30223023    - `"computer-use-2025-11-24"`30243025    - `"mcp-tunnels-2026-06-22"`30263027    - `"structured-outputs-2025-11-13"`30283029    - `"task-budgets-2026-03-13"`30303031    - `"thinking-display-updates-2026-08-18"`30323033    - `"ce-user-management-2026-07-13"`30343035    - `"mid-conversation-output-config-2026-07-01"`30363037    - `"thinking-binding-controls-2026-08-01"`30383039    - `"mid-conversation-system-clear-at-2026-08-21"`30403041    - `"compact-2026-09-04"`30423043#### Returns30443045- `BetaSelfHostedWork object`30463047  Work resource representing a unit of work in a self-hosted environment.30483049  Work items are queued when sessions are created or when long-dormant sessions3050  receive new messages. The environment worker polls for work to execute in a3051  self-hosted sandbox.30523053  - `type: "work"`30543055    The type of object (always 'work')30563057    default: work30583059  - `id: string`30603061    Work identifier (e.g., 'work_...')30623063  - `acknowledged_at: string or null`30643065    RFC 3339 timestamp when the work item was acknowledged and assigned to a self-hosted sandbox30663067  - `created_at: string`30683069    RFC 3339 timestamp when work was created30703071  - `data: BetaSessionWorkData`30723073    The actual work to be performed30743075    - `type: "session"`30763077      Type of work data30783079    - `id: string`30803081      Session identifier (e.g., 'session_...')30823083  - `environment_id: string`30843085    Environment identifier this work belongs to (e.g., `env_...`)30863087  - `latest_heartbeat_at: string or null`30883089    RFC 3339 timestamp of the most recent heartbeat30903091  - `metadata: map[string]`30923093    User-provided metadata key-value pairs associated with this work item30943095  - `secret: string or null`30963097    Credential payload used by the environment worker to execute this work item. May be populated when polling for work; null on all other retrieval paths.30983099  - `started_at: string or null`31003101    RFC 3339 timestamp when work execution started31023103  - `state: "queued" or "starting" or "active" or 2 more`31043105    Current state of the work item31063107    - `"queued"`31083109    - `"starting"`31103111    - `"active"`31123113    - `"stopping"`31143115    - `"stopped"`31163117  - `stop_requested_at: string or null`31183119    RFC 3339 timestamp when stop was requested31203121  - `stopped_at: string or null`31223123    RFC 3339 timestamp when work execution stopped31243125#### Example31263127```bash3128curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID/work/$WORK_ID/ack \3129    -X POST \3130    -H 'anthropic-version: 2023-06-01' \3131    -H 'anthropic-beta: managed-agents-2026-04-01' \3132    -H "X-Api-Key: $ANTHROPIC_API_KEY"3133```31343135##### Response (200)31363137```json3138{3139  "id": "id",3140  "acknowledged_at": "acknowledged_at",3141  "created_at": "created_at",3142  "data": {3143    "id": "id",3144    "type": "session"3145  },3146  "environment_id": "environment_id",3147  "latest_heartbeat_at": "latest_heartbeat_at",3148  "metadata": {3149    "foo": "string"3150  },3151  "secret": "secret",3152  "started_at": "started_at",3153  "state": "queued",3154  "stop_requested_at": "stop_requested_at",3155  "stopped_at": "stopped_at",3156  "type": "work"3157}3158```31593160### Record Heartbeat31613162**POST** `/v1/environments/{environment_id}/work/{work_id}/heartbeat`31633164Note: 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.31653166Record a heartbeat for a work item to maintain the lease.31673168#### Path parameters31693170- `environment_id: string`31713172- `work_id: string`31733174#### Query parameters31753176- `desired_ttl_seconds: optional number`31773178  Desired TTL in seconds31793180- `expected_last_heartbeat: optional string`31813182  Expected last_heartbeat for conditional update (optimistic concurrency). Use literal 'NO_HEARTBEAT' to claim an unclaimed lease (first heartbeat). For subsequent heartbeats, echo the server's previous last_heartbeat value exactly. Returns 412 Precondition Failed if the actual value doesn't match.31833184#### Headers31853186- `"anthropic-beta": optional array of AnthropicBeta`31873188  Optional header to specify the beta version(s) you want to use.31893190  - `string`31913192  - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 43 more`31933194    - `"message-batches-2024-09-24"`31953196    - `"prompt-caching-2024-07-31"`31973198    - `"computer-use-2024-10-22"`31993200    - `"computer-use-2025-01-24"`32013202    - `"pdfs-2024-09-25"`32033204    - `"token-counting-2024-11-01"`32053206    - `"token-efficient-tools-2025-02-19"`32073208    - `"output-128k-2025-02-19"`32093210    - `"files-api-2025-04-14"`32113212    - `"mcp-client-2025-04-04"`32133214    - `"mcp-client-2025-11-20"`32153216    - `"dev-full-thinking-2025-05-14"`32173218    - `"interleaved-thinking-2025-05-14"`32193220    - `"code-execution-2025-05-22"`32213222    - `"extended-cache-ttl-2025-04-11"`32233224    - `"context-1m-2025-08-07"`32253226    - `"context-management-2025-06-27"`32273228    - `"model-context-window-exceeded-2025-08-26"`32293230    - `"skills-2025-10-02"`32313232    - `"fast-mode-2026-02-01"`32333234    - `"output-300k-2026-03-24"`32353236    - `"user-profiles-2026-03-24"`32373238    - `"user-profiles-2026-08-18"`32393240    - `"user-profiles-2026-09-04"`32413242    - `"advisor-tool-2026-03-01"`32433244    - `"managed-agents-2026-04-01"`32453246    - `"cache-diagnosis-2026-04-07"`32473248    - `"dreaming-2026-04-21"`32493250    - `"thinking-token-count-2026-05-13"`32513252    - `"server-side-fallback-2026-06-01"`32533254    - `"server-side-fallback-2026-07-01"`32553256    - `"fallback-credit-2026-06-01"`32573258    - `"fallback-credit-2026-07-01"`32593260    - `"agent-memory-2026-07-22"`32613262    - `"mid-conversation-tool-changes-2026-07-01"`32633264    - `"compact-2026-01-12"`32653266    - `"computer-use-2025-11-24"`32673268    - `"mcp-tunnels-2026-06-22"`32693270    - `"structured-outputs-2025-11-13"`32713272    - `"task-budgets-2026-03-13"`32733274    - `"thinking-display-updates-2026-08-18"`32753276    - `"ce-user-management-2026-07-13"`32773278    - `"mid-conversation-output-config-2026-07-01"`32793280    - `"thinking-binding-controls-2026-08-01"`32813282    - `"mid-conversation-system-clear-at-2026-08-21"`32833284    - `"compact-2026-09-04"`32853286#### Returns32873288- `BetaSelfHostedWorkHeartbeatResponse object`32893290  Response after recording a heartbeat for a work item.32913292  - `type: "work_heartbeat"`32933294    The type of response32953296    default: work_heartbeat32973298  - `last_heartbeat: string`32993300    RFC 3339 timestamp of the actual heartbeat from DB33013302  - `lease_extended: boolean`33033304    Whether the heartbeat succeeded in extending the lease33053306  - `state: "queued" or "starting" or "active" or 2 more`33073308    Current state of the work item (active/stopping/stopped)33093310    - `"queued"`33113312    - `"starting"`33133314    - `"active"`33153316    - `"stopping"`33173318    - `"stopped"`33193320  - `ttl_seconds: number`33213322    Effective TTL applied to the lease33233324#### Example33253326```bash3327curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID/work/$WORK_ID/heartbeat \3328    -X POST \3329    -H 'anthropic-version: 2023-06-01' \3330    -H 'anthropic-beta: managed-agents-2026-04-01' \3331    -H "X-Api-Key: $ANTHROPIC_API_KEY"3332```33333334##### Response (200)33353336```json3337{3338  "last_heartbeat": "last_heartbeat",3339  "lease_extended": true,3340  "state": "queued",3341  "ttl_seconds": 0,3342  "type": "work_heartbeat"3343}3344```33453346### Stop Work33473348**POST** `/v1/environments/{environment_id}/work/{work_id}/stop`33493350Note: 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.33513352Stop a work item, initiating graceful or forced shutdown.33533354#### Path parameters33553356- `environment_id: string`33573358- `work_id: string`33593360#### Headers33613362- `"anthropic-beta": optional array of AnthropicBeta`33633364  Optional header to specify the beta version(s) you want to use.33653366  - `string`33673368  - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 43 more`33693370    - `"message-batches-2024-09-24"`33713372    - `"prompt-caching-2024-07-31"`33733374    - `"computer-use-2024-10-22"`33753376    - `"computer-use-2025-01-24"`33773378    - `"pdfs-2024-09-25"`33793380    - `"token-counting-2024-11-01"`33813382    - `"token-efficient-tools-2025-02-19"`33833384    - `"output-128k-2025-02-19"`33853386    - `"files-api-2025-04-14"`33873388    - `"mcp-client-2025-04-04"`33893390    - `"mcp-client-2025-11-20"`33913392    - `"dev-full-thinking-2025-05-14"`33933394    - `"interleaved-thinking-2025-05-14"`33953396    - `"code-execution-2025-05-22"`33973398    - `"extended-cache-ttl-2025-04-11"`33993400    - `"context-1m-2025-08-07"`34013402    - `"context-management-2025-06-27"`34033404    - `"model-context-window-exceeded-2025-08-26"`34053406    - `"skills-2025-10-02"`34073408    - `"fast-mode-2026-02-01"`34093410    - `"output-300k-2026-03-24"`34113412    - `"user-profiles-2026-03-24"`34133414    - `"user-profiles-2026-08-18"`34153416    - `"user-profiles-2026-09-04"`34173418    - `"advisor-tool-2026-03-01"`34193420    - `"managed-agents-2026-04-01"`34213422    - `"cache-diagnosis-2026-04-07"`34233424    - `"dreaming-2026-04-21"`34253426    - `"thinking-token-count-2026-05-13"`34273428    - `"server-side-fallback-2026-06-01"`34293430    - `"server-side-fallback-2026-07-01"`34313432    - `"fallback-credit-2026-06-01"`34333434    - `"fallback-credit-2026-07-01"`34353436    - `"agent-memory-2026-07-22"`34373438    - `"mid-conversation-tool-changes-2026-07-01"`34393440    - `"compact-2026-01-12"`34413442    - `"computer-use-2025-11-24"`34433444    - `"mcp-tunnels-2026-06-22"`34453446    - `"structured-outputs-2025-11-13"`34473448    - `"task-budgets-2026-03-13"`34493450    - `"thinking-display-updates-2026-08-18"`34513452    - `"ce-user-management-2026-07-13"`34533454    - `"mid-conversation-output-config-2026-07-01"`34553456    - `"thinking-binding-controls-2026-08-01"`34573458    - `"mid-conversation-system-clear-at-2026-08-21"`34593460    - `"compact-2026-09-04"`34613462- `"anthropic-workspace-id": optional string`34633464#### Body parameters34653466- `force: optional boolean`34673468  If true, immediately stop work without graceful shutdown34693470  default: false34713472#### Returns34733474- `BetaSelfHostedWork object`34753476  Work resource representing a unit of work in a self-hosted environment.34773478  Work items are queued when sessions are created or when long-dormant sessions3479  receive new messages. The environment worker polls for work to execute in a3480  self-hosted sandbox.34813482  - `type: "work"`34833484    The type of object (always 'work')34853486    default: work34873488  - `id: string`34893490    Work identifier (e.g., 'work_...')34913492  - `acknowledged_at: string or null`34933494    RFC 3339 timestamp when the work item was acknowledged and assigned to a self-hosted sandbox34953496  - `created_at: string`34973498    RFC 3339 timestamp when work was created34993500  - `data: BetaSessionWorkData`35013502    The actual work to be performed35033504    - `type: "session"`35053506      Type of work data35073508    - `id: string`35093510      Session identifier (e.g., 'session_...')35113512  - `environment_id: string`35133514    Environment identifier this work belongs to (e.g., `env_...`)35153516  - `latest_heartbeat_at: string or null`35173518    RFC 3339 timestamp of the most recent heartbeat35193520  - `metadata: map[string]`35213522    User-provided metadata key-value pairs associated with this work item35233524  - `secret: string or null`35253526    Credential payload used by the environment worker to execute this work item. May be populated when polling for work; null on all other retrieval paths.35273528  - `started_at: string or null`35293530    RFC 3339 timestamp when work execution started35313532  - `state: "queued" or "starting" or "active" or 2 more`35333534    Current state of the work item35353536    - `"queued"`35373538    - `"starting"`35393540    - `"active"`35413542    - `"stopping"`35433544    - `"stopped"`35453546  - `stop_requested_at: string or null`35473548    RFC 3339 timestamp when stop was requested35493550  - `stopped_at: string or null`35513552    RFC 3339 timestamp when work execution stopped35533554#### Example35553556```bash3557curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID/work/$WORK_ID/stop \3558    -H 'Content-Type: application/json' \3559    -H 'anthropic-version: 2023-06-01' \3560    -H 'anthropic-beta: managed-agents-2026-04-01' \3561    -H "X-Api-Key: $ANTHROPIC_API_KEY" \3562    -d '{}'3563```35643565##### Response (200)35663567```json3568{3569  "id": "id",3570  "acknowledged_at": "acknowledged_at",3571  "created_at": "created_at",3572  "data": {3573    "id": "id",3574    "type": "session"3575  },3576  "environment_id": "environment_id",3577  "latest_heartbeat_at": "latest_heartbeat_at",3578  "metadata": {3579    "foo": "string"3580  },3581  "secret": "secret",3582  "started_at": "started_at",3583  "state": "queued",3584  "stop_requested_at": "stop_requested_at",3585  "stopped_at": "stopped_at",3586  "type": "work"3587}3588```35893590### List Work Items35913592**GET** `/v1/environments/{environment_id}/work`35933594Note: 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.35953596List work items in an environment.35973598#### Path parameters35993600- `environment_id: string`36013602#### Query parameters36033604- `limit: optional number`36053606  Maximum number of work items to return36073608  default: 20, maximum: 1000, minimum: 136093610- `page: optional string`36113612  Opaque cursor from previous response for pagination36133614#### Headers36153616- `"anthropic-beta": optional array of AnthropicBeta`36173618  Optional header to specify the beta version(s) you want to use.36193620  - `string`36213622  - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 43 more`36233624    - `"message-batches-2024-09-24"`36253626    - `"prompt-caching-2024-07-31"`36273628    - `"computer-use-2024-10-22"`36293630    - `"computer-use-2025-01-24"`36313632    - `"pdfs-2024-09-25"`36333634    - `"token-counting-2024-11-01"`36353636    - `"token-efficient-tools-2025-02-19"`36373638    - `"output-128k-2025-02-19"`36393640    - `"files-api-2025-04-14"`36413642    - `"mcp-client-2025-04-04"`36433644    - `"mcp-client-2025-11-20"`36453646    - `"dev-full-thinking-2025-05-14"`36473648    - `"interleaved-thinking-2025-05-14"`36493650    - `"code-execution-2025-05-22"`36513652    - `"extended-cache-ttl-2025-04-11"`36533654    - `"context-1m-2025-08-07"`36553656    - `"context-management-2025-06-27"`36573658    - `"model-context-window-exceeded-2025-08-26"`36593660    - `"skills-2025-10-02"`36613662    - `"fast-mode-2026-02-01"`36633664    - `"output-300k-2026-03-24"`36653666    - `"user-profiles-2026-03-24"`36673668    - `"user-profiles-2026-08-18"`36693670    - `"user-profiles-2026-09-04"`36713672    - `"advisor-tool-2026-03-01"`36733674    - `"managed-agents-2026-04-01"`36753676    - `"cache-diagnosis-2026-04-07"`36773678    - `"dreaming-2026-04-21"`36793680    - `"thinking-token-count-2026-05-13"`36813682    - `"server-side-fallback-2026-06-01"`36833684    - `"server-side-fallback-2026-07-01"`36853686    - `"fallback-credit-2026-06-01"`36873688    - `"fallback-credit-2026-07-01"`36893690    - `"agent-memory-2026-07-22"`36913692    - `"mid-conversation-tool-changes-2026-07-01"`36933694    - `"compact-2026-01-12"`36953696    - `"computer-use-2025-11-24"`36973698    - `"mcp-tunnels-2026-06-22"`36993700    - `"structured-outputs-2025-11-13"`37013702    - `"task-budgets-2026-03-13"`37033704    - `"thinking-display-updates-2026-08-18"`37053706    - `"ce-user-management-2026-07-13"`37073708    - `"mid-conversation-output-config-2026-07-01"`37093710    - `"thinking-binding-controls-2026-08-01"`37113712    - `"mid-conversation-system-clear-at-2026-08-21"`37133714    - `"compact-2026-09-04"`37153716#### Returns37173718- `BetaSelfHostedWorkListResponse object`37193720  Response when listing work items with cursor-based pagination.37213722  - `data: array of BetaSelfHostedWork`37233724    List of work items37253726    - `type: "work"`37273728      The type of object (always 'work')37293730      default: work37313732    - `id: string`37333734      Work identifier (e.g., 'work_...')37353736    - `acknowledged_at: string or null`37373738      RFC 3339 timestamp when the work item was acknowledged and assigned to a self-hosted sandbox37393740    - `created_at: string`37413742      RFC 3339 timestamp when work was created37433744    - `data: BetaSessionWorkData`37453746      The actual work to be performed37473748      - `type: "session"`37493750        Type of work data37513752      - `id: string`37533754        Session identifier (e.g., 'session_...')37553756    - `environment_id: string`37573758      Environment identifier this work belongs to (e.g., `env_...`)37593760    - `latest_heartbeat_at: string or null`37613762      RFC 3339 timestamp of the most recent heartbeat37633764    - `metadata: map[string]`37653766      User-provided metadata key-value pairs associated with this work item37673768    - `secret: string or null`37693770      Credential payload used by the environment worker to execute this work item. May be populated when polling for work; null on all other retrieval paths.37713772    - `started_at: string or null`37733774      RFC 3339 timestamp when work execution started37753776    - `state: "queued" or "starting" or "active" or 2 more`37773778      Current state of the work item37793780      - `"queued"`37813782      - `"starting"`37833784      - `"active"`37853786      - `"stopping"`37873788      - `"stopped"`37893790    - `stop_requested_at: string or null`37913792      RFC 3339 timestamp when stop was requested37933794    - `stopped_at: string or null`37953796      RFC 3339 timestamp when work execution stopped37973798  - `next_page: string or null`37993800    Opaque cursor for fetching the next page of results38013802#### Example38033804```bash3805curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID/work \3806    -H 'anthropic-version: 2023-06-01' \3807    -H 'anthropic-beta: managed-agents-2026-04-01' \3808    -H "X-Api-Key: $ANTHROPIC_API_KEY"3809```38103811##### Response (200)38123813```json3814{3815  "data": [3816    {3817      "id": "id",3818      "acknowledged_at": "acknowledged_at",3819      "created_at": "created_at",3820      "data": {3821        "id": "id",3822        "type": "session"3823      },3824      "environment_id": "environment_id",3825      "latest_heartbeat_at": "latest_heartbeat_at",3826      "metadata": {3827        "foo": "string"3828      },3829      "secret": "secret",3830      "started_at": "started_at",3831      "state": "queued",3832      "stop_requested_at": "stop_requested_at",3833      "stopped_at": "stopped_at",3834      "type": "work"3835    }3836  ],3837  "next_page": "next_page"3838}3839```38403841### Update Work Item38423843**POST** `/v1/environments/{environment_id}/work/{work_id}`38443845Note: 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.38463847Update work item metadata with merge semantics.38483849#### Path parameters38503851- `environment_id: string`38523853- `work_id: string`38543855#### Headers38563857- `"anthropic-beta": optional array of AnthropicBeta`38583859  Optional header to specify the beta version(s) you want to use.38603861  - `string`38623863  - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 43 more`38643865    - `"message-batches-2024-09-24"`38663867    - `"prompt-caching-2024-07-31"`38683869    - `"computer-use-2024-10-22"`38703871    - `"computer-use-2025-01-24"`38723873    - `"pdfs-2024-09-25"`38743875    - `"token-counting-2024-11-01"`38763877    - `"token-efficient-tools-2025-02-19"`38783879    - `"output-128k-2025-02-19"`38803881    - `"files-api-2025-04-14"`38823883    - `"mcp-client-2025-04-04"`38843885    - `"mcp-client-2025-11-20"`38863887    - `"dev-full-thinking-2025-05-14"`38883889    - `"interleaved-thinking-2025-05-14"`38903891    - `"code-execution-2025-05-22"`38923893    - `"extended-cache-ttl-2025-04-11"`38943895    - `"context-1m-2025-08-07"`38963897    - `"context-management-2025-06-27"`38983899    - `"model-context-window-exceeded-2025-08-26"`39003901    - `"skills-2025-10-02"`39023903    - `"fast-mode-2026-02-01"`39043905    - `"output-300k-2026-03-24"`39063907    - `"user-profiles-2026-03-24"`39083909    - `"user-profiles-2026-08-18"`39103911    - `"user-profiles-2026-09-04"`39123913    - `"advisor-tool-2026-03-01"`39143915    - `"managed-agents-2026-04-01"`39163917    - `"cache-diagnosis-2026-04-07"`39183919    - `"dreaming-2026-04-21"`39203921    - `"thinking-token-count-2026-05-13"`39223923    - `"server-side-fallback-2026-06-01"`39243925    - `"server-side-fallback-2026-07-01"`39263927    - `"fallback-credit-2026-06-01"`39283929    - `"fallback-credit-2026-07-01"`39303931    - `"agent-memory-2026-07-22"`39323933    - `"mid-conversation-tool-changes-2026-07-01"`39343935    - `"compact-2026-01-12"`39363937    - `"computer-use-2025-11-24"`39383939    - `"mcp-tunnels-2026-06-22"`39403941    - `"structured-outputs-2025-11-13"`39423943    - `"task-budgets-2026-03-13"`39443945    - `"thinking-display-updates-2026-08-18"`39463947    - `"ce-user-management-2026-07-13"`39483949    - `"mid-conversation-output-config-2026-07-01"`39503951    - `"thinking-binding-controls-2026-08-01"`39523953    - `"mid-conversation-system-clear-at-2026-08-21"`39543955    - `"compact-2026-09-04"`39563957- `"anthropic-workspace-id": optional string`39583959#### Body parameters39603961- `metadata: map[string]`39623963  Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve existing metadata.39643965#### Returns39663967- `BetaSelfHostedWork object`39683969  Work resource representing a unit of work in a self-hosted environment.39703971  Work items are queued when sessions are created or when long-dormant sessions3972  receive new messages. The environment worker polls for work to execute in a3973  self-hosted sandbox.39743975  - `type: "work"`39763977    The type of object (always 'work')39783979    default: work39803981  - `id: string`39823983    Work identifier (e.g., 'work_...')39843985  - `acknowledged_at: string or null`39863987    RFC 3339 timestamp when the work item was acknowledged and assigned to a self-hosted sandbox39883989  - `created_at: string`39903991    RFC 3339 timestamp when work was created39923993  - `data: BetaSessionWorkData`39943995    The actual work to be performed39963997    - `type: "session"`39983999      Type of work data40004001    - `id: string`40024003      Session identifier (e.g., 'session_...')40044005  - `environment_id: string`40064007    Environment identifier this work belongs to (e.g., `env_...`)40084009  - `latest_heartbeat_at: string or null`40104011    RFC 3339 timestamp of the most recent heartbeat40124013  - `metadata: map[string]`40144015    User-provided metadata key-value pairs associated with this work item40164017  - `secret: string or null`40184019    Credential payload used by the environment worker to execute this work item. May be populated when polling for work; null on all other retrieval paths.40204021  - `started_at: string or null`40224023    RFC 3339 timestamp when work execution started40244025  - `state: "queued" or "starting" or "active" or 2 more`40264027    Current state of the work item40284029    - `"queued"`40304031    - `"starting"`40324033    - `"active"`40344035    - `"stopping"`40364037    - `"stopped"`40384039  - `stop_requested_at: string or null`40404041    RFC 3339 timestamp when stop was requested40424043  - `stopped_at: string or null`40444045    RFC 3339 timestamp when work execution stopped40464047#### Example40484049```bash4050curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID/work/$WORK_ID \4051    -H 'Content-Type: application/json' \4052    -H 'anthropic-version: 2023-06-01' \4053    -H 'anthropic-beta: managed-agents-2026-04-01' \4054    -H "X-Api-Key: $ANTHROPIC_API_KEY" \4055    -d '{4056          "metadata": {4057            "foo": "string"4058          }4059        }'4060```40614062##### Response (200)40634064```json4065{4066  "id": "id",4067  "acknowledged_at": "acknowledged_at",4068  "created_at": "created_at",4069  "data": {4070    "id": "id",4071    "type": "session"4072  },4073  "environment_id": "environment_id",4074  "latest_heartbeat_at": "latest_heartbeat_at",4075  "metadata": {4076    "foo": "string"4077  },4078  "secret": "secret",4079  "started_at": "started_at",4080  "state": "queued",4081  "stop_requested_at": "stop_requested_at",4082  "stopped_at": "stopped_at",4083  "type": "work"4084}4085```40864087### Get Queue Statistics40884089**GET** `/v1/environments/{environment_id}/work/stats`40904091Get statistics about the work queue for an environment.40924093#### Path parameters40944095- `environment_id: string`40964097#### Headers40984099- `"anthropic-beta": optional array of AnthropicBeta`41004101  Optional header to specify the beta version(s) you want to use.41024103  - `string`41044105  - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 43 more`41064107    - `"message-batches-2024-09-24"`41084109    - `"prompt-caching-2024-07-31"`41104111    - `"computer-use-2024-10-22"`41124113    - `"computer-use-2025-01-24"`41144115    - `"pdfs-2024-09-25"`41164117    - `"token-counting-2024-11-01"`41184119    - `"token-efficient-tools-2025-02-19"`41204121    - `"output-128k-2025-02-19"`41224123    - `"files-api-2025-04-14"`41244125    - `"mcp-client-2025-04-04"`41264127    - `"mcp-client-2025-11-20"`41284129    - `"dev-full-thinking-2025-05-14"`41304131    - `"interleaved-thinking-2025-05-14"`41324133    - `"code-execution-2025-05-22"`41344135    - `"extended-cache-ttl-2025-04-11"`41364137    - `"context-1m-2025-08-07"`41384139    - `"context-management-2025-06-27"`41404141    - `"model-context-window-exceeded-2025-08-26"`41424143    - `"skills-2025-10-02"`41444145    - `"fast-mode-2026-02-01"`41464147    - `"output-300k-2026-03-24"`41484149    - `"user-profiles-2026-03-24"`41504151    - `"user-profiles-2026-08-18"`41524153    - `"user-profiles-2026-09-04"`41544155    - `"advisor-tool-2026-03-01"`41564157    - `"managed-agents-2026-04-01"`41584159    - `"cache-diagnosis-2026-04-07"`41604161    - `"dreaming-2026-04-21"`41624163    - `"thinking-token-count-2026-05-13"`41644165    - `"server-side-fallback-2026-06-01"`41664167    - `"server-side-fallback-2026-07-01"`41684169    - `"fallback-credit-2026-06-01"`41704171    - `"fallback-credit-2026-07-01"`41724173    - `"agent-memory-2026-07-22"`41744175    - `"mid-conversation-tool-changes-2026-07-01"`41764177    - `"compact-2026-01-12"`41784179    - `"computer-use-2025-11-24"`41804181    - `"mcp-tunnels-2026-06-22"`41824183    - `"structured-outputs-2025-11-13"`41844185    - `"task-budgets-2026-03-13"`41864187    - `"thinking-display-updates-2026-08-18"`41884189    - `"ce-user-management-2026-07-13"`41904191    - `"mid-conversation-output-config-2026-07-01"`41924193    - `"thinking-binding-controls-2026-08-01"`41944195    - `"mid-conversation-system-clear-at-2026-08-21"`41964197    - `"compact-2026-09-04"`41984199- `"anthropic-workspace-id": optional string`42004201#### Returns42024203- `BetaSelfHostedWorkQueueStats object`42044205  Statistics about the work queue for an environment.42064207  Uses Redis Stream consumer group metrics for O(1) queries.42084209  - `type: "work_queue_stats"`42104211    The type of object42124213    default: work_queue_stats42144215  - `depth: number`42164217    Number of work items waiting to be picked up (lag from consumer group)42184219  - `oldest_queued_at: string or null`42204221    RFC 3339 timestamp of oldest item in the work stream (includes both queued and pending items), null if stream empty42224223  - `pending: number`42244225    Number of work items being processed (polled but not acknowledged)42264227    default: 042284229  - `workers_polling: number or null`42304231    Number of workers that have polled for work in the last 30 seconds. Requires worker_id to be sent with poll requests.42324233#### Example42344235```bash4236curl https://api.anthropic.com/v1/environments/$ENVIRONMENT_ID/work/stats \4237    -H 'anthropic-version: 2023-06-01' \4238    -H 'anthropic-beta: managed-agents-2026-04-01' \4239    -H "X-Api-Key: $ANTHROPIC_API_KEY"4240```42414242##### Response (200)42434244```json4245{4246  "depth": 0,4247  "oldest_queued_at": "oldest_queued_at",4248  "pending": 0,4249  "type": "work_queue_stats",4250  "workers_polling": 04251}4252```4253
Files main
Menu

Theme