Claude Platform Docs

Ambienti

Crea ambiente
BetaEnvironment beta().environments().create(params, requestOptions = RequestOptions.none())
POST/v1/environments

Crea un nuovo ambiente con la configurazione specificata.

Elenca gli ambienti
EnvironmentListPage beta().environments().list(params = EnvironmentListParams.none(), requestOptions = RequestOptions.none())
GET/v1/environments

Elenca gli ambienti con supporto per la paginazione.

Ottieni ambiente
BetaEnvironment beta().environments().retrieve(params = EnvironmentRetrieveParams.none(), requestOptions = RequestOptions.none())
GET/v1/environments/{environment_id}

Recupera un ambiente specifico tramite ID.

Aggiorna ambiente
BetaEnvironment beta().environments().update(params = EnvironmentUpdateParams.none(), requestOptions = RequestOptions.none())
POST/v1/environments/{environment_id}

Aggiorna la configurazione di un ambiente esistente.

Elimina ambiente
BetaEnvironmentDeleteResponse beta().environments().delete(params = EnvironmentDeleteParams.none(), requestOptions = RequestOptions.none())
DELETE/v1/environments/{environment_id}

Elimina un ambiente tramite ID. Restituisce una conferma dell'eliminazione.

Archivia ambiente
BetaEnvironment beta().environments().archive(params = EnvironmentArchiveParams.none(), requestOptions = RequestOptions.none())
POST/v1/environments/{environment_id}/archive

Archivia un ambiente tramite ID. Gli ambienti archiviati non possono essere utilizzati per creare nuove sessioni.

Models
class BetaCloudConfig { type = "cloud"; networking; packages; }

cloud environment configuration.

class BetaCloudConfigParams { type = "cloud"; networking; packages; }

Request params for cloud environment configuration.

Fields default to null; on update, omitted fields preserve the existing value.

class BetaEnvironment { type = "environment"; id; archivedAt; /* 7 more */ }

Unified Environment resource for both cloud and self-hosted environments.

class BetaEnvironmentArchivedErrorDetails { errorCode; }
JsonValue errorCode = "environment_archived"
class BetaEnvironmentCreateDisabledErrorDetails { errorCode; }
JsonValue errorCode = "environment_create_disabled"
class BetaEnvironmentDeleteResponse { type = "environment_deleted"; id; }

Response after deleting an environment.

JsonValue type = "environment_deleted"

The type of response

String id

Environment identifier

class BetaEnvironmentNotFoundErrorDetails { errorCode; }
JsonValue errorCode = "environment_not_found"
class BetaEnvironmentUpdateDisabledErrorDetails { errorCode; }
JsonValue errorCode = "environment_update_disabled"
class BetaInvalidConfigTypeChangeErrorDetails { errorCode; }
JsonValue errorCode = "invalid_config_type_change"
class BetaInvalidMetadataErrorDetails { errorCode; }
JsonValue errorCode = "invalid_metadata"
class BetaLimitedNetwork { type = "limited"; allowMcpServers; allowPackageManagers; allowedHosts; }

Limited network access.

JsonValue type = "limited"

Network policy type

boolean allowMcpServers

Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the allowed_hosts array.

boolean allowPackageManagers

Permits outbound access to public package registries (PyPI, npm, etc.) beyond those listed in the allowed_hosts array.

List<String> allowedHosts

Specifies domains the container can reach.

class BetaLimitedNetworkParams { type = "limited"; allowMcpServers; allowPackageManagers; allowedHosts; }

Limited network request params.

Fields default to null; on update, omitted fields preserve the existing value.

JsonValue type = "limited"

Network policy type

Optional<Boolean> allowMcpServers

Permits outbound access to MCP server endpoints configured on the agent, beyond those listed in the allowed_hosts array. Defaults to false.

Optional<Boolean> allowPackageManagers

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.

Optional<List<String>> allowedHosts

Specifies domains the container can reach.

class BetaPackages { type; apt; cargo; /* 4 more */ }

Packages (and their versions) available in this environment.

Optional<Type> type

Package configuration type

List<String> apt

Ubuntu/Debian packages to install

List<String> cargo

Rust packages to install

List<String> gem

Ruby packages to install

List<String> go

Go packages to install

List<String> npm

Node.js packages to install

List<String> pip

Python packages to install

class BetaPackagesParams { type; apt; cargo; /* 4 more */ }

Specify packages (and optionally their versions) available in this environment.

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.

Under limited networking, requires networking.allow_package_managers to be true.

Optional<Type> type

Package configuration type

Optional<List<String>> apt

Ubuntu/Debian packages to install

Optional<List<String>> cargo

Rust packages to install

Optional<List<String>> gem

Ruby packages to install

Optional<List<String>> go

