Logo for AiToolGo

How to Publish an AI Agent as a Google Workspace Add-on: A Travel Concierge Tutorial

In-depth discussion
Technical
 0
 0
 5
本教程介绍如何将 Agent Development Kit (ADK) 开发的旅游礼宾(Travel Concierge)多智能体 AI 发布为 Google Workspace 附加组件,使其可在 Chat、Gmail、Google 日历、云端硬盘、文档、表格和幻灯片中使用。内容涵盖 Google Cloud 项目创建、API 启用、服务账号与密钥配置、OAuth 权限页配置、在 Vertex AI Agent Engine 与 Cloud Run 上部署智能体、通过 Workspace 插件与 Chat API 进行部署,以及测试步骤、功能限制、自定义扩展方式和资源清理。整体为面向高级开发者的端到端实操教程。
  • main points
  • unique insights
  • practical applications
  • key topics
  • key insights
  • learning outcomes
  • • main points

    • 1
      提供从智能体部署到 Workspace 多应用集成的完整端到端流程,步骤清晰可复现
    • 2
      同时覆盖 Chat(支持多模态、富卡片)与非 Chat 应用(侧边栏上下文)两类界面的差异化设计
    • 3
      包含架构图、限制说明与扩展点(main.py、vertex_ai.py、agent_handler.py 等模块职责划分),便于二次开发
  • • unique insights

    • 1
      明确指出非 Chat 应用侧边栏为同步更新、存在超时风险,而 Chat 不受此限制,帮助开发者做出合理的平台选型
    • 2
      将 ADK 智能体、Vertex AI 会话管理与 Workspace 事件处理解耦为可扩展框架,并给出具体的定制方向(如云端硬盘文档作为上下文、多会话支持)
  • • practical applications

    • 对于希望将 AI 智能体嵌入企业 Google Workspace 工作流的开发团队具有很高的直接参考价值,可直接按步骤落地部署并在此基础上扩展自定义功能。
  • • key topics

    • 1
      Google Workspace 附加组件与 Chat 应用的开发与部署
    • 2
      基于 ADK 与 Vertex AI Agent Engine 的多智能体部署
    • 3
      Google Cloud 项目配置、API 启用与服务账号权限管理
  • • key insights

    • 1
      一次部署智能体,即可在 Chat、Gmail、日历、云端硬盘等多个 Workspace 应用中统一调用
    • 2
      提供 Chat 与非 Chat 两套差异化交互设计方案及其限制对比
    • 3
      结构化的自定义扩展指引,覆盖会话管理、响应渲染与第三方数据接入
  • • learning outcomes

    • 1
      掌握使用 ADK 与 Vertex AI Agent Engine 部署多智能体并获取引擎标识的完整流程
    • 2
      能够创建 Google Workspace 附加组件与 Chat 应用,并实现跨应用的智能体调用
    • 3
      理解 Chat 与非 Chat 应用在交互模式、上下文获取和性能限制上的差异,并能据此定制扩展功能
examples
tutorials
code samples
visuals
fundamentals
advanced content
practical tips
best practices

“ Introduction to AI Agents in Google Workspace

AI agents are transforming how people work, and integrating them directly into everyday productivity tools makes them far more useful. This guide shows developers how to publish an AI agent as a Google Workspace add-on, allowing users to engage with it inside the apps they already use every day. Using the Travel Concierge sample from the Agent Development Kit (ADK) as a practical example, you will learn how to turn a conversational multi-agent system into a graphical experience available across Gmail, Calendar, Drive, Docs, Sheets, Slides, and Google Chat. The tutorial is designed for advanced developers and takes approximately 45 minutes to complete.

“ Solution Overview and Key Technologies

The Travel Concierge is a conversational multi-agent AI that relies on tools such as the Google Maps Platform Places API, Google Search grounding, and Model Context Protocol (MCP) servers. By default, ADK offers chat and text interfaces for developers. This solution adds a graphical user interface on top of that agent so people can use it directly within Google Workspace. The implementation depends on several core technologies: the Agent Development Kit, Google Cloud and Google Workspace APIs, Vertex AI Agent Engine, and the Card framework. Because Google Chat has different capabilities than other Workspace apps, the interface design differs between Chat and non-Chat experiences to respect each platform's specific features and constraints.

“ Features and Architecture

Features shared across all Workspace apps include persistent user sessions managed by Vertex AI, rich messages combining formatted text and card widgets, and robust error handling with configurable retries and response status. Users can also manually reset their session to start a fresh conversation. Google Chat adds multimodal user messages with attachments, including audio and video recorded directly in the chat room, and more visually rich responses such as carousels with images. Non-Chat apps add capabilities such as enriching requests with Google profile information (birthday in this example), using Gmail message context, and offering a one-click button that opens a direct message with the Chat app. Architecturally, the Travel Concierge backend receives and processes Google Workspace add-on interaction events, prompts the ADK agent through Vertex AI while managing user sessions, and relies on Google Cloud and Workspace APIs to gather context and display responses. Chat responses are delivered chronologically with sub-agent interaction history followed by the final overall answer, whereas non-Chat responses appear in reverse chronological sections.

