> ## AI Agent Context > Get the complete documentation index at: https://aistudio.google.com/llms.txt > Use this file to discover all available pages. > For the full documentation in a single file, fetch: https://aistudio.google.com/llms-full.txt # Gemini Environments API {% callout type="note" %} This API is in Beta. Endpoints are under `/v1beta/`. {% /callout %} Environments provide isolated execution contexts for running agent code, tools, and services securely. ## Methods {% id="methods" %} {% table %} * Method * HTTP request --- * [Creating an environment](/api-reference/environments/create-environment) * {% mark class="http-post" %}{% icon name="north_east" /%}`POST`{% /mark %} `/v1beta/environments` Creates an environment. --- * [Listing environments](/api-reference/environments/list-environments) * {% mark class="http-get" %}{% icon name="south_west" /%}`GET`{% /mark %} `/v1beta/environments` Lists environments. --- * [Getting environment files](/api-reference/environments/get-environment-files) * {% mark class="http-get" %}{% icon name="south_west" /%}`GET`{% /mark %} `/v1beta/environments/{environment}/files/{path}` Retrieves file metadata or directory contents from an environment's snapshot. --- * [Getting an environment](/api-reference/environments/get-environment) * {% mark class="http-get" %}{% icon name="south_west" /%}`GET`{% /mark %} `/v1beta/environments/{id}` Gets an environment. --- * [Uploading an environment file](/api-reference/environments/start-environment-file-upload) * {% mark class="http-put" %}{% icon name="north_east" /%}`PUT`{% /mark %} `/upload/v1beta/environments/{environment}/files/{path}` Starts a resumable upload session for a file in an environment workspace. --- * [Deleting an environment](/api-reference/environments/delete-environment) * {% mark class="http-delete" %}{% icon name="close" /%}`DELETE`{% /mark %} `/v1beta/environments/{id}` Deletes an environment. {% /table %} ## Resources {% id="resources" %} ### Environment {% id="Resource:Environment" %} An execution environment for an agent. **Properties:** {% section class="api-ref-property-list" %} **id**: {% mark %}required{% /mark %} `string` Output only. The ID of the environment. {% hr /%} {% details %} {% summary %} **sources**: `Source array` Sources to be mounted into the environment. {% /summary %} {% details %} {% summary %} **type**: `string enum` {% /summary %} Possible values: - `gcs`: A Cloud Storage bucket. - `inline`: Inline content. - `repository`: A generic repository. The protocol prefix in the source URL identifies the provider (e.g., github://, gcs://). {% /details %} **source**: `string` The source of the environment. For Cloud Storage, this is the Cloud Storage path. For GitHub, this is the GitHub path. **target**: `string` Where the source should appear in the environment. **content**: `string` The inline content if `type` is `INLINE`. **encoding**: `string` Optional encoding for inline content (e.g. `base64`). {% /details %} {% hr /%} **created**: `string` Output only. The time at which the environment was created in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ). {% hr /%} **updated**: `string` Output only. The time at which the environment was last updated in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ). {% hr /%} **last_accessed**: `string` Output only. The time at which the environment was last accessed in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ). {% hr /%} {% details %} {% summary %} **status**: `string enum` Output only. The status of the environment container. {% /summary %} Possible values: - `active`: Output only. The status of the environment container. - `expired`: Output only. The status of the environment container. {% /details %} {% hr /%} {% details %} {% summary %} **network**: `EnvironmentNetworkEgressAllowlist` or `string enum` Network configuration for the environment. {% /summary %} **Possible Types:** {% class="api-ref-label" %} {% details %} {% summary %} **EnvironmentNetworkEgressAllowlist** {% /summary %} Network egress configuration for the environment. {% details %} {% summary %} **allowlist**: `EgressRule array` or `string enum` List of allowed domains and their configurations. Set to `"disabled"` to block all network egress. {% /summary %} **Possible Types:** {% class="api-ref-label" %} {% details %} {% summary %} **EgressRule array** {% /summary %} A single domain allowlist rule with optional header injection. **domain**: {% mark %}required{% /mark %} `string` Domain to allow outbound requests to. Supports wildcards (e.g. '*.googleapis.com'). Use '*' to allow all domains. **transform**: `object` Headers to inject into requests matching this rule. Key: header name (e.g., "Authorization"). Value: header value (e.g., "Bearer your-token"). **credential**: `string` Optional. Reference to a server-managed Credential resource by ID. {% /details %} {% details %} {% summary %} **string enum** {% /summary %} Possible values: - `disabled`: All network egress is blocked. {% /details %} {% /details %} {% /details %} {% details %} {% summary %} **string enum** {% /summary %} Possible values: - `disabled`: All network egress is blocked. {% /details %} {% /details %} {% hr /%} **file_count**: `string` Output only. The number of files in the environment, output only. {% hr /%} **size_bytes**: `string` Output only. The total size of the environment files in bytes, output only. {% /section %}