[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-18。"],[[["\u003cp\u003eDrafts of agent flows, playbooks, or tools can be saved as immutable versions, which are snapshots of the data and associated agent information at a specific time.\u003c/p\u003e\n"],["\u003cp\u003eWhile drafts are deployed to the default environment, versions can be deployed to custom environments like testing, development, or production, allowing for different stages of development.\u003c/p\u003e\n"],["\u003cp\u003eIt is recommended to use versions for production traffic rather than drafts, as drafts are subject to frequent updates and potential inconsistencies, especially with multiple developers.\u003c/p\u003e\n"],["\u003cp\u003eEnvironment-specific webhooks should be utilized to isolate production environments from development and testing environments, especially when making interdependent updates to agent and webhook code.\u003c/p\u003e\n"],["\u003cp\u003eYou can load any version back to draft, allowing it to be edited, and, if you are using flow versions, you can compare different versions side-by-side to highlight the differences.\u003c/p\u003e\n"]]],[],null,["# Versions and environments\n\nYou can create multiple versions of your agent flows, [playbooks](/dialogflow/cx/docs/concept/playbook)\nand tools and deploy them to separate serving environments.\n\nWhen you edit a flow, playbook or tool,\nyou are editing the *draft* .\nAt any point, you can save the draft as a *version*.\nA version is an immutable snapshot of your flow, playbook or tool data\nand associated agent data. For flows, this includes\nintents, entities, webhooks, pages, route groups. For playbooks, this includes\nonly examples.\n\nWhen you save a draft,\nit is deployed to the *default environment* .\nWhen you create specific versions,\nyou can deploy them to *custom environments*.\nYou can create a variety of custom environments such as:\n\n- testing\n- development\n- production\n\nIn addition,\nyou can create\n[environment-specific webhooks](/dialogflow/cx/docs/concept/webhook#environment-specific),\nso that you can isolate your production environment\nfrom development and testing environments.\n\nProduction traffic best practices\n---------------------------------\n\n### Always use versions for production traffic\n\nA draft is updated every time a developer on your team makes a change.\nIt is possible to break a draft unintentionally,\nespecially if multiple people have write access to the agent.\nIn addition, a recently edited draft\nmay be inconsistent with the trained model,\nbecause training may have a delay or require manual execution.\n\nYou should always use versions for your production traffic.\nDraft resources should be tested before promoting them to production versions,\nand you can rollback to a previous version if any problems are discovered.\n\n### Always use environment-specific webhooks\n\nWhen making updates to your agent,\nyou often have interdependent updates to your webhook code.\nDuring development and testing of these changes, you want the following:\n\n- To test the agent updates against the webhook code updates.\n- To avoid deploying your webhook code to production until you have completed testing.\n\nUsing\n[environment-specific webhooks](/dialogflow/cx/docs/concept/webhook#environment-specific)\nachieves both of these goals.\n\n### Consider possible agent errors while changing versions\n\nIf you change a version in your production environment\nwhile sessions are active,\nit may cause agent errors for some active sessions.\nThese errors may happen if the previous and new versions\nare inconsistent with each other\nin a way that disrupts session state.\nDue to this,\nyou should plan to change versions during\ndown-time or off-peak hours.\n\nLoad a version to draft\n-----------------------\n\nAt any time,\nyou can load a version to draft,\nso it is editable and used by the default environment.\n\nLoading a flow version to draft\ncan update multiple resources in an agent,\nincluding agent-level resources like intents and entities.\nWhen loading a version to draft with either the console or API,\nyou can choose whether agent-level resources will be overwritten.\n\nSimilarly, restoring a playbook version to draft will overwrite the existing\nplaybook in draft and its examples. And restoring a tool will overwrite the\nexisting tool in draft.\n\nManage versions\n---------------\n\nTo manage your versions: \n\n### Console\n\nTo list the current versions for a flow:\n\n1. Open the [Dialogflow CX console](https://dialogflow.cloud.google.com/cx/projects).\n2. Choose your Google Cloud project.\n3. Select your agent.\n4. Click the **Shared Resources** tab.\n5. Click **Versions**.\n6. The agent flows are listed. Select one.\n7. The versions are listed for the selected flow.\n\nTo list the current versions for a playbook:\n\n1. Open the [Dialogflow CX console](https://dialogflow.cloud.google.com/cx/projects).\n2. Choose your Google Cloud project.\n3. Select your agent.\n4. Select the playbook\n5. Click **Version History**.\n6. Click **View version history**.\n7. The versions are listed for the selected playbook.\n\nTo list the current versions for a tool:\n\n1. Open the [Dialogflow CX console](https://dialogflow.cloud.google.com/cx/projects).\n2. Choose your Google Cloud project.\n3. Select your agent.\n4. Select the tool\n5. Click **Version History**.\n6. Click **View version history**.\n7. The versions are listed for the selected tool.\n\nThe following information is displayed for each resource:\n\n- **Display name**: The version display name.\n- **Version ID**: The ID for the version.\n- **NLU Type** : The [NLU type](/dialogflow/cx/docs/concept/agent-settings#settings-ml) for the flow version.\n- **Creation timestamp**: The date and time that the version was created.\n- **Status** : The training status. A flow version is not ready to use until the status is marked as **Ready**.\n\nTo create a new version, click the **Create** button and provide the\n**Display name** and **Description** for the version.\n\nTo load a specific flow version as the draft flow:\n\n1. Hold the pointer over a version row.\n2. Click the option *more_vert* button.\n3. Click the **Load to draft** option.\n4. An option is provided to overwrite agent-level data when loading.\n\nTo delete a specific flow version:\n\n1. Hold the pointer over a version row.\n2. Click the option *more_vert* button.\n3. Click the **Delete version** option.\n\n### API\n\nSee the methods for the `Version` type.\n\n\nGo to the Version API reference \n**Select a protocol and version for the Version reference:**\n\nClose\n\n\u003cbr /\u003e\n\n| **Note:** The `load` method has a `allowOverrideAgentResources` field, which can be used to control whether agent level resources are overwritten when restoring a flow as the draft flow.\n| **Note:** When calling the `delete` method to delete a version, you must first remove all references to the version in environments data.\n\nCompare flow versions\n---------------------\n\n| **Note:** **Compare versions** is limited by 2MB response size. Use [REST API method](/dialogflow/cx/docs/reference/rest/v3/projects.locations.agents.flows.versions/compareVersions) to overcome this limitation.\n\nOnce you have created flow versions,\nyou can use the **compare versions** tool\nto see a side-by-side comparison between flow versions or the draft version. This features is not available for playbooks.\nTo compare versions: \n\n### Console\n\n1. Hold the pointer over a version row.\n2. Click the option *more_vert* button.\n3. Click the **Compare versions** option.\n4. Select another flow version or draft flow for comparison.\n5. A side-by-side comparison is shown.\n\n### API\n\nSee the `compareVersions` method for the `Version` type.\n\n\nGo to the Version API reference \n**Select a protocol and version for the Version reference:**\n\nClose\n\n\u003cbr /\u003e\n\nManage environments\n-------------------\n\nTo manage your agent environments: \n\n### Console\n\nTo list the current environments for an agent:\n\n1. Open the [Dialogflow CX console](https://dialogflow.cloud.google.com/cx/projects).\n2. Choose your Google Cloud project.\n3. Select your agent.\n4. Click the **Shared Resources** tab.\n5. Click **Environments**.\n6. The agent environments are listed.\n\nTo create a new environment, click the **Create** button and provide\ninformation.\n\nTo select flow, playbook and tool versions and configure an environment,\nclick an environment and provide information.\n\nTo view editing history of an environment,\nclick the history\n*history*\nbutton near the right side of an environment in the list.\n\nTo copy an environment resource name that includes the environment ID,\nclick the copy\n*content_copy*\nbutton near the right side of an environment in the list.\n\nTo delete an environment,\nclick the delete\n*delete*\nbutton near the right side of an environment in the list.\n\n### API\n\nSee the methods for the `Environment` type.\n\n\nGo to the Environment API reference \n**Select a protocol and version for the Environment reference:**\n\nClose\n\n\u003cbr /\u003e\n\n| **Note:** To reference a draft flow, use `0` as the flow version ID.\n\nSpecify environment for session calls\n-------------------------------------\n\nUsing either the\n[console simulator](/dialogflow/cx/docs/concept/console#simulator)\nor the API,\nyou can specify an environment when making runtime session calls.\nIf an environment is not specified,\nthe default environment is used. \n\n### Console\n\nWhen using the console simulator,\nselect the **Test agent in environment** option,\nthen select an environment.\n\n### API\n\nTo specify an environment for `detectIntent`, `streamingDetectIntent`,\n`matchIntent`, and session entity REST calls;\nalter the URL by inserting `environments/environment-id`\nbetween the `agent` and `sessions` path parameters.\n\nFor example, the following URL uses the `6db409d7-57ac-41d7-83bd-89b8768e2745`\nenvironment ID: \n\n https://dialogflow.googleapis.com/v3/projects/my-project-id/locations/us/agents/my-agent-id/environments/6db409d7-57ac-41d7-83bd-89b8768e2745/sessions/my-session-id:detectIntent\n\nSpecify flow versions for session calls\n---------------------------------------\n\nUsing either the\n[console simulator](/dialogflow/cx/docs/concept/console#simulator)\nor the API,\nyou can specify a set of flow versions when making runtime session calls.\nThe selected flow versions don't necessarily need to be\nreferenced in any environment. \n\n### Console\n\nWhen using the console simulator,\nselect the **Test agent with specific flow versions** option,\nthen select flow versions.\n\n### API\n\nTo specify flow versions for `detectIntent`, `streamingDetectIntent`,\n`matchIntent`, and session entity REST calls;\nprovide the chosen flow versions in the `query_parameters.flow_versions`\nfield of the request."]]