Set Up Agent Guide - Google Cloud Platform
Before you begin, ensure you've finished installing Rasa Pro on Google Cloud Platform: Installation Guide
Recommended Next Steps
Now that you have successfully deployed Rasa Pro, you can proceed with getting a live Rasa agent in place that you can interact with.
Plan of Action:
- Confirm Your Agent Runs Locally
- Upload Trained Model to GCP
- Run Your Deployed Rasa Agent
Confirm Your Agent Runs Locally
If you already have a Rasa agent, make sure it trains and runs successfully on your local machine.
Don’t Have an Agent Yet?
If you already have a Rasa agent you’ve built, you can skip this Starter Pack section and go directly to Upload Trained Model to GCP.
If not, feel free to use one of our pre-built Starter Packs. These agents come ready-made for specific industries, and you can run them as-is or customize them for your own use case.
Download the latest release of one of the following:
Run Your Starter Pack Locally
Once you have downloaded your Starter Pack, follow the corresponding instructions linked below to train and run your Rasa agent locally:
Upload Trained Model to GCP
After you have successfully run your Rasa agent locally, you can now move it to the cloud to share with others. This consists of two steps:
- Upload the Rasa Model
- Restart Kubernetes
Upload the Rasa Model
Inside your Rasa agent project folder you will see a models/
directory. Select the model you want to run on your cloud environment. Rename this file to: models.tar.gz
- Go to your Google Cloud Console UI
- Make sure you have the same project selected that you used to create your deployment
- Go to Cloud Storage > Buckets
- Select the bucket that you assigned to
BUCKET_NAME_ENTROPY
during the deployment process:gcp/setup/environment-variables.sh
- Example:
rasa-xbuc-ab-se-x2-rasa-model
- Tip: Do not select the bucket that ends with
-studio
- Example:
- Click Upload to upload your local
models.tar.gz
into the bucket
Alternatively, via command line:
# Navigate to your Rasa project directory
cd /path/to/your/rasa/project
# Rename your model file
cp models/<your-model-file.tar.gz> models.tar.gz
# Authenticate with Google Cloud
gcloud auth login
# Upload the model to your bucket
# * e.g. gsutil cp models.tar.gz gs://rasa-xbuc-ab-se-x2-rasa-model/
gsutil cp models.tar.gz gs://YOUR_BUCKET_NAME/
# Verify upload
gsutil ls gs://YOUR_BUCKET_NAME/
Restart Rasa
- Go to your Google Cloud Console UI
- Make sure you have the same project selected that you used to create your deployment
- Go to Kubernetes Engine > Workloads
- Click on the
rasa
workload - In Deployment Details menu: Actions > Scale > Edit Replicas > Replicas:
0
- Press Scale
- Wait until the pod has been terminated
- In Deployment Details menu: Actions > Scale > Edit Replicas > Replicas:
1
- Press Scale
This creates a new pod which pulls the new model from your bucket. Wait until the new pod is up and running.
Alternatively, via command line:
# Confirm namespace
kubectl get ns
# Restart deployments
kubectl -n rasa rollout restart deployments rasa
# Wait for new pod
kubectl -n rasa rollout status deployment/rasa
# or
kubectl -n rasa get pods -w
Tip: You can view error messages in your pod logs:
# Get your pod name
kubectl -n rasa get pods
# View the logs
kubectl -n rasa logs rasa-778f9ff79-rgfd
You have now successfully updated the model and restarted your Rasa Pro environment. Next, you’ll set up a simple front-end web page to try out your agent.
Run Your Rasa Agent
You can now run your deployed Rasa agent.
Run Your Rasa Agent from Your Browser
Up to now, you’ve been running and testing your Rasa agent locally from your browser, connected to your local instance of Rasa Pro.
Now, you'll update the connection so your browser interacts with your deployed (cloud) instance of Rasa Pro. This way, you’ll be testing your Rasa agent running in the cloud rather than on your local machine.
- In your Starter Pack project folder, go to the
chatwidget
directory - Open up the
index.html
file in a text editor - Replace
<rasa-chatbot-widget server-url="http://localhost:5005"
with your domain name:
<rasa-chatbot-widget server-url="http://$DOMAIN"
- Save the changes to
index.html
- Open up
index.html
in your browser
Congratulations! You should now be able to successfully interact with your Rasa agent.
Connect Your Agent to Other Channels
In addition to running your agent through the local widget, you can connect it to many different messaging and voice channels - for example, your own website, Slack, Facebook Messenger, or Twilio.
For a full list of supported integrations and setup guides, see the Rasa documentation on channels.
Additional Resources
Explore these guides and references to deepen your understanding of Rasa and related integrations: