Claude Platform Docs

Lingkungan

Buat Lingkungan
client.Beta.Environments.New(ctx, params) (*BetaEnvironment, error)
POST/v1/environments

Buat environment baru dengan konfigurasi yang ditentukan.

Daftar Lingkungan
client.Beta.Environments.List(ctx, params) (*PageCursor[BetaEnvironment], error)
GET/v1/environments

Daftar environment dengan dukungan paginasi.

Dapatkan Lingkungan
client.Beta.Environments.Get(ctx, environmentID, query) (*BetaEnvironment, error)
GET/v1/environments/{environment_id}

Ambil environment tertentu berdasarkan ID.

Perbarui Lingkungan
client.Beta.Environments.Update(ctx, environmentID, params) (*BetaEnvironment, error)
POST/v1/environments/{environment_id}

Perbarui konfigurasi environment yang sudah ada.

Hapus Lingkungan
client.Beta.Environments.Delete(ctx, environmentID, body) (*BetaEnvironmentDeleteResponse, error)
DELETE/v1/environments/{environment_id}

Hapus environment berdasarkan ID. Mengembalikan konfirmasi penghapusan.

Arsipkan Lingkungan
client.Beta.Environments.Archive(ctx, environmentID, body) (*BetaEnvironment, error)
POST/v1/environments/{environment_id}/archive

Arsipkan environment berdasarkan ID. Environment yang diarsipkan tidak dapat digunakan untuk membuat sesi baru.

Models
type BetaCloudConfig struct { Type: "cloud"; Networking; Packages }

cloud environment configuration.

type BetaCloudConfigParams struct { Type: "cloud"; Networking; Packages }

Request params for cloud environment configuration.

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

type BetaEnvironment struct { Type: "environment"; ID; ArchivedAt; /* 7 more */ }

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

type BetaEnvironmentArchivedErrorDetails struct { ErrorCode }
ErrorCode BetaEnvironmentArchivedErrorCode
type BetaEnvironmentCreateDisabledErrorDetails struct { ErrorCode }
ErrorCode BetaEnvironmentCreateDisabledErrorCode
type BetaEnvironmentDeleteResponse struct { Type: "environment_deleted"; ID }

Response after deleting an environment.

Type EnvironmentDeletedResponseType

The type of response

defaultenvironment_deleted
ID string

Environment identifier

type BetaEnvironmentNotFoundErrorDetails struct { ErrorCode }
ErrorCode BetaEnvironmentNotFoundErrorCode
type BetaEnvironmentUpdateDisabledErrorDetails struct { ErrorCode }
ErrorCode BetaEnvironmentUpdateDisabledErrorCode
type BetaInvalidConfigTypeChangeErrorDetails struct { ErrorCode }
ErrorCode BetaInvalidConfigTypeChangeErrorCode
type BetaInvalidMetadataErrorDetails struct { ErrorCode }
ErrorCode BetaInvalidMetadataErrorCode
type BetaLimitedNetwork struct { Type: "limited"; AllowMCPServers; AllowPackageManagers; AllowedHosts }

Limited network access.

Type Limited

Network policy type

AllowMCPServers bool

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

AllowPackageManagers bool

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

AllowedHosts []string

Specifies domains the container can reach.

type BetaLimitedNetworkParams struct { Type: "limited"; AllowMCPServers; AllowPackageManagers; AllowedHosts }

Limited network request params.

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

Type Limited

Network policy type

AllowMCPServers bool Optional

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

AllowPackageManagers bool Optional

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.

AllowedHosts []string Optional

Specifies domains the container can reach.

type BetaPackages struct { Type: "packages"; Apt; Cargo; /* 4 more */ }

Packages (and their versions) available in this environment.

Type BetaPackagesType Optional

Package configuration type

defaultpackages
Apt []string

Ubuntu/Debian packages to install

Cargo []string

Rust packages to install

Gem []string

Ruby packages to install

Go []string

Go packages to install

Npm []string

Node.js packages to install

Pip []string

Python packages to install

