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 进行部署,以及测试步骤、功能限制、自定义扩展方式和资源清理。整体为面向高级开发者的端到端实操教程。
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.
We use cookies that are essential for our site to work. To improve our site, we would like to use additional cookies to help us understand how visitors use it, measure traffic to our site from social media platforms and to personalise your experience. Some of the cookies that we use are provided by third parties. To accept all cookies click ‘Accept’. To reject all optional cookies click ‘Reject’.
Comment(0)