Loading...
No results found.

Google Cloud Skills Boost

Apply your skills in Google Cloud console

16

Generative Playbooks

Get access to 700+ labs and courses

Create a Conversational Agent Playbook that connects to an unstructured data store tool

Lab 1 hour 30 minutes universal_currency_alt 1 Credit
info This lab may incorporate AI tools to support your learning.
Get access to 700+ labs and courses

Overview

In this lab, you create a chatbot using Conversational Agents Playbooks. Playbooks provide a way to create chat and voice experiences with natural language by leveraging LLMs. This can significantly reduce the agent creation and maintenance time, and enable brand new types of conversational experiences for your business. Additionally, you will connect your Playbook to an unstructured data store tool to ground your agent's answers on your existing enterprise data.

Objectives

In this lab, you learn how to:

  • Create a new Conversational Agent Playbook
  • Use examples to improve your Playbook's responses
  • Create a data store in Vertex AI Agent Builder
  • Use a tool to query a data store to perform grounding for your Playbook's responses

Setup

Before you click the Start Lab button

Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources will be made available to you.

This Qwiklabs hands-on lab lets you do the lab activities yourself in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials that you use to sign in and access Google Cloud for the duration of the lab.

What you need

To complete this lab, you need:

  • Access to a standard internet browser (Chrome browser recommended).
  • Time to complete the lab.

Note: If you already have your own personal Google Cloud account or project, do not use it for this lab.

Note: If you are using a Pixelbook, open an Incognito window to run this lab.

How to start your lab and sign in to the Google Cloud Console

1. Click the Start Lab button. If you need to pay for the lab, a pop-up opens for you to select your payment method. On the left is a panel populated with the temporary credentials that you must use for this lab.

2. Copy the username, and then click Open Google Console. The lab spins up resources, and then opens another tab that shows the Sign in page.

Tip: Open the tabs in separate windows, side-by-side.

 If you see the Choose an account page, click Use Another Account.

3. In the Sign in page, paste the username that you copied from the Connection Details panel. Then copy and paste the password.

Important: You must use the credentials from the Connection Details panel. Do not use your Qwiklabs credentials. If you have your own Google Cloud account, do not use it for this lab (avoids incurring charges).

4. Click through the subsequent pages:

  • Accept the terms and conditions.
  • Do not add recovery options or two-factor authentication (because this is a temporary account).
  • Do not sign up for free trials.

After a few moments, the Cloud Console opens in this tab.

Task 1. Setup your lab environment

In this task, you enable the Conversational Agents (prev. known as Dialogflow CX) and Vertex AI Agent Builder APIs in your Google Cloud project.

To enable the Conversational Agents APIs, follow these steps:

  1. In your browser, navigate to the Dialogflow API Service Details page.

  2. If the Enable button is visible, then click the Enable button to enable the Dialogflow API in your Google Cloud project. If the Enable button is not visible, then the API is already enabled in your project.

To enable the Vertex AI Agent Builder APIs, follow these steps:

  1. In the Google Cloud console, navigate to the Vertex AI Agent Builder console.

  2. Click Continue and activate the API. Keep other values as default.

Click Check my progress to verify the objective. Enable the APIs

Task 2. Create a Conversational Agent Playbook

Create a Playbook

  1. In the Agent Builder console, click on Create App and in the Conversational agent card click on Create. Alternatively, you can navigate to the Conversational Agents Console, click on the tab All, and select your Qwiklabs project.

  2. Click on + Create Agent. Select Build your own as the type of app you wish to build.

  3. Introduce the Display Name and set the region as us-central1. Make sure that Playbooks are selected and click on Create.

Overview of Playbooks

Once the Playbook opens, you will see the Default Generative Playbook.

The left-side pannel of Conversational Agents UI represent different functions you can perform. Here's a short description:

  • Playbooks: List, create, and edit generative playbooks.
  • Flows: Visualize, create, and edit deterministic flows.
  • Tools: List, create, and edit playbook tools.
  • Prebuilts: Import ready to use prebuilt agents for a variety of common use cases.
  • Test Cases: List and define test cases to regularly verify agent behavior.
  • Conversation History: View the conversation history.
  • Environments: Create and edit various deployment environments.
  • Versions: Snapshot flow and playbook versions.
  • Integrations: Integrate your agent with ready to use user interfaces and other conversation platforms.
  • Conversation Profiles: List, create, and edit conversational profiles for advanced telephony use cases.

You can configure the following components in the Playbook UI:

  • Playbook name.
  • Goal - a high-level description of what the Playbook should accomplish. As an example:
  • Instructions - a definition of the process which should be taken to accomplish the instruction's goal.

In Instructions, each step contains a natural language instruction that may contain any of the following:

  • A basic instruction that the LLM can understand.
  • An instruction to route the user to another Playbook. Playbooks are referenced using the form ${PLAYBOOK: playbook_name}.
  • An instruction to route the user to a Flow. Flows are referenced using the form ${FLOW: flow_name}.
  • An instruction to use a specific tool. Tools are referenced using the form ${TOOL: tool_name}.