type BetaPackagesParams struct { Type: "packages"; 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.

Type BetaPackagesParamsType Optional

Package configuration type

defaultpackages
Apt []string Optional

Ubuntu/Debian packages to install

Cargo []string Optional

Rust packages to install

Gem []string Optional

Ruby packages to install

Go []string Optional

Go packages to install

Npm []string Optional

Node.js packages to install

Pip []string Optional

Python packages to install

type BetaSelfHostedConfig struct { Type: "self_hosted" }

Configuration for self-hosted environments.

Type SelfHosted

Environment type

type BetaSelfHostedConfigParams struct { Type: "self_hosted" }

Request params for self_hosted environment configuration.

Type SelfHosted

Environment type

type BetaUnrestrictedNetwork struct { Type: "unrestricted" }

Unrestricted network access.

Type Unrestricted

Network policy type

Errors
const ErrorCodeBetaEnvironmentArchived ErrorCode = "environment_archived"⁠HTTP status 400

The environment is archived, so it cannot be updated.

const ErrorCodeBetaInvalidConfigTypeChange ErrorCode = "invalid_config_type_change"⁠HTTP status 400

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

const ErrorCodeBetaInvalidMetadata ErrorCode = "invalid_metadata"⁠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.

const ErrorCodeBetaEnvironmentCreateDisabled ErrorCode = "environment_create_disabled"⁠HTTP status 403

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

const ErrorCodeBetaEnvironmentUpdateDisabled ErrorCode = "environment_update_disabled"⁠HTTP status 403

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

const ErrorCodeBetaEnvironmentNotFound ErrorCode = "environment_not_found"⁠HTTP status 404

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

LingkunganPekerjaan

Dapatkan Item Pekerjaan
client.Beta.Environments.Work.Get(ctx, workID, params) (*BetaSelfHostedWork, error)
GET/v1/environments/{environment_id}/work/{work_id}

Ambil informasi terperinci tentang item pekerjaan tertentu.

Lakukan Polling untuk Pekerjaan
client.Beta.Environments.Work.Poll(ctx, environmentID, params) (*BetaSelfHostedWork, error)
GET/v1/environments/{environment_id}/work/poll

Catatan: endpoint ini dipanggil secara otomatis oleh environment worker siap pakai yang disediakan dalam SDK dan CLI, untuk mengorkestrasi sesi dengan environment sandbox yang di-hosting sendiri. Endpoint ini disertakan di sini sebagai referensi; Anda tidak perlu memanggilnya secara langsung.

Konfirmasi Pekerjaan
client.Beta.Environments.Work.Ack(ctx, workID, params) (*BetaSelfHostedWork, error)
POST/v1/environments/{environment_id}/work/{work_id}/ack

Catatan: endpoint ini dipanggil secara otomatis oleh environment worker siap pakai yang disediakan dalam SDK dan CLI, untuk mengorkestrasi sesi dengan environment sandbox yang di-hosting sendiri. Endpoint ini disertakan di sini sebagai referensi; Anda tidak perlu memanggilnya secara langsung.

Catat Heartbeat
client.Beta.Environments.Work.Heartbeat(ctx, workID, params) (*BetaSelfHostedWorkHeartbeatResponse, error)
POST/v1/environments/{environment_id}/work/{work_id}/heartbeat

Catatan: endpoint ini dipanggil secara otomatis oleh environment worker siap pakai yang disediakan dalam SDK dan CLI, untuk mengorkestrasi sesi dengan environment sandbox yang di-hosting sendiri. Endpoint ini disertakan di sini sebagai referensi; Anda tidak perlu memanggilnya secara langsung.

Hentikan Pekerjaan
client.Beta.Environments.Work.Stop(ctx, workID, params) (*BetaSelfHostedWork, error)
POST/v1/environments/{environment_id}/work/{work_id}/stop

Hentikan item pekerjaan, memulai penghentian secara halus (graceful) atau paksa.

Daftar Item Pekerjaan
client.Beta.Environments.Work.List(ctx, environmentID, params) (*PageCursor[BetaSelfHostedWork], error)
GET/v1/environments/{environment_id}/work

Daftar item pekerjaan dalam sebuah environment.

Perbarui Item Pekerjaan
client.Beta.Environments.Work.Update(ctx, workID, params) (*BetaSelfHostedWork, error)
POST/v1/environments/{environment_id}/work/{work_id}

Perbarui metadata item pekerjaan dengan semantik merge.

Dapatkan Statistik Antrean
client.Beta.Environments.Work.Stats(ctx, environmentID, query) (*BetaSelfHostedWorkQueueStats, error)
GET/v1/environments/{environment_id}/work/stats

Dapatkan statistik tentang antrean pekerjaan untuk sebuah environment.