Claude Platform Docs

Environments

Create Environment
$client->beta->environments->create(string name, ?Config config, ?string description, ?array<string,string> metadata, ?Scope scope, ?list<AnthropicBeta> betas, ?string workspaceID): BetaEnvironment
POST/v1/environments

Create a new environment with the specified configuration.

List Environments
$client->beta->environments->list(?bool includeArchived, ?int limit, ?string page, ?list<AnthropicBeta> betas, ?string workspaceID): PageCursor<BetaEnvironment>
GET/v1/environments

List environments with pagination support.

Get Environment
$client->beta->environments->retrieve(string environmentID, ?list<AnthropicBeta> betas, ?string workspaceID): BetaEnvironment
GET/v1/environments/{environment_id}

Retrieve a specific environment by ID.

Update Environment
$client->beta->environments->update(string environmentID, ?Config config, ?string description, ?array<string,string> metadata, ?string name, ?Scope scope, ?list<AnthropicBeta> betas, ?string workspaceID): BetaEnvironment
POST/v1/environments/{environment_id}

Update an existing environment's configuration.

Delete Environment
$client->beta->environments->delete(string environmentID, ?list<AnthropicBeta> betas, ?string workspaceID): BetaEnvironmentDeleteResponse
DELETE/v1/environments/{environment_id}

Delete an environment by ID. Returns a confirmation of the deletion.

Archive Environment
$client->beta->environments->archive(string environmentID, ?list<AnthropicBeta> betas, ?string workspaceID): BetaEnvironment
POST/v1/environments/{environment_id}/archive

Archive an environment by ID. Archived environments cannot be used to create new sessions.

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

Environment type

Networking networking

Network configuration policy.

BetaPackages packages

Package manager configuration.

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

Environment type

?Networking networking

Network configuration policy. Omit on update to preserve the existing value.

?BetaPackagesParams packages

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.

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

The type of object (always 'environment')

string id

Environment identifier (e.g., 'env_...')

?string archivedAt

RFC 3339 timestamp when environment was archived, or null if not archived

Config config

Environment configuration (either Anthropic Cloud or self-hosted)

string createdAt

RFC 3339 timestamp when environment was created

?string description

User-provided description for the environment; null when unset

array<string,string> metadata

User-provided metadata key-value pairs

string name

Human-readable name for the environment

string updatedAt

RFC 3339 timestamp when environment was last updated

?Scope scope

The visibility scope for this environment. 'organization' means visible to all accounts. 'account' means visible only to the owning account.

class BetaEnvironmentDeleteResponse { $type; $id; }
Type type

The type of response

string id

Environment identifier

class BetaLimitedNetwork { $type = 'limited'; $allowMCPServers; $allowPackageManagers; $allowedHosts; }
"limited" type

Network policy type

bool allowMCPServers

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

bool 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" type

Network policy type

?bool allowMCPServers

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

?bool 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.

?list<string> allowedHosts

Specifies domains the container can reach.

class BetaPackages { $type; $apt; $cargo; /* 4 more */ }
?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 */ }
?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 BetaSelfHostedConfig { $type = 'self_hosted'; }
"self_hosted" type

Environment type

class BetaSelfHostedConfigParams { $type = 'self_hosted'; }
"self_hosted" type

Environment type

class BetaUnrestrictedNetwork { $type = 'unrestricted'; }
"unrestricted" type

Network policy type

EnvironmentsWork

Get Work Item
$client->beta->environments->work->retrieve(string workID, string environmentID, ?list<AnthropicBeta> betas, ?string workspaceID): SelfHostedWork
GET/v1/environments/{environment_id}/work/{work_id}

Note: these endpoints are called automatically by the pre-built environment worker provided in the SDKs and CLI, for orchestrating sessions with self-hosted sandbox environments. They are included here as a reference; you do not need to invoke them directly.

Poll for Work
$client->beta->environments->work->poll(string environmentID, ?int blockMs, ?int reclaimOlderThanMs, ?list<AnthropicBeta> betas, ?string anthropicWorkerID): SelfHostedWork
GET/v1/environments/{environment_id}/work/poll

Note: these endpoints are called automatically by the pre-built environment worker provided in the SDKs and CLI, for orchestrating sessions with self-hosted sandbox environments. They are included here as a reference; you do not need to invoke them directly.

Acknowledge Work
$client->beta->environments->work->ack(string workID, string environmentID, ?list<AnthropicBeta> betas): SelfHostedWork
POST/v1/environments/{environment_id}/work/{work_id}/ack

Note: these endpoints are called automatically by the pre-built environment worker provided in the SDKs and CLI, for orchestrating sessions with self-hosted sandbox environments. They are included here as a reference; you do not need to invoke them directly.

Record Heartbeat
$client->beta->environments->work->heartbeat(string workID, string environmentID, ?int desiredTTLSeconds, ?string expectedLastHeartbeat, ?list<AnthropicBeta> betas): SelfHostedWorkHeartbeatResponse
POST/v1/environments/{environment_id}/work/{work_id}/heartbeat

Note: these endpoints are called automatically by the pre-built environment worker provided in the SDKs and CLI, for orchestrating sessions with self-hosted sandbox environments. They are included here as a reference; you do not need to invoke them directly.

Stop Work
$client->beta->environments->work->stop(string workID, string environmentID, ?bool force, ?list<AnthropicBeta> betas, ?string workspaceID): SelfHostedWork
POST/v1/environments/{environment_id}/work/{work_id}/stop

Note: these endpoints are called automatically by the pre-built environment worker provided in the SDKs and CLI, for orchestrating sessions with self-hosted sandbox environments. They are included here as a reference; you do not need to invoke them directly.

List Work Items
$client->beta->environments->work->list(string environmentID, ?int limit, ?string page, ?list<AnthropicBeta> betas): PageCursor<SelfHostedWork>
GET/v1/environments/{environment_id}/work

Note: these endpoints are called automatically by the pre-built environment worker provided in the SDKs and CLI, for orchestrating sessions with self-hosted sandbox environments. They are included here as a reference; you do not need to invoke them directly.

Update Work Item
$client->beta->environments->work->update(string workID, string environmentID, array<string,string> metadata, ?list<AnthropicBeta> betas, ?string workspaceID): SelfHostedWork
POST/v1/environments/{environment_id}/work/{work_id}

Note: these endpoints are called automatically by the pre-built environment worker provided in the SDKs and CLI, for orchestrating sessions with self-hosted sandbox environments. They are included here as a reference; you do not need to invoke them directly.

Get Queue Statistics
$client->beta->environments->work->stats(string environmentID, ?list<AnthropicBeta> betas, ?string workspaceID): SelfHostedWorkQueueStats
GET/v1/environments/{environment_id}/work/stats

Get statistics about the work queue for an environment.