arrow_back

Extend Agentspace Assistant Capabilities with Conversational Agents

Sign in Join
Get access to 700+ labs and courses

Extend Agentspace Assistant Capabilities with Conversational Agents

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

GENAI084

Overview

In this lab, you will enhance your Agentspace assistant by enabling it to handle employee business travel requests. The assistant will communicate with a conversational agent that processes these requests. To facilitate this, you will integrate an OpenAPI Tool, allowing the conversational agent to interact with a Cloud Run function. This function will then write the travel requests directly to BigQuery for storage and further processing. This diagram shows the flow you will enable:

Note: Using an Incognito browser window is recommended for most Qwiklabs to avoid confusion between multiple Qwiklabs student and other accounts. It is particularly helpful for Qwiklabs like this one that use the Conversational agents console. If you are using Chrome, the easiest way to accomplish this is to close any Incognito windows, then right click on the Open Google Cloud console button at the top of this lab and select Open link in Incognito window.

Objectives

In this lab, you learn how to:

  • Deploy a Cloud Run function.
  • Create an OpenAPI Tool for conversational agents to be able to call your Cloud Run function.
  • Deploy an Agentspace app.
  • Create a simple generative conversational agent using a Playbook.
  • Integrate your conversational agent into your Agentspace app.

Setup and requirements

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 dialog opens for you to select your payment method. On the left is the Lab Details pane with the following:

    • The Open Google Cloud console button
    • Time remaining
    • The temporary credentials that you must use for this lab
    • Other information, if needed, to step through this lab
  2. Click Open Google Cloud console (or right-click and select Open Link in Incognito Window if you are running the Chrome browser).

    The lab spins up resources, and then opens another tab that shows the Sign in page.

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

    Note: If you see the Choose an account dialog, click Use Another Account.
  3. If necessary, copy the Username below and paste it into the Sign in dialog.

    {{{user_0.username | "Username"}}}

    You can also find the Username in the Lab Details pane.

  4. Click Next.

  5. Copy the Password below and paste it into the Welcome dialog.

    {{{user_0.password | "Password"}}}

    You can also find the Password in the Lab Details pane.

  6. Click Next.

    Important: You must use the credentials the lab provides you. Do not use your Google Cloud account credentials. Note: Using your own Google Cloud account for this lab may incur extra charges.
  7. 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 Google Cloud console opens in this tab.

Note: To access Google Cloud products and services, click the Navigation menu or type the service or product name in the Search field.

Task 1. Create a BigQuery table where travel requests can be recorded

In this task, you'll create a table to serve as the destination to store incoming travel requests that will be sent to the Agentspace assistant.

  1. Open a Cloud Shell terminal, by pressing the G key followed by the S key on your keyboard.

  2. In your Cloud Shell terminal, paste the following to create a travel_requests_schema.json file to define the schema for a BigQuery table which will be used to record travel requests:

    cat > travel_requests_schema.json << EOF [ { "name": "user", "type": "STRING", "mode": "REQUIRED" }, { "name": "travel_purpose", "type": "STRING", "mode": "REQUIRED" }, { "name": "departure_city", "type": "STRING", "mode": "NULLABLE" }, { "name": "destination_city", "type": "STRING", "mode": "NULLABLE" }, { "name": "departure_date", "type": "STRING", "mode": "NULLABLE" }, { "name": "return_date", "type": "STRING", "mode": "NULLABLE" } ] EOF
  3. Run the following commands in Cloud Shell to create the BigQuery dataset and table , using the schema defined in the travel_requests_schema.json file:

    bq --location=US mk -d {{{project_0.startup_script.bq_dataset | Bigquery Dataset}}} bq mk -t {{{project_0.startup_script.bq_dataset | Bigquery Dataset}}}.{{{project_0.startup_script.bq_table | Bigquery Table}}} travel_requests_schema.json
  4. Click the Authorize button when prompted to authorize Cloud Shell.

  5. Once the dataset and table have been successfully created, you can close the Cloud Shell panel by clicking the X in the upper right of the terminal panel.

Click Check my progress to verify the objectives. Create a BigQuery dataset and table where travel requests can be recorded

Task 2. Create a Cloud Run Function to record the requests