Each step description starts with "-", and you can define substeps using indentation.

To save steps that contain references to other elements like Tools, Playbooks and Flows, you need to create and save them first.

As we start with a new Playbook, a Default Playbook is automatically created. The Default Generative Playbook (name can be changed) has a “★” that indicates that the Playbook is configured as a default one.

A user conversation for this Playbook will start from the Default Playbook.

Click Check my progress to verify the objective. Create a Conversational Agent Playbook

Task 3. Enable Cloud Logging and conversation history

  1. Click on the Settings button on the top right-hand side of the UI.

  2. Navigate to General > Logging Settings.

  3. Click the checkboxs for Enable Cloud Logging and Enable Conversation History to enable the Cloud Logging and conversation history features for your agent.

  4. Click the Save button at the top of the Settings pane to save your changes.

Click Check my progress to verify the objective. Enable Cloud Logging and Conversation History

Task 4. Configure the Playbook

In this section, you configure the playbook to support input parameters or an input summary.

  1. Click on Playbooks on the left-side menu and then click on the Default Generative Playbook.

  2. In the Playbook name field, name the agent to Telecommunication Steering Agent.

  3. Replace the text in the Goal field with the following goal. Refer to the official documentation for more information on defining the goal for your generative agents.

    You are an expert customer support agent for Telecommunication company "Telco Solutions" and your name is "Tulip". Your job is to route users directly to a specialist for assistance. Make sure to greet the user if this is the first time the user has started the conversation. GENERAL INSTRUCTIONS - Always remember to check today's date from the system date and time in Pacific Standard Time - Always check to see if user preferences exist and consider them before making any recommendations to the user. - Always remember to route the conversation to a specialist for assistance.

Keep the Playbook goal as a concise description of the agent’s main task or purpose. Longer descriptions will consume more of the LLM’s token buffer, thus leaving less buffer for the instructions and examples.

  1. In the Instructions field, replace the current text with the following instructions.

    - If the user hasn't been greeted yet, greet the user based on time of the day using today's date and time in pacific time zone (PDT or PST), introduce yourself and ask the user how you can help. - Make sure to check if the user has already given details on the items they are looking for help with, remember to route the conversation to a specialist. - DO NOT attempt to help the user directly. - ALWAYS route the users directly to the specialists - There are 4 specialists you can choose from: - For Billing Specialist call PLACEHOLDER BILLING Agent - For Plans and changes to plans call PLACEHOLDER PLANS Agent - For troubleshooting call PLACEHOLDER TROUBLESHOOTING Agent - General Questions and FAQs call TOOL FAQ

Playbook instructions are the step by step instructions on how to perform the task. They should follow the following guidelines:

  • Reflect the step-by-step approach to solving an end-user problem.
  • Be concise natural language sentences of high level instructions
  • Be straightforward and specify the scenarios for tool uses.
  • Follow the syntax strictly to make sure the instructions are compatible with the Playbook.
At the time of writing this lab, playbook goals and instructions have character limits. A goal and instructions must not exceed 2048 characters individually.
  1. Leave the Available tools field with the default value for each checkbox.

  1. Click the Save button to save the changes.

Task 5. Test your Playbook without examples

You now test how your agent behaves without any examples. You can test the agent by clicking Toogle Simulator for local testing or by clicking Publish for entire agent testing. The following walks you through local testing.

  1. Ensure that the Telecommunication Steering Agent playbook is selected for the Resource drop down menu in the Preview agent pane.

  2. In the Preview agent pane, select gemini-1.5-flash from the Model drop down menu if it is not already selected.

  3. In the text input box, begin the conversation by typing a simple greeting, such as Hello. You will see a response from the agent.

  4. Respond with the following:

    I am Priya! Whats your name? I have some questions about my Telephone Plans.
  5. After the response, now ask agent about the billing plan. You will see a response with Agent connecting you to the billing specialist.

    I need information about my billing plan.

You did not specify any examples, hence the LLM can proceed just by using the instructions and goals. This may not exactly match your expectations on an end-user experience. This may vary, but sometimes the agent in this lab does not greet the user introducing itself as Tulip. Remember, the bot may have undesirable outcomes without examples.

Also, since you have not specified the child agent routes the bot collects some information from a user and it suggests the next best step. However, the conversation does not get transferred to the specialist as suggested by the bot.

Task 6. Test your agent with examples

Each agent should have one or more examples. These examples are sample conversations between an end-user and the agent, including the dialogue and actions performed by the agent. These are effectively few-shot prompt examples for the LLM.

Instructing the LLM with few-shot examples is very important for agent performance quality control.