“ Prerequisites

You need a Google Workspace Business or Enterprise account with access to Google Chat and a web browser with internet access. For the Travel Concierge ADK agent you also need Python 3.10 or later, the uv package manager, and the Google Cloud CLI. Install each tool by following the official documentation for that software before beginning the setup steps.

“ Preparing Your Google Cloud Environment

Start by creating a Google Cloud project from the Google API Console or the gcloud CLI, optionally customizing the project ID, and selecting an organization location if you are working within a Workspace domain. Next, enable billing by linking a Cloud Billing account to the project. Then enable the required APIs: Vertex AI, Places, People, Google Chat, Gmail, Cloud Build, Cloud Functions, Cloud Pub/Sub, Cloud Logging, Artifact Registry, Cloud Run, Google Workspace add-ons, and Cloud Resource Manager. Obtain a Google Maps Platform Places API key from the Keys and Credentials page. Create a service account with the Vertex AI User role, record its email address, and generate a JSON private key saved as credentials.json. The tutorial notes that exporting private keys is used here for simplicity and is not recommended for production. Finally, configure the OAuth consent screen by providing an app name, support email, audience selection, and contact information; for internal use you can defer adding scopes until later.

“ Deploying the Travel Concierge ADK AI Agent

Authenticate with Google Cloud by running gcloud auth application-default login, set the active project, and configure the quota project. Download the adk-samples repository, navigate to the travel-concierge directory, and create a dedicated Cloud Storage bucket in your project's location. Export environment variables for Vertex AI usage, project ID, location, the Places API key, the storage bucket name, and the scenario profile. Install dependencies and deploy the agent with uv sync followed by uv run python deployment/deploy.py --create. Record the project number and engine ID printed in the deployment logs, since they are needed for later configuration. Reviewing the sample code on GitHub before continuing is recommended.

“ Configuring the Project and Deploying to Google Workspace

Download the add-ons-samples repository and open the travel-adk-ai-agent Python directory. Place the credentials.json service account key in the project folder. In the Cloud Run console, create a service named travel-concierge-app in your project location, choosing the latest Python runtime, allowing public access, and allocating 1 GiB of memory and 2 CPUs. Deploy the source code using gcloud run deploy with the region, function name adk_ai_agent, and environment variables including LOCATION, PROJECT_NUMBER, ENGINE_ID, and BASE_URL, where BASE_URL is the endpoint URL copied from Cloud Run. To make the add-on available across Gmail, Calendar, Drive, Docs, Sheets, and Slides, replace every $BASE_URL placeholder in deployment.json with the endpoint URL, create a Workspace add-on deployment named travel-concierge-addon with gcloud workspace-add-ons deployments create, and install it using gcloud workspace-add-ons deployments install. The add-on then appears in the side panel of each Workspace app.

“ Deploying to Google Chat

To connect the agent to Google Chat, open the Google Chat API configuration page in the API Console. Set the app name to Travel ADK AI Agent, the avatar URL to the provided image link, and the description to Travel ADK AI Agent. Choose HTTP endpoint URL as the connection setting, use a single endpoint for all triggers, and paste the copied BASE_URL. Register the Reset session quick command with ID 1 and name Reset session so users can restart conversations. Under visibility, limit access to specific people or groups in your Workspace domain by entering your email address, enable error logging to Logging, and save the configuration. Open Google Chat, start a direct message with the Travel ADK AI Agent app, and install it to begin receiving messages.

“ Testing the AI Agent

To verify the integration, send yourself an email in Gmail with the subject 'You need to travel to Paris' and a body requesting a stay between 11/25/2025 and 11/30/2025. Open the Travel ADK AI Agent add-on from the side panel, grant permissions, and send the message 'Please help me plan this travel!' with the current email as context; the panel updates with the agent's response. Next, open Google Chat through the add-on's button, reset the session using the + menu, and request ideas. You can also upload an image of a landmark such as the Eiffel Tower and ask the agent about visiting it. The same add-on is available in Calendar, Drive, Docs, Sheets, and Slides.

“ Limitations, Customization, and Cleanup

Outside Google Chat, the add-on is synchronous, so responses appear only after completion without streaming, and very long operations may time out. The solution is designed for extension: main.py defines the primary interface and event handling (for example, enabling Drive documents as context); vertex_ai.py manages agent sessions, responses, and errors and can support multiple conversations or other agent platforms; agent_handler.py implements Vertex AI-specific interfaces for Chat and non-Chat apps, such as adding feedback buttons; google_workspace.py handles Workspace API calls for context and actions, and can be extended to retrieve data from Calendar or CRM systems; and travel_agent_ui_render.gs implements response rendering, which can be extended to display items such as flight options. To avoid charges, delete the Google Cloud project when finished, keeping in mind that deleting it removes all its contents and custom project IDs. Alternatively, reuse the project for further tutorials to stay within quota limits.

 Original link: https://developers.google.com/workspace/add-ons/samples/travel-concierge?hl=zh-cn

Comment(0)

user's avatar

      Related Tools