In this task, you'll create the Cloud Run function that will take requests sent as JSON and write them to the table you created above.

  1. Using the search bar at the top of the Cloud Console, navigate to Cloud Run.

  2. From the options at the top of the Cloud Run console, select Write a Function.

  3. Under the Configure header, enter a Service name of record-travel-request.

  4. Set the Region to .

  5. Under the Endpoint URL header, copy the provided URL and paste it in a text document. You will need to access it later.

  6. Set the Runtime to Python 3.12.

  7. Under the Authentication header, selet Require authentication.

  8. Keep the other settings as default and select CREATE. The Source tab for the function will be loaded.

  9. Rename the Function entry point to record_travel_request.

  10. Click the requirements.txt file on the left, delete its contents, and paste in the following:

    functions-framework==3.* google-cloud-bigquery
  11. Click the main.py file on the left, delete its contents, and paste in the following code. This function will take the travel request details provided to a POST request as JSON and write those values to a new row in the BigQuery table you created earlier:

    import functions_framework from google.cloud import bigquery @functions_framework.http def record_travel_request(request): """Writes travel requests to BigQuery. Args: request (flask.Request): A request object with JSON containing fields for user, travel_purpose, departure_city, destination_city, departure_date, and return_date. Returns: JSON response containing a 'message' field indicating the status of the request. """ request_json = request.get_json(silent=True) request_args = request.args print("JSON:" + str(request_json)) print("args:" + str(request_args)) bq_client = bigquery.Client() table_id = "{{{project_0.startup_script.project_id | Project_ID}}}.{{{project_0.startup_script.bq_dataset | Bigquery_Dataset}}}.{{{project_0.startup_script.bq_table | Bigquery_Table}}}" row_to_insert = [ {"user": request_json["user"], "travel_purpose": request_json["travel_purpose"], "departure_city": request_json.get("departure_city",""), "destination_city": request_json.get("destination_city",""), "departure_date": request_json.get("departure_date",""), "return_date": request_json.get("return_date",""), }, ] errors = bq_client.insert_rows_json(table_id, row_to_insert) # Make an API request. if errors == []: return {"message": "New row has been added."} else: return {"message": "Encountered errors while inserting rows: {}".format(errors)}
  12. Click SAVE AND REDEPLOY.

  13. Wait until the the Deploying revision activities all show a Completed status message.

  14. Click TEST at the top of the Cloud Run console.

  15. Paste these values into the Configure triggering event test input field:

    { "user": "Ursula Matthews", "travel_purpose": "farm inspection", "departure_city": "Santiago", "destination_city": "Doha", "departure_date": "2025-09-08", "return_date": "2025-09-16" }
  16. At the bottom of the testing pane, click TEST IN CLOUD SHELL.

  17. The Cloud Shell terminal window will open, and a curl command will be prepared for you to call your function. Select the Terminal window and press enter or return on your keyboard to send the command.

  18. You should see a successful execution response:

  19. Close the Cloud Shell Terminal by pressing the X in the upper right of the Cloud Shell panel.

  20. Open a new browser tab (or if you are using Chrome, duplicate your current browser tab by right-clicking on it and selecting Duplicate). In the new tab, navigate to BigQuery.

  21. In the BigQuery Explorer pane, select your project ID .

  22. Select the dataset.

  23. Select the table.

  24. Select the PREVIEW tab to see travel requests that have been recorded. Keep this tab open to return and check for new rows as you work through the other components in this lab.

    Click Check my progress to verify the objectives. Create a Cloud Run function to record the requests

Task 3. Create a Conversational Agent Tool to call the Cloud Run Function

