
Before you begin
- Labs create a Google Cloud project and resources for a fixed time
- Labs have a time limit and no pause feature. If you end the lab, you'll have to restart from the beginning.
- On the top left of your screen, click Start lab to begin
Enable APIs
/ 30
Create a new chat app
/ 30
Generate the data store prompt
/ 40
This lab serves as a comprehensive guide to building Conversational Agents using Vertex AI Agent Builder. It walks you through the process of configuring agents in the new Conversational Agents console, leveraging Playbook-based, flow-based approaches.
Key concepts you will learn in this lab:
In this lab, you use Vertex AI Agent Builder and Conversational Agents to build, deploy and configure a conversational agent to assist people who want to donate blood and ensure they meet the required eligibility requirements. The agent uses real public data and Google's generative large language models (LLMs) during Conversational Agents fulfillment.
Conversational Agents is a new natural language understanding platform built on generative models that can control conversations and on flows that can be used for more explicit conversation control. Conversational Agents makes it easy to design and integrate a conversational user interface into your mobile app, web application, device, bot, interactive voice response system, and so on. Using Conversational Agents, you can provide new and engaging ways for users to interact with your product.
Data stores are used by data store handlers and playbook data store tools to find answers for end-user's questions from your data. Data stores are a collection of websites and documents, each of which references your data.
Data Store Settings are the configurations that define how a conversational agent interacts with the data stores.
The Vertex AI Agent Builder feature allows you to create conversational agents powered by data stores.
With this feature, you provide a website URL, structured data, or unstructured data (data stores), and Google parses your content to build a conversational agent that uses the data from these stores and large language models. The agent can then interact with customers and end users, allowing them to ask questions and get answers based on the provided content.
The generator feature is a Conversational Agents feature that allows developers to use Google's latest generative large language models (LLMs) and custom prompts to generate agent responses at runtime. A generator can handle generic responses that involve general knowledge from a large textual dataset it was trained on or context from the conversation.
In this lab, you learn how to perform the following tasks:
In this task, you will use Qwiklabs to perform the initialization steps for your lab.
For each lab, you get a new Google Cloud project and set of resources for a fixed time at no cost.
Make sure you signed into Qwiklabs using an incognito window.
Note the lab's access time (for example, and make sure you can finish in that time block.
When ready, click .
Note your lab credentials. You will use them to sign in to the Google Cloud Console.
Click Open Google Console.
Click Use another account and copy/paste credentials for this lab into the prompts.
After you complete the initial sign-in steps, the project dashboard appears.
Ensure your project, Google Cloud project ID
, and click OPEN to select your project.
Before you can start using Conversational Agent in Vertex AI Agent Builder, you need to enable the Dialogflow as well as the Vertex AI Agent Builder APIs. These APIs should already be enabled for this lab, but you should verify this before moving forward.
Enable the Dialogflow API by doing the following steps:
In your browser, navigate to the Dialogflow API Service Details page.
If the API is not already enabled, click the Enable button to enable the Dialogflow API in your Google Cloud project.
To enable the Vertex AI Agent Builder API, follow these steps:
In the Google Cloud console, navigate to the Vertex AI Agent Builder.
If asked, read and agree to the Terms of Service, then click Continue and activate the API.
Click Check my progress to verify the objectives.
Now, you'll create a new conversational agents for your agent and configure it with a data source. The purpose of the agent that you'll build is to assist customers who have questions about blood eligibility. You will use the Australian Red Cross Lifeblood as the source of truth and you will create a data store based on unstructured data from the blood eligibility website.
To create a new conversational agent, in Vertex AI Agent Builder Apps Console choose Conversational agent as the app type. Click Create.
Click Create agent.
Select Build your own on Get started with Conversational Agents popup.
On Create agent page, enter a Display name as Blood Donation Agent
for agent.
Select location as global (Global serving, data-at-rest in US).
Ensure the default Conversation start
type is selected as Playbook, and then click on Create button.
Click + Data store under Available tools
in Default Generative Playbook page.
Click Add Data stores under Data store.
Click Create new data store on Add data stores page, it will be redirected to the Agent Builder page
Click Select on the Cloud Storage as the data source for your data store.
Select Unstructured documents as the type of data you are importing.
Specify the following Google Cloud Storage folder that contains sample data for this lab, and note that the gs://
prefix is not required:
Click Continue.
Specify a Data store name of Australian Red Cross Lifeblood Unstructured
.
Click on Create to create the data store.
In the list of data stores, select the newly created data store named Australian Red Cross Lifeblood Unstructured
.
Click on the Activity tab to see the progress of the data import.
Once the agent is created, navigate back to the Conversational Agents Tools
console and refresh the page.
Enter Blood_donation_tool
in the Tool name field and choose Data store as the tool type in the drop-down menu.
Under Data Stores, click on Add Data Stores, choose Australian Red Cross Lifeblood Unstructured, then click Confirm and finally, click Save.
Navigate to the Playbooks tab, then click on Default Generative Playbook. Under Available tools choose the tool called Blood_donation_tool
and click Save.
Congratulations! You have finished building your knowledge-powered app that's ready to help potential donors, so take a moment to celebrate!
But there's still more work to do to make the agent accessible to your users. In the next section, you'll use a knowledge handler to enable conversations between the agent and end-users about eligibility requirements.
Click Check my progress to verify the objectives.
While the document collection process is running in the background, let's give the agent a brand by editing the data store prompt.
In the Conversational Agents console and from within your agent, click Agent settings (top right corner of the page).
Go to the Generative AI tab.
Click on General tab, and set the filters as below.
Filters | Values |
---|---|
Hate Speech | Block few |
Dangerous content | Block few(default) |
Sexually explicit content | Block few |
Harassment | Block few |
Output:
Click on Data store tab.
Fill out the form as below to generate the following data store prompt: Your name is Donate
, and you are a helpful and polite chatbot
at Save a life, a fictitious organization
. Your task is to assist humans with eligibility information
.
Click the Save button located at the top of the tab.
Click Check my progress to verify the objectives.
Switch to the Flows tab on the top-left sidebar of the Conversational Agents console (below of Playbooks) and open the Start Page.
Click the sys.no-match-default event handler. Unless the box is already checked, enable the generative fallback feature and click Save.
On the Start Page click Default Welcome Intent.
Scroll down to Agent Responses under Fulfillment. A fulfillment is the agent response to the end user. Conversational Agents has pre populated Agent dialogue with the parameter Hi! How are you doing?
.
Wait until the documents are available and ready for use by your agent to check out how good the answers are. You can check if the documents are available by going to the Vertex AI Agent Builder console and clicking on the view
link under Connected data stores beside of the Blood Donation Agent
app and then clicking on Australian Red Cross Lifeblood Unstructured
.
If you are not in the Conversational Agents console, then from the Vertex AI Agent Builder console, click the name of your app, which will redirect you to the Conversational Agents console.
In the Conversational Agents console within your agent, click Toggle Simulator icon to open the Simulator.
Ask questions that you expect to find in the FAQ page of the website. For example:
Lastly, let's try and challenge the agent with a question totally unrelated to blood donation. For example:
What's the weather like in Melbourne?
The agent should respond something like: I'm sorry, I can't provide weather information.
This answer has AI generated content in it and derives from the text prompt that Conversational Agents has created starting from the knowledge connector setting provided before: "Your name is Donate, and you are a helpful and polite chatbot at Save a Life. Your task is to assist humans with eligibility information". This text prompt contains the company name, the agent name, and most importantly what is in its scope which is used by Conversational Agents to generate the agent response.
Well done! So far you are using the data store to assist people with frequently asked questions related to blood donation. In the next part of the lab, we will look at how to bind a generator text prompt to the same content to make informed decisions.
Our next task is to design the agent to determine the user's eligibility to donate blood. There are strict requirements donors must meet such as age, weight, existing conditions, recent travels, etc. For the scope of this lab, we will only consider age and weight. A generator will use Google's large language models (LLMs) to dynamically make an informed decision based on the context of the conversation and the knowledge base.
Switch to the Flows tab on the top-left sidebar of the Conversational Agents console (below of Playbooks) and open the Start Page and then click Default Welcome Intent.
Scroll down to the Fulfillment section and remove the current agent responses in the Agent dialogue field and insert the following response:
Scroll down to the Transition field and select Page > + new page and set page name as User Blood Donation Decision and click on Save button.
Navigate to the Manage tab to create the two intents with the below configurations, click + Create
Display Name | Property |
---|---|
confirmation.yes | Training phrases: "Yes", "yeah", "yes please" |
confirmation.no | Training phrases: "No" |
Navigate to Build tab and click on the User Blood Donation Decision page.
To create the routes, click on + icon next to Routes.
In the Intent field, choose confirmation.yes from dropdown.
Click on + icon next to Routes.
In the Intent field, select confirmation.no from the dropdown menu. Then, scroll down to the Fulfillment > Agent responses section, click + Add dialogue response, choose agent dialogue and insert the response as Thanks, Have a nice day!
then click on Save.
The generator feature is a Conversational Agents feature that allows developers to use Google's latest generative large language models (LLMs) during Conversational Agents fulfillment. Generators to generate agent responses at runtime. A generator can handle generic responses that involve general knowledge from a large textual dataset it was trained on or context from the conversation.
We shall create a new generator that will compare the information provided by the user (such as age and weight) with the eligibility requirements to determine whether the user can donate.
On the Conversational Agents console go to the Manage tab and select Generators and click Create new.
Next, provide Blood Donation Eligibility
as the display name and write the following text prompt.
Leave the default model quality control settings. Then click Save to create the generator.
The text prompt is sent to the generative model during fulfillment at runtime. It should be a clear question or request in order for the model to generate a satisfactory response. You can use special built-in generator prompt placeholders in your text prompt:
$conversation
: The conversation between the agent and the user, excluding the very last user utterance.$last-user-utterance
: The last user utterance.The text prompt you have configured expects the user to provide age and weight in once conversational turn (the last-userutterance).
Next, navigate to Build tab and click on Eligibility Quiz Page.
To add Parameters, click on + icon next to Parameters.
Enter display name as age-weight.
Select entity type as @sys.any
.
Scroll down to Initial Prompt Fulfillment > Agent responses and in Agent dialogue field add prompt, What is your age and weight?
and then click Save.
On Eligibility Quiz page, click on + icon next to Routes.
Match AT LEAST ONE rule (OR)
option under Condition rules and enter the condition requirement $page.params.status = "FINAL"
.$request.generative.eligibility-outcome
that will contain the result of the generator after execution.$request.generative.eligibility-outcome
and then click Save.Click on Toggle Simulator icon, available at top right corner.
Click the Reset conversation icon until the Preview: Default Start Flow page appears, as shown below.
In the Start Resource section of the Preview: Default Start Flow page, select Default Start Flow and test your agent.
In the Toggle Simulator, start a new conversation with the agent by entering Hi
, and then provide the response to the agent's questions as shown below.
Then check the eligibility check fails when one or both the requirements are not met.
Great, the generator works as expected! Or does it? What happens if the user provides the age but not the weight (or the other way around)?
Collecting age and weight in one ago doesn't seem to work unless both age and weight are provided. We should instead create a form that collects both values as entity parameters. To make the prompt contextual of all the eligibility requirements (such as the age and the weight) we can use placeholders by adding a $
before the word. We will later associate these generator prompt placeholders with session parameters in fulfillment and they will be replaced by the session parameter values during execution.
Open the Eligibility Quiz page, click on Parameters, remove the parameter age-weight
and add two separate form parameters: one for weight and one for age. Pick @sys.number-integer
as the entity type and mark the parameters required. Provide the initial prompt fulfillments such as What is your correct weight?
for the weight
parameter and How old are you?
for the age
parameter. Save all the changes.
Before we can update the text prompt of the generator to include two new custom placeholders, we first need to remove the generator. To do this, click on the created route, scroll down to the Fulfillment > Generator section, remove the generator named Blood Donation Eligibility
, and then click Save.
Go to the Manage tab, select Generators and update the text prompt of the Blood Donation Eligibility generator with: Check the users eligibility against the following criteria: the minimum age is 18 and the maximum age is 75. The weight must be at least 50 kg. The user is $age years old and weighs $weight Kg. Craft an email and politely explain to the user if they're eligible to donate and if not why.
Notice that we haven't just made the text prompt contextual of the age and weight form parameters, we have also changed the last sentence to be able to generate a formal email to the user which contains the official outcome of the eligibility quiz.
Click Save.
Return to the Build tab. On the Eligibility Quiz page, select the route and expand the Generators section of the Fulfillment pane. Then, click Add generator and select the Blood Donation Eligibility
generator. After selecting the generator you need to associate the new prompt placeholders with the respective session parameters. Moreover, you need to re-set the input
and output
parameters as below.
$session.params.age
$session.params.weight
$request.generative.eligibility-outcome
Click on Save.
Retest the agent again. The eligibility check takes now into account both age and weight and the wording has changed from a conversational tone to a more polite response that is ready to be sent out without any potential human in the loop.
Today we've investigated generators in the context of eligibility quizzes. You have seen that generators use LLMs to generate agent responses and when powered by a knowledge base they can also make well-informed decisions. Surely there are many other use cases that can be implemented leveraging generators and data stores and we can't wait to get to know them!
Continue learning about Agent Builder AI and generative AI with these guides and resources:
...helps you make the most of Google Cloud technologies. Our classes include technical skills and best practices to help you get up to speed quickly and continue your learning journey. We offer fundamental to advanced level training, with on-demand, live, and virtual options to suit your busy schedule. Certifications help you validate and prove your skill and expertise in Google Cloud technologies.
Manual Last Updated March 12, 2025
Lab Last Tested March 12, 2025
Copyright 2023 Google LLC All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.
This content is not currently available
We will notify you via email when it becomes available
Great!
We will contact you via email if it becomes available
One lab at a time
Confirm to end all existing labs and start this one