Overview
DialogFlow agent build and deploy isn't a well-defined procedure at this time. For the purposes of our chatbot, we need to have support for repeatable builds, versioning, and reviews.
General Flow
- Author modifies agent in non-prod environment
- Author submits agent for review
- Reviewer approves changes
- if rejected, go back to step 1
- Build creates artifact from agent
- Build saves artifact to repository
- Deploy pushes artifact
Rudimentary Implementation
A rudimentary build/deploy flow can be performed by using a series of scripts and Github.
| Requirement | Met? | Description |
|---|---|---|
| Repeatable Builds | Repeatable in that raw files exported from DialogFlow are used | |
| Reviews | Reviews performed by Github Enterprise pull requests | |
| Versioning | Agent files versioned using Github Enterprise |
Submitting an agent for review would require the author to trigger a script that would
- Clone the
masterbranch of the Github repo - Remove all agent files from the new branch
- Export the agent from DialogFlow using the Export Agent API
- Commit new files to new branch
- Create a pull request against the
masterbranch
Merging a pull request can trigger a build. The build process would
- Reconstruct the agent
.zipfile - Upload the agent
.zipfile to an artifact repository
An automated (CI) build or a manual deploy would trigger the deploy process
- Retrieve the agent
.zipfile artifact - Upload the agent using the Restore Agent API
| Pros | Cons |
|---|---|
| Implementation is faster | Author must invoke script to submit agent for review |
| Does not require additional servers or software | Reviewer must view JSON file diffs |
Advanced Implementation
An advanced build/deploy flow would be implemented by creating a new web application specifically for this purpose.
| Requirement | Met? | Description |
|---|---|---|
| Repeatable Builds | With some care, we can regenerate agent files consistently. | |
| Reviews | Implementation based upon review requirements | |
| Versioning | Versioning would be baked in to support reviews |
A custom web app allow the author and reviewer to work in the same system with a much simpler user interface.
Submitting an agent for review would require
- The author log into the review tool
- Selecting the agent to import for review
- Submitting the review
- The system would export the agent using the Export Agent API
- The system would deserialize the agent files
- The system would add the agent data to the database
Reviewing the agent would require
- The reviewer selecting the review to process
- The reviewer reviewing diffs in a custom format
- Diffs would exclude ancillary data unrelated to text input and output
- The reviewer approves or rejects the changes
- If the reviewer approves, a build is triggered
- Build tasks are triggered (eg: DEVON integration)
- Agent files are regenerated and bundled
- Agent bundle is uploaded to artifact repository
- If the reviewer rejects, a notification is sent back
- If the reviewer approves, a build is triggered
The deploy workflow would work the same as in the rudimentary implementation.
| Pros | Cons |
|---|---|
| Simpler review submission workflow | Additional development overhead |
| Simpler review workflow | Maintenance |
| Reusable code should we decided to implement our own agent builder | |
| Tool can be used across TWDC |