- Frequent Updates: You can release improvements to your assistant more often, ensuring a shorter feedback loop.
- Reduced Risk: Automated tests (e.g., end-to-end tests, unit tests for custom actions) catch errors before they make it to production.
- Consistent Quality: By enforcing coding and model training standards in your pipeline, you maintain consistent quality in your assistant’s performance.
- Faster Iterations: You can address user feedback quickly and ship updates without waiting on infrequent, manual release cycles.
CI/CD Best Practices
When setting up CI/CD for a Rasa assistant, keep in mind a few best practices:- Use Version Control Keep all conversation flows, prompt configurations, and custom actions in version control (e.g., Git). This way, any changes to flows, patterns, or the command generator prompt can be tracked and rolled back if needed.
- Automated Testing Run e2e conversation-level tests to ensure your assistant responds correctly to user messages, triggers the right flows, and properly handles conversation repair patterns.
- Environment Parity Try to keep development, staging, and production environments as similar as possible. For example, if you’re using Docker, ensure you use the same Docker images for local development and production deployments.
- Gradual Deployment If you have a large user base, consider rolling out changes to a subset of users first (canary or blue-green deployments) to minimize risk.
- Artifact Storage Store trained models and compiled assistant configurations in a stable, versioned repository (e.g., a cloud bucket). This allows you to revert to a previous model if something goes wrong.
How to Set Up CI/CD
Below is an example of how you might configure a CI/CD pipeline using GitHub Actions. You can follow similar steps with other CI/CD tools like GitLab CI, Jenkins, or CircleCI.- Train Your Assistant
- Run
rasa trainto compile your flows, patterns, and conversation data into a deployable model. - In CALM, training compiles your rule-based flows and dialogue stack logic alongside any LLM configuration.
- Make sure your CI environment is aligned with the same Python, Docker image, and Rasa Pro version used in production.
- Run
- Run Automated Tests
- Spin up your custom action server.
- Run end-to-end tests (
rasa test e2e) to validate conversation logic (flows, patterns, slot fillings, and repairs). - If tests fail, the pipeline should stop and avoid deploying a broken model.
- Deploy to Your Environment
- Once your model passes all tests, upload it to a centralized model storage or directly deploy to your staging/production environment.
- Update your orchestrator (e.g., Kubernetes, Docker Compose) to pull the new model and reload the assistant.
workflow.yml
- Checks Out your code.
- Pulls the specified Rasa Pro Docker image.
- Trains the assistant using your domain, data, and flows.
- Starts a custom action server for testing.
- Runs end-to-end tests against the trained model.
- Uploads the successful build to a cloud storage bucket for deployment.