Versions and environments

Stay organized with collections Save and categorize content based on your preferences.

You can create multiple versions of your agent flows and deploy them to separate serving environments.

When you edit a flow, you are editing a draft flow. At any point, you can save a draft flow as a flow version. A flow version is an immutable snapshot of your flow data and associated agent data like intents, entities, webhooks, pages, route groups, etc.

When you save a draft flow, it is deployed to the default environment. When you create specific flow versions, you can deploy them to custom environments. You can create a variety of custom environments for:

  • testing
  • development
  • production
  • etc.

In addition, you can create environment-specific webhooks, so that you can easily isolate your production environment from development and testing environments.

Production traffic best practices

Always use flow versions for production traffic

A draft flow is updated every time a developer on your team makes a change. It is easy to break a draft flow unintentionally, especially if multiple people have write access to the agent. In addition, a recently edited draft flow may be inconsistent with the trained model, because training may have a delay or require manual execution.

You should always use flow versions for your production traffic. Draft flows should be tested before promoting them to production versions, and you can rollback to a previous version if any problems are discovered.

Always use environment-specific webhooks

When making updates to your agent, you often have interdependent updates to your webhook code. During development and testing of these changes, you want the following:

  • To test the agent updates against the webhook code updates.
  • To avoid deploying your webhook code to production until you have completed testing.

Using environment-specific webhooks achieves both of these goals.

Consider possible agent errors while changing versions

If you change a flow version in your production environment while sessions are active, it may cause agent errors for some active sessions. These errors may happen if the previous and new versions are inconsistent with each other in a way that disrupts session state. Due to this, you should plan to change versions during down-time or off-peak hours.

Load a flow version to draft

At any time, you can load a flow version to draft, so it is editable and used by the default environment.

Loading a flow version to draft can update multiple resources in an agent, including agent-level resources like intents and entities. When loading a version to draft with either the console or API, you can choose whether agent-level resources will be overwritten.

Manage flow versions

To manage your flow versions:

Console

To list the current versions for a flow:

  1. Open the Dialogflow CX Console.
  2. Choose your GCP project.
  3. Select your agent.
  4. Click the Manage tab.
  5. Click Versions.
  6. The agent flows are listed. Select one.
  7. The versions are listed for the selected flow.

The following information is displayed for each flow:

  • Display name: The version display name.
  • Version ID: The ID for the version.
  • NLU Type: The NLU type for the flow version.
  • Creation timestamp: The date and time that the version was created.
  • Status: The training status. A flow version is not ready to use until the status is marked as Ready.

To create a new flow version, click the Create button and provide the Display name and Description for the version.

To load a specific flow version as the draft flow:

  1. Hover over a version row.
  2. Click the option button.
  3. Click the Load to draft option.
  4. An option is provided to overwrite agent-level data when loading.

To delete a specific flow version:

  1. Hover over a version row.
  2. Click the option button.
  3. Click the Delete version option.

API

See the methods for the Version type.

Select a protocol and version for the Version reference:

Protocol V3 V3beta1
REST Version resource Version resource
RPC Version interface Version interface
C++ VersionsClient Not available
C# VersionsClient Not available
Go VersionsClient Not available
Java VersionsClient VersionsClient
Node.js VersionsClient VersionsClient
PHP Not available Not available
Python VersionsClient VersionsClient
Ruby Not available Not available

Compare flow versions

Once you have created flow versions, you can use the compare versions tool to see a side-by-side comparison between flow versions or the draft version. To compare versions:

Console

  1. Hover over a version row.
  2. Click the option button.
  3. Click the Compare versions option.
  4. Select another flow version or draft flow for comparison.
  5. A side-by-side comparison is shown.

API

See the compareVersions method for the Version type.

Select a protocol and version for the Version reference:

Protocol V3 V3beta1
REST Version resource Version resource
RPC Version interface Version interface
C++ VersionsClient Not available
C# VersionsClient Not available
Go VersionsClient Not available
Java VersionsClient VersionsClient
Node.js VersionsClient VersionsClient
PHP Not available Not available
Python VersionsClient VersionsClient
Ruby Not available Not available

Manage environments

To manage your agent environments:

Console

To list the current environments for an agent:

  1. Open the Dialogflow CX Console.
  2. Choose your GCP project.
  3. Select your agent.
  4. Click the Manage tab.
  5. Click Environments.
  6. The agent environments are listed.

To create a new environment, click the Create button and provide information.

To select flow versions and configure an environment, click an environment and provide information.

To view editing history of an environment, click the history button near the right side of an environment in the list.

To copy an environment resource name that includes the environment ID, click the copy button near the right side of an environment in the list.

To delete an environment, click the delete button near the right side of an environment in the list.

API

See the methods for the Environment type.

Select a protocol and version for the Environment reference:

Protocol V3 V3beta1
REST Environment resource Environment resource
RPC Environment interface Environment interface
C++ EnvironmentsClient Not available
C# EnvironmentsClient Not available
Go EnvironmentsClient Not available
Java EnvironmentsClient EnvironmentsClient
Node.js EnvironmentsClient EnvironmentsClient
PHP Not available Not available
Python EnvironmentsClient EnvironmentsClient
Ruby Not available Not available

Specify environment for session calls

Using either the console simulator or the API, you can specify an environment when making runtime session calls. If an environment is not specified, the default environment is used.

Console

When using the console simulator, select the Test agent in environment option, then select an environment.

API

To specify an environment for detectIntent, streamingDetectIntent, matchIntent, and session entity REST calls; alter the URL by inserting environments/environment-id between the agent and sessions path parameters.

For example, the following URL uses the 6db409d7-57ac-41d7-83bd-89b8768e2745 environment ID:

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

Specify flow versions for session calls

Using either the console simulator or the API, you can specify a set of flow versions when making runtime session calls. The selected flow versions do not necessarily need to be referenced in any environment.

Console

When using the console simulator, select the Test agent with specific flow versions option, then select flow versions.

API

To specify flow versions for detectIntent, streamingDetectIntent, matchIntent, and session entity REST calls; provide the desired flow versions in the query_parameters.flow_versions field of the request.