Environments provide isolated execution contexts for running agent code, tools, and services securely.
CreateEnvironment
Creates an environment.
Request body
The request body contains data with the following structure:
network EnvironmentNetworkEgressAllowlist or enum (string) (optional)
Network configuration for the environment.
Possible Types
object
Outbound networking configuration for the sandbox. When specified, restricts which external domains the sandbox can reach. Omit entirely to allow all outbound traffic with no header injection.
allowlist array (AllowlistEntry) (optional)
List of allowed outbound domains. Only requests to listed domains are permitted. Use [{'domain': '*'}] to allow all domains while still injecting headers on specific ones.
Fields
Domain to allow outbound requests to. Supports wildcards (e.g. '*.googleapis.com'). Use '*' to allow all domains.
Headers to inject on all outbound requests matching this domain. Accepts a single dict or a list of dicts. The egress proxy injects these automatically.
string
Turns all network off.
Possible values
-
disabledTurns all network off.
sources array (Source) (optional)
Sources to be mounted into the environment.
Fields
The inline content if `type` is `INLINE`.
Optional encoding for inline content (e.g. `base64`).
The source of the environment. For Cloud Storage, this is the Cloud Storage path. For GitHub, this is the GitHub path.
Where the source should appear in the environment.
No description provided.
Possible values:
-
gcsA Cloud Storage bucket.
-
inlineInline content.
-
repositoryA generic repository. The protocol prefix in the source URL identifies the provider (e.g., github://, gcs://).
Response
If successful, the response body contains data with the following structure:
Output only. The time at which the environment was created in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).
Output only. The number of files in the environment, output only.
Required. Output only. The ID of the environment.
Output only. The time at which the environment was last accessed in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).
network EnvironmentNetworkEgressAllowlist or enum (string) (optional)
Network configuration for the environment.
Possible Types
object
Outbound networking configuration for the sandbox. When specified, restricts which external domains the sandbox can reach. Omit entirely to allow all outbound traffic with no header injection.
allowlist array (AllowlistEntry) (optional)
List of allowed outbound domains. Only requests to listed domains are permitted. Use [{'domain': '*'}] to allow all domains while still injecting headers on specific ones.
Fields
Domain to allow outbound requests to. Supports wildcards (e.g. '*.googleapis.com'). Use '*' to allow all domains.
Headers to inject on all outbound requests matching this domain. Accepts a single dict or a list of dicts. The egress proxy injects these automatically.
string
Turns all network off.
Possible values
-
disabledTurns all network off.
Output only. The total size of the environment files in bytes, output only.
sources array (Source) (optional)
Sources to be mounted into the environment.
Fields
The inline content if `type` is `INLINE`.
Optional encoding for inline content (e.g. `base64`).
The source of the environment. For Cloud Storage, this is the Cloud Storage path. For GitHub, this is the GitHub path.
Where the source should appear in the environment.
No description provided.
Possible values:
-
gcsA Cloud Storage bucket.
-
inlineInline content.
-
repositoryA generic repository. The protocol prefix in the source URL identifies the provider (e.g., github://, gcs://).
Output only. The status of the environment container.
Possible values:
-
activeOutput only. The status of the environment container.
-
expiredOutput only. The status of the environment container.
Output only. The time at which the environment was last updated in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).
Example
Example Response
{ "created": "string", "file_count": "string", "id": "string", "last_accessed": "string", "network": { "allowlist": [ { "domain": "github.com", "transform": [ { "Authorization": "Bearer your-token" } ] }, { "domain": "*.googleapis.com" } ] }, "size_bytes": "string", "sources": [ { "content": "string", "encoding": "string", "source": "string", "target": "string", "type": "gcs" } ], "status": "active", "updated": "string" }
ListEnvironments
Lists environments.
Path / Query Parameters
Optional. Maximum number of environments to return.\nIf unspecified, defaults to 50. Maximum is 1000.
Optional. Pagination token.
Response
If successful, the response body contains data with the following structure:
Environments belonging to the provided project.
Pagination token.
Example
Example Response
{ "environments": [ { "created": "string", "file_count": "string", "id": "string", "last_accessed": "string", "network": { "allowlist": [ { "domain": "github.com", "transform": [ { "Authorization": "Bearer your-token" } ] }, { "domain": "*.googleapis.com" } ] }, "size_bytes": "string", "sources": [ { "content": "string", "encoding": "string", "source": "string", "target": "string", "type": "gcs" } ], "status": "active", "updated": "string" } ], "next_page_token": "string" }
GetEnvironmentFiles
Retrieves a file or directory from an environment's snapshot.
Path / Query Parameters
Optional. Maximum number of entries to return per page (for directory listing).
Optional. Pagination token for directory listing.
Optional. If true and the path is a directory, recursively lists all files.
Response
If successful, the response body contains data with the following structure:
files array (EnvironmentFile) (optional)
If the requested path is a directory, this contains its contents. If the requested path is a file, this contains a single entry with the file's metadata. If alt=media was specified, this is empty (content is served via `blob`).
Fields
Output only. The creation time of the file/directory.
Output only. The MIME type of the file (e.g., "text/python", "image/png"). Empty for directories. NOLINT
Output only. The modification time of the file/directory.
Output only. The name of the file or directory (e.g., "main.py" or "src").
Output only. The full relative path within the environment (e.g., "workspace/src/main.py").
Output only. The size of the file/directory in bytes. NOLINT
Output only. The type of the entry.
Possible values:
-
fileA regular file.
-
directoryA directory.
Pagination token for directory listing. NOLINT
Example
Example Response
{ "files": [ { "created": "string", "mime_type": "string", "modified": "string", "name": "string", "path": "string", "size_bytes": "string", "type": "file" } ], "next_page_token": "string" }
GetEnvironment
Gets an environment.
Response
If successful, the response body contains data with the following structure:
Output only. The time at which the environment was created in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).
Output only. The number of files in the environment, output only.
Required. Output only. The ID of the environment.
Output only. The time at which the environment was last accessed in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).
network EnvironmentNetworkEgressAllowlist or enum (string) (optional)
Network configuration for the environment.
Possible Types
object
Outbound networking configuration for the sandbox. When specified, restricts which external domains the sandbox can reach. Omit entirely to allow all outbound traffic with no header injection.
allowlist array (AllowlistEntry) (optional)
List of allowed outbound domains. Only requests to listed domains are permitted. Use [{'domain': '*'}] to allow all domains while still injecting headers on specific ones.
Fields
Domain to allow outbound requests to. Supports wildcards (e.g. '*.googleapis.com'). Use '*' to allow all domains.
Headers to inject on all outbound requests matching this domain. Accepts a single dict or a list of dicts. The egress proxy injects these automatically.
string
Turns all network off.
Possible values
-
disabledTurns all network off.
Output only. The total size of the environment files in bytes, output only.
sources array (Source) (optional)
Sources to be mounted into the environment.
Fields
The inline content if `type` is `INLINE`.
Optional encoding for inline content (e.g. `base64`).
The source of the environment. For Cloud Storage, this is the Cloud Storage path. For GitHub, this is the GitHub path.
Where the source should appear in the environment.
No description provided.
Possible values:
-
gcsA Cloud Storage bucket.
-
inlineInline content.
-
repositoryA generic repository. The protocol prefix in the source URL identifies the provider (e.g., github://, gcs://).
Output only. The status of the environment container.
Possible values:
-
activeOutput only. The status of the environment container.
-
expiredOutput only. The status of the environment container.
Output only. The time at which the environment was last updated in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).
Example
Example Response
{ "created": "string", "file_count": "string", "id": "string", "last_accessed": "string", "network": { "allowlist": [ { "domain": "github.com", "transform": [ { "Authorization": "Bearer your-token" } ] }, { "domain": "*.googleapis.com" } ] }, "size_bytes": "string", "sources": [ { "content": "string", "encoding": "string", "source": "string", "target": "string", "type": "gcs" } ], "status": "active", "updated": "string" }
DeleteEnvironment
Deletes an environment.
Response
If successful, the response is empty.
Example
Resources
Environment
An execution environment for an agent.
Fields
Output only. The time at which the environment was created in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).
Output only. The number of files in the environment, output only.
Required. Output only. The ID of the environment.
Output only. The time at which the environment was last accessed in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).
network EnvironmentNetworkEgressAllowlist or enum (string) (optional)
Network configuration for the environment.
Possible Types
object
Outbound networking configuration for the sandbox. When specified, restricts which external domains the sandbox can reach. Omit entirely to allow all outbound traffic with no header injection.
allowlist array (AllowlistEntry) (optional)
List of allowed outbound domains. Only requests to listed domains are permitted. Use [{'domain': '*'}] to allow all domains while still injecting headers on specific ones.
Fields
Domain to allow outbound requests to. Supports wildcards (e.g. '*.googleapis.com'). Use '*' to allow all domains.
Headers to inject on all outbound requests matching this domain. Accepts a single dict or a list of dicts. The egress proxy injects these automatically.
string
Turns all network off.
Possible values
-
disabledTurns all network off.
Output only. The total size of the environment files in bytes, output only.
sources array (Source) (optional)
Sources to be mounted into the environment.
Fields
The inline content if `type` is `INLINE`.
Optional encoding for inline content (e.g. `base64`).
The source of the environment. For Cloud Storage, this is the Cloud Storage path. For GitHub, this is the GitHub path.
Where the source should appear in the environment.
No description provided.
Possible values:
-
gcsA Cloud Storage bucket.
-
inlineInline content.
-
repositoryA generic repository. The protocol prefix in the source URL identifies the provider (e.g., github://, gcs://).
Output only. The status of the environment container.
Possible values:
-
activeOutput only. The status of the environment container.
-
expiredOutput only. The status of the environment container.
Output only. The time at which the environment was last updated in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).