Versions and environments

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.

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.

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# Not available Not available
Go Not available Not available
Java VersionsClient VersionsClient
Node.js VersionsClient VersionsClient
PHP Not available Not available
Python VersionsClient VersionsClient
Ruby Not available Not available

Compare 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# Not available Not available
Go Not available 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# Not available Not available
Go Not available 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 runtime session calls

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

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

https://dialogflow.googleapis.com/v3beta1/projects/my-project-id/locations/us/agents/my-agent-id/environments/6db409d7-57ac-41d7-83bd-89b8768e2745/sessions/my-session-id:detectIntent

If an environment is not specified, the default environment is used.