This method allows you to deploy new agent versions into the environment. When an environment is pointed to a new agent version by settingenvironment.agent_version, the environment is temporarily set to theLOADINGstate. During that time, the environment keeps on serving the previous version of the agent. After the new agent version is done loading, the environment is set back to theRUNNINGstate. You can use "-" as Environment ID in environment name to update version in "draft" environment. WARNING: this will negate all recent changes to draft and can't be undone. You may want to save the draft to a version before calling this function.
Required. The mask to control which fields get updated.
This is a comma-separated list of fully qualified names of fields. Example:"user.displayName,photo".
allowLoadToDraftAndDiscardChanges
boolean
Optional. This field is used to prevent accidental overwrite of the draft environment, which is an operation that cannot be undone. To confirm that the caller desires this overwrite, this field must be explicitly set to true when updating the draft environment (environment ID =-).
Request body
The request body contains an instance ofEnvironment.
Response body
If successful, the response body contains an instance ofEnvironment.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-06-27 UTC."],[[["\u003cp\u003eThis method updates an agent environment, allowing the deployment of new agent versions.\u003c/p\u003e\n"],["\u003cp\u003eThe environment is temporarily set to a \u003ccode\u003eLOADING\u003c/code\u003e state while the new agent version loads, continuing to serve the previous version in the meantime.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eupdateMask\u003c/code\u003e query parameter is required to control which fields are updated during the operation, and it uses a comma-separated list of fully qualified field names.\u003c/p\u003e\n"],["\u003cp\u003eUpdating the draft environment (Environment ID = \u003ccode\u003e-\u003c/code\u003e) requires the \u003ccode\u003eallowLoadToDraftAndDiscardChanges\u003c/code\u003e query parameter to be explicitly set to true.\u003c/p\u003e\n"],["\u003cp\u003eThis operation uses a \u003ccode\u003ePATCH\u003c/code\u003e HTTP request to the specified environment endpoint, which is defined by a URL containing both the project and the environment's ID.\u003c/p\u003e\n"]]],[],null,["# Method: projects.agent.environments.patch\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nUpdates the specified agent environment.\n\nThis method allows you to deploy new agent versions into the environment. When an environment is pointed to a new agent version by setting `environment.agent_version`, the environment is temporarily set to the `LOADING` state. During that time, the environment keeps on serving the previous version of the agent. After the new agent version is done loading, the environment is set back to the `RUNNING` state. You can use \"-\" as Environment ID in environment name to update version in \"draft\" environment. WARNING: this will negate all recent changes to draft and can't be undone. You may want to save the draft to a version before calling this function.\n\n### HTTP request\n\n`PATCH https://{endpoint}/v2beta1/{environment.name=projects/*/agent/environments/*}`\n\nWhere `{endpoint}` is one of the [supported service endpoints](/dialogflow/es/docs/reference/rest#rest_endpoints).\n\nThe URLs use [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n### Query parameters\n\n### Request body\n\nThe request body contains an instance of [Environment](/dialogflow/es/docs/reference/rest/v2beta1/projects.agent.environments#Environment).\n\n### Response body\n\nIf successful, the response body contains an instance of [Environment](/dialogflow/es/docs/reference/rest/v2beta1/projects.agent.environments#Environment).\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/cloud-platform`\n- `\n https://www.googleapis.com/auth/dialogflow`\n\nFor more information, see the [Authentication Overview](/docs/authentication#authorization-gcp)."]]