Go packages to install

Optional<List<String>> npm

Node.js packages to install

Optional<List<String>> pip

Python packages to install

class BetaSelfHostedConfig { type = "self_hosted"; }

Configuration for self-hosted environments.

JsonValue type = "self_hosted"

Environment type

class BetaSelfHostedConfigParams { type = "self_hosted"; }

Request params for self_hosted environment configuration.

JsonValue type = "self_hosted"

Environment type

class BetaUnrestrictedNetwork { type = "unrestricted"; }

Unrestricted network access.

JsonValue type = "unrestricted"

Network policy type

Errors
class BetaEnvironmentArchivedException extends BadRequestException { details; }⁠HTTP status 400

The environment is archived, so it cannot be updated.

JsonValue errorCode = "environment_archived"
class BetaInvalidConfigTypeChangeException extends BadRequestException { details; }⁠HTTP status 400

config.type differs from the environment's stored type, which cannot change after creation.

JsonValue errorCode = "invalid_config_type_change"
class BetaInvalidMetadataException extends BadRequestException { details; }⁠HTTP status 400

metadata has too many keys, a key or value that is too long, or a reserved key. The message names each problem.

JsonValue errorCode = "invalid_metadata"
class BetaEnvironmentCreateDisabledException extends PermissionDeniedException { details; }⁠HTTP status 403

Anthropic has turned off creating environments for this organization. Existing environments still work.

JsonValue errorCode = "environment_create_disabled"
class BetaEnvironmentUpdateDisabledException extends PermissionDeniedException { details; }⁠HTTP status 403

Anthropic has turned off updating environments for this organization. Existing environments still work as they are.

JsonValue errorCode = "environment_update_disabled"
class BetaEnvironmentNotFoundException extends NotFoundException { details; }⁠HTTP status 404

settings.environment_id names no Environment within the organization's reach.

JsonValue errorCode = "environment_not_found"

AmbientiLavoro

Ottieni elemento di lavoro
BetaSelfHostedWork beta().environments().work().retrieve(params, requestOptions = RequestOptions.none())
GET/v1/environments/{environment_id}/work/{work_id}

Recupera informazioni dettagliate su uno specifico elemento di lavoro.

Esegui polling del lavoro
BetaSelfHostedWork beta().environments().work().poll(params = WorkPollParams.none(), requestOptions = RequestOptions.none())
GET/v1/environments/{environment_id}/work/poll

Nota: questi endpoint vengono chiamati automaticamente dal worker di ambiente predefinito fornito negli SDK e nella CLI, per orchestrare le sessioni con ambienti sandbox self-hosted. Sono inclusi qui come riferimento; non è necessario invocarli direttamente.

Conferma ricezione del lavoro
BetaSelfHostedWork beta().environments().work().ack(params, requestOptions = RequestOptions.none())
POST/v1/environments/{environment_id}/work/{work_id}/ack

Nota: questi endpoint vengono chiamati automaticamente dal worker di ambiente predefinito fornito negli SDK e nella CLI, per orchestrare le sessioni con ambienti sandbox self-hosted. Sono inclusi qui come riferimento; non è necessario invocarli direttamente.

Registra heartbeat
BetaSelfHostedWorkHeartbeatResponse beta().environments().work().heartbeat(params, requestOptions = RequestOptions.none())
POST/v1/environments/{environment_id}/work/{work_id}/heartbeat

Nota: questi endpoint vengono chiamati automaticamente dal worker di ambiente predefinito fornito negli SDK e nella CLI, per orchestrare le sessioni con ambienti sandbox self-hosted. Sono inclusi qui come riferimento; non è necessario invocarli direttamente.

Arresta lavoro
BetaSelfHostedWork beta().environments().work().stop(params, requestOptions = RequestOptions.none())
POST/v1/environments/{environment_id}/work/{work_id}/stop

Arresta un elemento di lavoro, avviando un arresto graduale o forzato.

Elenca gli elementi di lavoro
WorkListPage beta().environments().work().list(params = WorkListParams.none(), requestOptions = RequestOptions.none())
GET/v1/environments/{environment_id}/work

Elenca gli elementi di lavoro in un ambiente.

Aggiorna elemento di lavoro
BetaSelfHostedWork beta().environments().work().update(params, requestOptions = RequestOptions.none())
POST/v1/environments/{environment_id}/work/{work_id}

Aggiorna i metadati dell'elemento di lavoro con semantica di merge.

Ottieni statistiche della coda
BetaSelfHostedWorkQueueStats beta().environments().work().stats(params = WorkStatsParams.none(), requestOptions = RequestOptions.none())
GET/v1/environments/{environment_id}/work/stats

Ottieni statistiche sulla coda di lavoro per un ambiente.