This 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.
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 of Environment.
Response body
If successful, the response body contains an instance of Environment.
[[["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 webpage details how to update an agent environment, allowing for the deployment of new agent versions.\u003c/p\u003e\n"],["\u003cp\u003eThe update process temporarily sets the environment to a \u003ccode\u003eLOADING\u003c/code\u003e state while retaining the previous agent version, transitioning back to \u003ccode\u003eRUNNING\u003c/code\u003e upon completion.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ePATCH\u003c/code\u003e method is used for updating, with specific endpoints defined by the \u003ccode\u003e{endpoint}\u003c/code\u003e variable and utilizing gRPC Transcoding syntax.\u003c/p\u003e\n"],["\u003cp\u003eUpdating the "draft" environment will negate all recent changes to the draft and cannot be undone, requiring \u003ccode\u003eallowLoadToDraftAndDiscardChanges\u003c/code\u003e set to true.\u003c/p\u003e\n"],["\u003cp\u003eThe request body and response body are both structured as instances of the \u003ccode\u003eEnvironment\u003c/code\u003e object, and the operation requires specific OAuth scopes for authorization.\u003c/p\u003e\n"]]],[],null,["# Method: projects.locations.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/*/locations/*/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)."]]