In this task, you'll create a Tool in the Conversational Agent console that can call the Cloud Run function. Your conversational agent will be able to use this Tool to record the travel requests.

  1. At the top of the Google Cloud Console, search for Dialogflow API and select it.

  2. Click Enable.

  3. Navigate to AI Applications by searching for it at the top of the console.

  4. Click on CONTINUE AND ACTIVATE THE API.

  1. For an app type, find the card for Conversational agent and select Create. This will open the Conversational Agents console in a new tab.

  2. In the Get started with Conversational Agents pane, select Build your own.

  3. For your agent's Display name, use Corporate Travel Bot.

  4. Set the location to global.

  5. Keep the Conversation start option Playbook selected.

  6. Click Create.

  7. After the Conversational Agent Playbook is created. Dismiss any instructional pop-ups and select Settings button on the top right-hand side of the UI.

  8. Navigate to General > Logging Settings.

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

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

  11. You will be taken to your starting Playbook. Dismiss any instructional pop-ups. Before you create the Playbook, you will create a Tool that the playbook can use to call the Cloud Run function you created. From the left-hand navigation menu, select Tools.

  12. Click + Create.

  13. For Tool name enter Record Travel Request.

  14. Keep the Type set to OpenAPI.

  15. For a Description, enter Used to record a travel request.

  16. For Schema, keep the type YAML selected, and paste the following into the text box. This OpenAPI spec describes an API with:

    • A server url set to your Cloud Functions domain

    • A path called / that accepts POST requests that include JSON in a schema called TravelRequest

    • A definition of that TravelRequest schema to include the fields you defined in your BigQuery schema at the start of this lab:

      openapi: 3.0.0 info: title: Travel Requests API version: 1.0.0 servers: - url: 'YOUR_CLOUD_RUN_FUNCTION_URL' paths: /: post: summary: Record a new travel request operationId: recordTravelRequest requestBody: description: Travel request to add required: true content: application/json: schema: $ref: '#/components/schemas/TravelRequest' responses: '200': description: Success content: application/json: schema: type: object properties: message: type: string example: "New row has been added." components: schemas: TravelRequest: type: object required: - user - travel_purpose properties: user: type: string travel_purpose: type: string departure_city: type: string destination_city: type: string departure_date: type: string return_date: type: string
  17. Replace YOUR_CLOUD_RUN_FUNCTION_URL in the spec above with your Cloud Run function's URL that you copied earlier.

  18. Click Save at the top of the Tools pane.

  19. To allow the Tool to invoke the Cloud Run function, switch to your browser tab displaying the Cloud Console (not the Conversational Agents console) and use the search bar at the top of the console to navigate to IAM.

  20. Check the checkbox to Include Google-provided role grants.

  21. Find the row for the Dialogflow Service Agent and click the pencil edit icon on its row.

  22. Click + Add Another Role.

  23. In the Select a role field, enter Cloud Run Invoker.

  24. Click SAVE.

    Click Check my progress to verify the objectives. Create a Conversational Agent tool to call the Cloud Run function

Task 4. Create a Conversational Agent Playbook

In this task, you'll create the conversational agent that can receive requests in natural language and use the Tool to write them to the BigQuery table via the Cloud Run function.

  1. In the browser tab with the Conversational Agents console, use the left-hand navigation menu to select Playbooks.

  2. Select the Default Generative Playbook that has already been created.

  3. Change the Playbook name to Confirm Travel Data.

  4. For a Goal, enter: Help users book travel.

  5. For Instructions, paste the following into the text field:

    - Ask the user to provide for user name, travel purpose, departure city, destination city, and a range of dates. Assume a year of 2025 for dates without a year: - Use ${TOOL:Record Travel Request} - Let the user know that they should receive a list of flights to choose from in their email within 24 hours.
  6. These Playbook instructions are designed for use by Agentspace because it only includes one turn of conversation, even though it does multiple things within that turn (invokes its tool and generates a response). Later, you will give the Agentspace agent the responsibility for gathering the relevant info before invoking this Playbook.

  7. Click Save at the top of the Playbook pane.

  8. In the upper right of the Conversational Agents console, click the Toggle simulator chat button () to preview the conversational agent.

  9. In the Enter text input box at the bottom of this panel, start the chat with can you help me book a flight?

  10. Provide a name, travel purpose, departure city, destination city, and a date range (for example, Joe Smith. Customer Presentation. Berlin to Valencia. Feb 21 to 28.) to observe how the agent behaves.

  11. You should see a card indicating that the Record Travel Request Tool was used, and you can click on it to see the Tool input and response:

    Note: Change the model in case of output other than 200 and restart the chat by resetting the conversation ().
  12. Your chat should end with a statement similar to:

    Click Check my progress to verify the objectives. Create a Conversational Agent playbook

Task 5. Create a BigQuery Data Store

In this task, you'll be deploying an Agentspace app, and to do so, you'll need to create a data store. We'll set up a BigQuery data store, allowing you to query and access previously recorded travel requests.

  1. Switch back to your Google Cloud Console browser tab and navigate to AI Applications by searching for it at the top of the console.

  2. Select Data Stores from the left-hand navigation pane.

  3. Click + Create Data Store.

  4. Search for BigQuery to locate the BigQuery card and click SELECT on it.

  5. For the kind of data, keep the default choice of Structured - BigQuery table with your own schema.

  6. For the BigQuery path select Browse.

  7. Search for dataset .

  8. Select your table .

  9. Click Select.

  10. Click Continue.

  11. You can keep the schema as it is and click Continue.

  12. For a name, enter Travel Requests.

  13. Click Create.

    Click Check my progress to verify the objectives. Create a BigQuery datastore

