Versions and environments

You can create multiple versions of your agent and publish them to separate environments.

When you edit an agent, you are editing the draft agent. At any point, you can save the draft agent as an agent version, which is an immutable snapshot of your agent.

When you save the draft agent, it is published to the default environment. When you create agent versions, you can publish them to custom environments. You can create a variety of custom environments for:

  • testing
  • development
  • production
  • etc.

Publish a version in a new environment

To publish an agent draft to a version and create a custom environment:

  1. Go to the Dialogflow Console.
  2. Select your agent near the top of the left sidebar menu.
  3. Click the settings settings button next to the agent name.
  4. Click the Environments tab.
  5. Click Publish a version.
  6. Add an optional description and click Next.
  7. Select +New Environment.

  8. Enter an environment name.

  9. Choose the fulfillment method for the environment.

  10. Select Text-to-speech settings for the environment.

  11. Click Publish.

  12. The environment information is now listed in the Custom environments section.

Revert an environment to a previous version

You can revert an environment to a previous agent version:

  1. Click an environment in the Custom environments section.
  2. The environment settings dialog opens.
  3. Click the option more_vert button for a previously published version in the Publishing History section.
  4. Click Revert to this version.
  5. The publishing history will be updated.

Load a previous version to draft

To load a previous version to draft:

  1. Click an environment in the Custom environments section.
  2. Click the option more_vert button for a previously published version in the Publishing History section.
  3. Click Load to Draft.
  4. Click Yes, I'm sure.

Test your agent in an environment

You can use the API to test your agent in any of your custom environments. Call the detect intent method, but alter the endpoint URL by inserting environments/environment-name/users/-/ between agent and sessions.

For example, the following endpoint uses the "development" environment with an unspecified user:

"https://dialogflow.googleapis.com/v2/projects/my-project-id/agent/environments/development/users/-/sessions/123456789:detectIntent"

Environment-specific settings

Fulfillment and text-to-speech are configured by the environment, so the agent will use the environment's settings for these features.

Google Assistant

If you are using Actions on Google release environments, you should not use the Dialogflow inline code editor, because it does not support versioning. You should use a custom webhook in this case.