Versions and Environments BETA

Versioning and Environments in Dialogflow allow you to deploy multiple versions of your agent to separate, customizable instances of environments, depending on your needs. This doc will walkthrough how to create a new version of your agent, how to create and publish to an environment, and how to change which version is being used in the environment.

You can set up separate environments for testing, development, and production, and control which version of your agent is used in each environment. For publishing versions through Actions on Google, see Versions and Google Assistant.

Enable beta features

In order to use Versions and Environments, you need an agent that uses API V2. To migrate your V1 agent to use the V2 API, see our migration guide. To use this feature, you must enable beta features by doing the following:

  1. Click on the gear settings icon next to your agent's name.
  2. Select V2 API, appect the popup dialog, and toggle the switch under BETA FEATURES.

You will see a new Environments tab in your agent's settings.

Versions

A version is an immutable copy of the current state of your agent (see Draft below), which you can then publish to an environment. When a new version is created, a snapshot of the intents and entities in your current draft agent is used.

Draft

The current state of your agent is called a draft. Draft is a special environment serving the current state of your agent, and all ongoing changes are only applied to the draft.

Draft can be used as any other custom environment, however all changes will be applied without explicit publishing. If you need to have a more stable state consider creating custom environment. The Environments tab will display when the last version was created, as well as any integrations connected to the draft version.

Publish a new version

To publish the current state of the draft version of your agent to an environment, take the following steps:

  1. Click the PUBLISH A VERSION button.

  2. Add an optional description and click NEXT.

  3. Click on the Environment menu and choose an existing environment. To create a new environment, choose + New Environment (chosen by default) and enter a name in the next field.

  4. Depending on your agent's fulfillment, choose an option under Fulfillment Settings:

    1. No Fulfillment - This option will use no fulfillment, and only responses set in intents will be used.
    2. Webhook - This option will use custom webhook settings to provide fulfillment. These settings are the same as the ones found under Fulfillment in the left menu.

    3. Cloud Function - This option will use your Cloud Function that's been deployed using the Inline Editor.

  5. Click PUBLISH.

When the environment finishes updating, the version number listed next to the chosen environment will be updated, and that version will be accessible through that environment.

Revert to a previous version

Under Publishing History, current and previous versions published to this environment are listed. This list allows you to revert the environment to any previously published versions by doing the following:

  1. Click on the more more_vert icon next to the previous version you want to revert to.

  2. Click on Revert to this version.

Versions can be in three different states:

  • Active - This is the current version of the agent being served to users through the environment.
  • Deploying - The version is actively being deplyed and the current version is still being served until deployment completes.
  • Error - This indicates the version did not get published to the environment.

The previous version will be published to the environment and you'll be taken back to the main Environment tab.

Load a previous version to draft

A previous version can be loaded into draft and the current state of the agent will be overwritten. To load a previous version to draft, do the following:

  1. Click on the more more_vert icon next to the previous version you want to load to draft.

  2. Click on Load to draft.

  3. Click YES, I'M SURE.

Environments

To see information related to an environment, click on it's listing in the table.

In this window you can see when the environment was last modified, connected integrations, history of revisions published to the environment, and fulfillment settings.

Testing

To test your agent in draft or in a specific environment you'll need to use Dialogflow's API. You can easily copy the cURL for a query from the Dialogflow simulator. To do this, follow these steps:

  1. Enter a query in the Dialogflow simulator on the right of the page and press enter.
  2. Click on the COPY CURL in the USER SAYS section.

    The copied cURL should look something like this, but unformatted:

    curl \
    -H "Content-Type: application/json; charset=utf-8" \
    -H "Authorization: Bearer <generated token>" \
    -d "{
      \"queryInput\":{
        \"text\":{
          \"text\":\"How are you?\",
          \"languageCode\":\"en\"
        }
      },
      \"queryParams\":{
        \"timeZone\":\"America/Los_Angeles\"
      }
    }" \
    "https://dialogflow.googleapis.com/v2beta1/projects/small-talk-dfghk/agent/sessions/e5472b8a-9feb-43f1-8213-648215960d22:detectIntent"
    
  3. Paste the copied cURL into your system's console and press enter.

Test your draft agent

By default, when you click the COPY CURL link, the specific endpoint URL for your draft is copied. You don't need to make any changes to the cURL command.

Test your agent in a specific environment

To test an agent that has been published to an environment, you'll need to adjust the URL to point to the specific environment you want to query.

Using the example from the Testing section above, the modified URL would look like this, if your environment was called "in-house-testing":

"https://dialogflow.googleapis.com/v2beta1/projects/small-talk-dfghk/agent/environments/in-house-testing/users/-/sessions/e5472b8a-9feb-43f1-8213-648215960d22:detectIntent"

You can see environments/<environment_name>/users/-/ is added between agent and sessions.

Versions and Google Assistant

Using the Google Assistant integration, you can publish any version of your Dialogflow agent to production or the Action Console's Alpha and Beta testing environments:

  • Alpha: This environment is used to quickly test versions of your app with small sets of users without having to go through the full Google app review. Users are warned that the app hasn't gone through any reviews for policy compliance.
  • Beta: This environment is used to distribute to a limited set of users after passing the full Google app review. Since an app in the Beta environment has passed the Google review, it can be made public without further review.

For more information, see the Actions on Google Alpha/Beta documentation.

Publish to Alpha/Beta Environments

The process of publishing to the Alpha or Beta channels is completed within the Actions Console:

  1. Click on Integrations in the left navigation, click on the Google Assistant card and then the MANAGE ASSISTANT APP in the popup.

  2. In the Actions Console, click on Releases under the Deploy section of the left navigation.

  3. For testing, click on either Alpha Release or Beta Release to expand the option.

  4. Click on either the SUBMIT FOR PRODUCTION or the SUBMIT FOR XXX RELEASE button, depending on your use case.

  5. Complete the release checklist and click the SUBMIT button.

Add and manage testers

  1. On the Release page, click on either Alpha Release or Beta Release to expand the section.
  2. Click on the MANAGE XXX TESTERS button.

  3. Enter the email addresses of the users you want to invite to test.

    You can specify up to 20 users for Alpha testing and up to 200 users for Beta testing.

  4. Click the Save button.