Task 6. Create an Agentspace app

In this task, you'll create a new Agentspace app, integrate Google as the Identity Provider, and link it to a data store.

  1. Navigate to AI Applications > Apps > + Create App.

  2. Find the Agentspace card and click CREATE to create an Agentspace app.

  3. For an app name, enter

  4. For a company name, enter

  5. Keep the location set to global.

  6. Click Continue.

  7. For an Identity provider, click SELECT on the Google Identity Provider card.

  8. On the Data pane, select the Travel Requests data store you created above.

  9. Click Create.

    Click Check my progress to verify the objectives. Create an Agentspace app

Task 7. Integrate your conversational agent with your Agentspace app

In this task, you'll grant your Agentspace assistant the ability to send messages to your conversational agent and receive its responses.

  1. Navigate to AI Applications > Apps and select App.

  2. From the left-hand navigation, select Configurations.

  3. Select the Assistant tab.

  4. Under the Agents header, select Add an Item. A card will be displayed to connect a New Agent:

  5. Select your browser tab displaying your Conversational Agents console.

  6. From the Agent dropdown at the top of the console, select View all agents.

  7. At the end of your Corporate Travel Bot agent's row, select the Options icon (three vertical dots) and select Copy name.

  8. Navigate back to your AI Applications tab, and in the New Agent card, paste the copied value in the Agent field.

  9. For an Agent display name, use Corporate Travel Bot.

  10. For Instructions enter:

    Use for booking travel by providing a user, travel purpose, departure city, destination city, and a date range.
  11. Notice that these instructions instruct the Agentspace assistant to do the work of gathering the required information before passing the details to the conversational agent for a single turn of conversation.

  12. Click Done.

  13. Click Save and Publish at the bottom of the pane.

    Click Check my progress to verify the objectives. Integrate the conversational agent with the Agentspace app

Task 8. Communicate with your conversational agent through the Agentspace assistant

In this task, your Agentspace assistant will be able to communicate with the conversational agent, which will then utilize its tool to record travel requests.

Note: It can take up to 10 minutes for your Agentspace app to be created. You can try the steps below, but if they don't proceed as expected, try to give your app more time to be created.
  1. Select your Agentspace app's . Navigate to Integration tab from the left-hand navigation menu.

  2. Under The link to your web app header, click Open. As stated at the start of this task, if you see a 404 error, you may need to give your app more time to be created. You can reload the page every few minutes until the Agentspace web app appears.

  3. In the primary search bar, enter:

    Book travel for Alex Cymbal from Singapore to Council Bluffs, Iowa, departing on April 1 and returning on April 14, 2025, for a data center tour.

  4. Your chat will be saved as a Conversation under the Recents header on the left-hand menu of the Agentspace web app.

  5. Your assistant should have responded that your request has been recorded, and you will receive a follow up email within 24 hours. If you are asked any additional questions, use the Ask a follow-up field to reply to the assistant.

  6. Under the assistant's responses, there is an Options menu (three vertical dots). Expand it and select Show diagnostic info.

  7. In the diagnostic info displayed, you can view the metadata of the response, which includes "functionName": "Corporate_Travel_Bot". This confirms that the Agentspace assistant invoked your conversational agent as a function call and received a response from it, which it has passed back to you.

  8. Please note, in this activity you used very minimal Playbook instructions and no conversation examples, which means that this agent will not be very robust. If you need to restart the conversation to try it again, click the New Conversation button in the upper left.

  9. To confirm that requests are being recorded, return to the browser tab displaying your BigQuery table. On the PREVIEW tab, click the Refresh icon to view the latest data.

    Click Check my progress to verify the objectives. Communicate with the conversational agent through the Agentspace assistant

Congratulations!

In this lab, you’ve learned how to extend the Agentspace assistant with conversational agents. More specifically, you've learned to:

  • Deploy a Cloud Run function.
  • Create an OpenAPI Tool for conversational agents to be able to call your Cloud Run function.
  • Deploy an Agentspace app.
  • Create a simple generative conversational agent using a Playbook.
  • Integrate your conversational agent into your Agentspace app.

Manual Last Updated June 05, 2025

Lab Last Tested June 05, 2025

Copyright 2025 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.

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.