Add examples to your Agent

  1. Click on the Examples tab underneath the name of your agent. Then click the Create new button.

  1. In the Display name field, name your example Welcome Prompt 1.

  2. Expand the Basic Settings tab. In the Selection strategy , select Always.

  3. In the Input & Output tab. Select the Summary field type and enter the below input and then select Conversation State as OK. Click on Save.

Agent just introduced itself with a welcome message and tells about the company name.
  1. If the conversation from before is still present, click on the Reset conversation button.

  1. Ensure that gemini-1.5-flash is still selected in the Select generative model drop down menu. Type in the below greeting message and press Enter.
Hello
  1. You will receive a response from the agent similar to the example you created.

Click Check my progress to verify the objective. Test your agent with examples

Task 7. Create a Data Store tool

Tools enable Playbooks to access external services and data. There are four types of tools:

Tool Type Description
OpenAPI Allow agents to connect to call external APIs on your behalf and use the OpenAPI schema to model the interactions
Function Allow the developer to call a function in the client-side code of your application. The agent parses and extracts the function name and parameters from the user's request
Client side Like function tools, OpenAPI and data store tools can be executed on the client side by applying an API override when interacting with the session
Extension Built-in tools hosted by Google that are available to all agents without the need for manual configuration
Data store Allow agents to access your own enterprise data

In this task you create a data store in Vertex AI Agent Builder console and integrate the data store tool with your Playbook.

Creating a Data Store

  1. In the Conversational Agents Console, click on Tools in the left-hand menu.

  2. Click +Create in the Tools pane to create a new tool.

  3. Enter faq_ds in the Tool name field and choose Data store as the tool type in the drop-down menu.

  4. Enter the following description for the data store tool. This description is provided to the model as context informing how the tool is used.

This data store contains information about Telco Solutions services.
  1. Click the Save button to save the tool.

  2. Click the Create a data store button to be redirected to the Vertex AI Agent Builder console page to create your data store.

  1. Click Agree on the pop-up window that asks Do you agree to have your Search & Conversation data stores in the us region?.

  2. Input Telco Solutions in the Company name field and then click Continue.

  3. On the Data page, click + Create New Data Store to create the new Data Store.

  4. Select Cloud Storage as the data source for your data store.

  5. Select Unstructured documents as the type of data you are importing.

  6. Specify the following Google Cloud Storage folder that contains sample data for this codelab, and note that the gs:// prefix is not required:

cloud-training/specialized-training/ccai/agents

You can open the file gs://cloud-training/specialized-training/ccai/agents/Telco_Solutions_FAQs.pdf to see the sample data that we are importing.

  1. Click Continue.

  2. Specify a Data store name.

FAQ Data Store
  1. Click Create to create the data store.

  2. In the list of data stores, select the newly created FAQ Data Store.

  3. Click Create to create your Data store app.

Note: Wait until the data is imported successfully. You can click on the created data store and check the status of the data import.
  1. Once the documents are imported into the data store, navigate back to Conversational_agent > Tools menu. Refresh it to make sure that your newly created data stores are visible.

  2. After refreshing the page, a new section should be visible at the bottom of the page. Under Data Stores, next to Unstructured documents, select the FAQ Data Store in the dropdown menu.

  3. Click on Save.

Click Check my progress to verify the objective. Create a Data Store in Vertex AI Agent Builder

Use and test the data store tool in your Playbook

  1. Once the tool is created, you can reference it in the Playbook steps. Navigate to Playbooks > Telecommunication Steering Agent and select your data store tool from the list of available tools by checking the box next to it.

  2. Update the instructions with a new instruction at the bottom of the Instructions field and click on Save.

For questions about Telco Solutions services, use ${TOOL: faq_ds}
  1. Navigate to Playbooks > Telecommunication Steering Agent > Examples and click on the Welcome Prompt 1 example.

  2. Click on + Add Entry and choose Tool use. Select the Data Store Tool for the Tool and Action section and check the box beside Include input (requestBody) under Tool Input.

Note: You could fill up the input and output parameters to show examples of how the tool is used.
  1. Click on Save to save the changes.

  2. Click on Toggle Simulator to start a conversation with your agent.

  3. Try a query to see if the agent can use the tool to answer the question.

I want to know information about Telco Solutions services
  1. You should see the agent use the tool to answer the question.

Congratulations

You've done a lot in this lab 👏👏👏 you've learned how to:

  • Create a Conversational Agent Playbook
  • Improve your Playbook's responses with examples
  • Create a data store in Vertex AI Agent Builder
  • Use a tool to query a data store to perform grounding for your Playbook's responses
Previous Next

Before you begin

  1. Labs create a Google Cloud project and resources for a fixed time
  2. Labs have a time limit and no pause feature. If you end the lab, you'll have to restart from the beginning.
  3. On the top left of your screen, click Start lab to begin

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

Use private browsing to run the lab

Use an Incognito or private browser window to run this lab. This prevents any conflicts between your personal account and the Student account, which may cause extra charges incurred to your personal account.
Preview