{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/google-gemini/json-schema/google-gemini-environment-schema.json",
  "title": "Environment",
  "description": "An execution environment for an agent.",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/google-gemini-environments-api-openapi.yml#/components/schemas/Environment",
  "type": "object",
  "properties": {
    "networkMode": {
      "description": "Network egress mode.",
      "enum": [
        "NETWORK_MODE_UNSPECIFIED",
        "DISABLED"
      ],
      "type": "string"
    },
    "lastAccessed": {
      "readOnly": true,
      "description": "Output only. The time at which the environment was last accessed in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ).",
      "type": "string"
    },
    "id": {
      "readOnly": true,
      "type": "string",
      "description": "Required. Output only. The ID of the environment."
    },
    "created": {
      "type": "string",
      "readOnly": true,
      "description": "Output only. The time at which the environment was created in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ)."
    },
    "environmentKey": {
      "readOnly": true,
      "description": "Output only. Secret token generated upon environment creation for self_hosted environments. Used by the self-hosted sandbox daemon to authenticate polling and streaming requests. Only returned in the CreateEnvironment response; omitted from subsequent GetEnvironment and ListEnvironments calls.",
      "type": "string"
    },
    "fileCount": {
      "readOnly": true,
      "description": "Output only. The number of files in the environment, output only.",
      "format": "int64",
      "type": "string"
    },
    "mode": {
      "readOnly": true,
      "description": "Output only. The compute lifecycle mode for this environment.",
      "enum": [
        "ENVIRONMENT_MODE_UNSPECIFIED",
        "ON_DEMAND",
        "SELF_HOSTED"
      ],
      "type": "string"
    },
    "sizeBytes": {
      "readOnly": true,
      "type": "string",
      "description": "Output only. The total size of the environment files in bytes, output only.",
      "format": "int64"
    },
    "customConfig": {
      "readOnly": true,
      "description": "Output only. Arbitrary customer-defined JSON configuration passed through to the self-hosted environment poller. Only populated for `self_hosted` environments when configured.",
      "additionalProperties": {
        "description": "Properties of the object."
      },
      "type": "object"
    },
    "networkAllowlist": {
      "$ref": "#/$defs/EnvironmentNetworkEgressAllowlist",
      "description": "Allow only specific domains."
    },
    "sources": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Source"
      },
      "description": "Sources to be mounted into the environment."
    },
    "updated": {
      "readOnly": true,
      "type": "string",
      "description": "Output only. The time at which the environment was last updated in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ)."
    },
    "status": {
      "type": "string",
      "enum": [
        "STATUS_UNSPECIFIED",
        "ACTIVE",
        "EXPIRED"
      ],
      "description": "Output only. The status of the environment container.",
      "readOnly": true
    }
  },
  "$defs": {
    "EgressRule": {
      "properties": {
        "mode": {
          "description": "Network egress mode. Set via the `\"allowlist\": \"disabled\"` short form; must be the only rule in the allowlist and cannot be combined with `domain`, `transform` or `credential`.",
          "type": "string",
          "enum": [
            "NETWORK_MODE_UNSPECIFIED",
            "DISABLED"
          ]
        },
        "transform": {
          "description": "Headers to inject into requests matching this rule. Key: header name (e.g., \"Authorization\"). Value: header value (e.g., \"Bearer your-token\").",
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "credential": {
          "type": "string",
          "description": "Optional. Reference to a server-managed Credential resource by ID."
        },
        "domain": {
          "type": "string",
          "description": "Domain to allow outbound requests to. Supports wildcards (e.g. '*.googleapis.com'). Use '*' to allow all domains."
        }
      },
      "type": "object",
      "description": "A single domain allowlist rule with optional header injection."
    },
    "EnvironmentNetworkEgressAllowlist": {
      "properties": {
        "allowlist": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/EgressRule"
          },
          "description": "List of allowed domains and their configurations. Set to `\"disabled\"` to block all network egress."
        }
      },
      "description": "Network egress configuration for the environment.",
      "type": "object"
    },
    "Source": {
      "description": "A source to be mounted into the environment.",
      "type": "object",
      "properties": {
        "target": {
          "type": "string",
          "description": "Where the source should appear in the environment."
        },
        "type": {
          "enum": [
            "TYPE_UNSPECIFIED",
            "GCS",
            "INLINE",
            "REPOSITORY"
          ],
          "type": "string"
        },
        "content": {
          "type": "string",
          "description": "The inline content if `type` is `INLINE`."
        },
        "source": {
          "description": "The source of the environment. For Cloud Storage, this is the Cloud Storage path. For GitHub, this is the GitHub path.",
          "type": "string"
        },
        "encoding": {
          "description": "Optional encoding for inline content (e.g. `base64`).",
          "type": "string"
        }
      }
    }
  }
}