1. はじめに
このラボでは、クライアント エージェント サービスの導入とデプロイに焦点を当てます。Agent Development Kit(ADK)を使用して、ツールを使用する AI エージェントを構築します。
このラボでは、Wikipedia を使用して動物に関する質問に回答する動物園エージェントを構築します。

最後に、ツアーガイド エージェントをローカルで実行するだけでなく、Google Cloud Run にデプロイします。
前提条件
- 課金を有効にした Google Cloud プロジェクト
学習内容
- ADK デプロイ用に Python プロジェクトを構造化する方法。
- google-adk を使用してツールを使用するエージェントを実装する方法。
- Python アプリケーションをサーバーレス コンテナとして Cloud Run にデプロイする方法。
- IAM ロールを使用して安全なサービス間認証を構成する方法。
- 将来の費用が発生しないように Cloud リソースを削除する方法。
必要なもの
- Google Cloud アカウントと Google Cloud プロジェクト
- ウェブブラウザ(Chrome など)
2. Cloud Run にデプロイする理由
Cloud Run は、ADK エージェントのホスティングに最適です。サーバーレス プラットフォームであるため、基盤となるインフラストラクチャの管理ではなく、コードに集中できます。運用作業は Google が行います。
ポップアップ ショップのように、顧客(リクエスト)が到着したときにのみリソースを開いて使用します。顧客がいない場合は完全に閉店するため、空の店舗の料金を支払う必要はありません。
主な機能
コンテナをどこでも実行:
- アプリを含むコンテナ(Docker イメージ)を用意します。
- Cloud Run は、Google のインフラストラクチャ上で実行します。
- OS のパッチ適用、VM の設定、スケーリングの煩わしさから解放されます。
自動スケーリング:
- アプリを使用しているユーザーが 0 人の場合 → 0 個のインスタンスが実行されます(0 個のインスタンスにスケールダウンされるため、費用対効果が高くなります)。
- 1,000 件のリクエストがヒットした場合 → 必要に応じてコピーが作成されます。
デフォルトでステートレス:
- 各リクエストは異なるインスタンスに送信される可能性があります。
- 状態を保存する必要がある場合は、Cloud SQL、Firestore、Memorystore などの外部サービスを使用します。
任意の言語またはフレームワークをサポート:
- Linux コンテナで実行される限り、Cloud Run は Python、Go、Node.js、Java、.Net のいずれであるかを気にしません。
従量課金制:
- リクエストベースの課金: リクエストごと + コンピューティング時間(100 ミリ秒単位)で課金されます。
- インスタンス ベースの課金: インスタンスのライフサイクル全体に対して課金されます(リクエストごとの料金は発生しません)。
3. プロジェクトの設定
Google アカウント
個人の Google アカウントをお持ちでない場合は、Google アカウントを作成する必要があります。
仕事用または学校用アカウントではなく、個人アカウントを使用します。
Google Cloud コンソールにログインする
個人の Google アカウントを使用して Google Cloud コンソールにログインします。
課金を有効にする
個人用の請求先アカウントを設定する
Google Cloud クレジットを使用して課金を設定した場合は、この手順をスキップできます。
個人用の請求先アカウントを設定するには、Cloud コンソールでこちらに移動して課金を有効にします。
注意事項:
- このラボを完了するのにかかる Cloud リソースの費用は 1 米ドル未満です。
- このラボの最後の手順に沿ってリソースを削除すると、それ以上の料金は発生しません。
- 新規ユーザーは、300 米ドル分の無料トライアルをご利用いただけます。
プロジェクトの作成(省略可)
このラボで使用する現在のプロジェクトがない場合は、こちらで新しいプロジェクトを作成します。
4. Cloud Shell エディタを開く
- このリンクをクリックすると、Cloud Shell エディタに直接移動します。
- 本日、承認を求めるメッセージがどこかの時点で表示された場合は、[承認] をクリックして続行します。

- ターミナルが画面の下部に表示されない場合は、ターミナルを開きます。
- [表示] をクリックします。
- [ターミナル] をクリックします。

5. API を有効にする
Cloud Run、Artifact Registry、Cloud Build、Vertex AI、Compute Engine を使用するには、Google Cloud プロジェクトでそれぞれの API を有効にする必要があります。
- ターミナルで、API を有効にします。
実行が完了すると、次のような出力が表示されます。gcloud services enable \ run.googleapis.com \ artifactregistry.googleapis.com \ cloudbuild.googleapis.com \ aiplatform.googleapis.com \ compute.googleapis.comOperation "operations/acat.p2-[GUID]" finished successfully.
API の概要
- Cloud Run Admin API(
run.googleapis.com)を使用すると、フルマネージド環境でフロントエンド サービス、バックエンド サービス、バッチジョブ、ウェブサイトを実行できます。コンテナ化されたアプリケーションのデプロイとスケーリングのためのインフラストラクチャを処理します。 - Artifact Registry API(
artifactregistry.googleapis.com)は、コンテナ イメージを保存するための安全なプライベート リポジトリを提供します。これは Container Registry の進化版であり、Cloud Run および Cloud Build とシームレスに統合されます。 - Cloud Build API(
cloudbuild.googleapis.com)は、Google Cloud インフラストラクチャでビルドを実行するサーバーレス CI/CD プラットフォームです。これは、Dockerfile からクラウドでコンテナ イメージをビルドするために使用されます。 - Vertex AI API(
aiplatform.googleapis.com)を使用すると、デプロイされたアプリケーションが Gemini モデルと通信して、コア AI タスクを実行できます。Google Cloud のすべての AI サービスに統合 API を提供します。 - Compute Engine API(
compute.googleapis.com)は、Google のインフラストラクチャで実行される安全でカスタマイズ可能な仮想マシンを提供します。Cloud Run はマネージドですが、Compute Engine API はさまざまなネットワーキング リソースとコンピューティング リソースの基盤となる依存関係として必要になることがよくあります。
6. 開発環境を準備する
ディレクトリを作成する
- ターミナルで、プロジェクト ディレクトリと必要なサブディレクトリを作成します。
cd && mkdir zoo_guide_agent && cd zoo_guide_agent - ターミナルで次のコマンドを実行して、Cloud Shell エディタ エクスプローラで
zoo_guide_agentディレクトリを開きます。cloudshell open-workspace ~/zoo_guide_agent - 左側のエクスプローラ パネルが更新されます。作成したディレクトリが表示されます。
プロジェクトを設定する
- ターミナルで、次のコマンドを使用してプロジェクトを設定します。
例:gcloud config set project [PROJECT_ID]gcloud config set project lab-project-id-example
- 次のようなメッセージが表示されます。
Updated property [core/project].
インストール要件
- ターミナルで次のコマンドを実行して、
requirements.txtファイルを作成します。cloudshell edit requirements.txt - 新しく作成した
requirements.txtファイルに次の内容を追加します。google-adk==1.14.0 langchain-community==0.3.27 wikipedia==1.4.0 - ターミナルで、uv を使用して仮想環境を作成して有効にします。これにより、プロジェクトの依存関係がシステム Python と競合しないようになります。
uv venv source .venv/bin/activate - ターミナルで、必要なパッケージを仮想環境にインストールします。
uv pip install -r requirements.txt
環境変数を設定する
- ターミナルで次のコマンドを使用して、
.envファイルを作成します。# 1. Set the variables in your terminal first PROJECT_ID=$(gcloud config get-value project) PROJECT_NUMBER=$(gcloud projects describe $PROJECT_ID --format="value(projectNumber)") SA_NAME=lab2-cr-service # 2. Create the .env file using those variables cat <<EOF > .env PROJECT_ID=$PROJECT_ID PROJECT_NUMBER=$PROJECT_NUMBER SA_NAME=$SA_NAME SERVICE_ACCOUNT=${SA_NAME}@${PROJECT_ID}.iam.gserviceaccount.com MODEL="gemini-2.5-flash" EOF
7. エージェント ワークフローの作成
__init__.py ファイルを作成する
- ターミナルで次のコマンドを実行して、init.py ファイルを作成します。
このファイルは、zoo_guide_agent ディレクトリがパッケージであることを Python に伝えます。cloudshell edit __init__.py - 新しい
__init__.pyファイルに次のコードを追加します。from . import agent
agent.py ファイルを作成する
- 次のコマンドをターミナルに貼り付けて、メインの
agent.pyファイルを作成します。cloudshell edit agent.py - インポートと初期設定: 現在空の
agent.pyファイルに次のコードを追加します。import os import logging import google.cloud.logging from dotenv import load_dotenv from google.adk import Agent from google.adk.agents import SequentialAgent from google.adk.tools.tool_context import ToolContext from google.adk.tools.langchain_tool import LangchainTool from langchain_community.tools import WikipediaQueryRun from langchain_community.utilities import WikipediaAPIWrapper import google.auth import google.auth.transport.requests import google.oauth2.id_token # --- Setup Logging and Environment --- cloud_logging_client = google.cloud.logging.Client() cloud_logging_client.setup_logging() load_dotenv() model_name = os.getenv("MODEL")agent.pyファイルの最初のブロックは、ADK と Google Cloud から必要なライブラリをすべて取り込みます。また、ロギングを設定し、.envファイルから環境変数を読み込みます。これは、モデルとサーバーの URL にアクセスするために不可欠です。 - ツールを定義する: エージェントの能力は、使用できるツールの能力に左右されます。
agent.pyの末尾に次のコードを追加して、ツールを定義します。 ツールの説明# Greet user and save their prompt def add_prompt_to_state( tool_context: ToolContext, prompt: str ) -> dict[str, str]: """Saves the user's initial prompt to the state.""" tool_context.state["PROMPT"] = prompt logging.info(f"[State updated] Added to PROMPT: {prompt}") return {"status": "success"} # Configuring the Wikipedia Tool wikipedia_tool = LangchainTool( tool=WikipediaQueryRun(api_wrapper=WikipediaAPIWrapper()) )add_prompt_to_state📝: このツールは、動物園の来場者が尋ねた内容を記憶します。「ライオンはどこにいますか?」という質問が来場者から寄せられた場合、このツールはその質問をエージェントのメモリに保存し、ワークフロー内の他のエージェントが何を調査すべきかを把握できるようにします。
方法: 共有のtool_context.state辞書に訪問者のプロンプトを書き込む Python 関数です。このツール コンテキストは、1 つの会話におけるエージェントの短期記憶を表します。1 つのエージェントによって State に保存されたデータは、ワークフローの次のエージェントが読み取ることができます。LangchainTool🌍: ツアーガイド エージェントに一般的な世界知識を提供します。「野生のライオンは何を食べるの?」など、動物園のデータベースにない質問が来場者から寄せられた場合、このツールを使用すると、エージェントは Wikipedia で回答を検索できます。
方法: アダプタとして機能し、エージェントが LangChain ライブラリのビルド済みの WikipediaQueryRun ツールを使用できるようにします。
- スペシャリスト エージェントを定義する: 次のコードを
agent.pyの末尾に追加して、comprehensive_researcherエージェントとresponse_formatterエージェントを定義します。# 1. Researcher Agent comprehensive_researcher = Agent( name="comprehensive_researcher", model=model_name, description="The primary researcher that can access both internal zoo data and external knowledge from Wikipedia.", instruction=""" You are a helpful research assistant. Your goal is to fully answer the user's PROMPT. You have access to two tools: 1. A tool for getting specific data about animals AT OUR ZOO (names, ages, locations). 2. A tool for searching Wikipedia for general knowledge (facts, lifespan, diet, habitat). First, analyze the user's PROMPT. - If the prompt can be answered by only one tool, use that tool. - If the prompt is complex and requires information from both the zoo's database AND Wikipedia, you MUST use both tools to gather all necessary information. - Synthesize the results from the tool(s) you use into preliminary data outputs. PROMPT: { PROMPT } """, tools=[ wikipedia_tool ], output_key="research_data" # A key to store the combined findings ) # 2. Response Formatter Agent response_formatter = Agent( name="response_formatter", model=model_name, description="Synthesizes all information into a friendly, readable response.", instruction=""" You are the friendly voice of the Zoo Tour Guide. Your task is to take the RESEARCH_DATA and present it to the user in a complete and helpful answer. - First, present the specific information from the zoo (like names, ages, and where to find them). - Then, add the interesting general facts from the research. - If some information is missing, just present the information you have. - Be conversational and engaging. RESEARCH_DATA: { research_data } """ )comprehensive_researcherエージェントは、オペレーションの「頭脳」です。共有Stateからユーザーのプロンプトを取得し、Wikipedia ツールかどうかを調べ、回答を見つけるために使用するツールを決定します。response_formatterエージェントの役割はプレゼンテーションです。リサーチャー エージェントによって収集された生データ(State 経由で渡される)を取得し、LLM の言語スキルを使用して、わかりやすい会話形式の回答に変換します。
- ワークフロー エージェントを定義する: このコードブロックを
agent.pyの最後に追加して、シーケンシャル エージェントtour_guide_workflowを定義します。 ワークフロー エージェントは、動物園ツアーの「バックオフィス」マネージャーとして機能します。研究リクエストを受け取り、上記の 2 つのエージェントが正しい順序でジョブを実行するようにします。つまり、最初に調査を行い、次にフォーマットを行います。これにより、訪問者の質問に答えるための予測可能で信頼性の高いプロセスが作成されます。tour_guide_workflow = SequentialAgent( name="tour_guide_workflow", description="The main workflow for handling a user's request about an animal.", sub_agents=[ comprehensive_researcher, # Step 1: Gather all data response_formatter, # Step 2: Format the final response ] )
方法:SequentialAgentは、自分で考えることのない特別なタイプのエージェントです。このジョブは、sub_agents(リサーチャーとフォーマッタ)のリストを固定シーケンスで実行し、共有メモリを自動的に次のジョブに渡すだけです。 - メインのワークフローを組み立てる: 次の最後のコードブロックを
agent.pyの末尾に追加して、root_agentを定義します。 ADK フレームワークは、すべての新しい会話の開始点としてroot_agent = Agent( name="greeter", model=model_name, description="The main entry point for the Zoo Tour Guide.", instruction=""" - Let the user know you will help them learn about the animals we have in the zoo. - When the user responds, use the 'add_prompt_to_state' tool to save their response. After using the tool, transfer control to the 'tour_guide_workflow' agent. """, tools=[add_prompt_to_state], sub_agents=[tour_guide_workflow] )root_agentを使用します。主な役割は、プロセス全体をオーケストレートすることです。最初のコントローラとして機能し、会話の最初のターンを管理します。

完全な agent.py ファイル
agent.py ファイルが完成しました。このように構築することで、各コンポーネント(ツール、ワーカー エージェント、マネージャー エージェント)が最終的なインテリジェント システムの作成において特定の役割を果たすことがわかります。
完全なファイルは次のようになります。
import os
import logging
import google.cloud.logging
from dotenv import load_dotenv
from google.adk import Agent
from google.adk.agents import SequentialAgent
from google.adk.tools.tool_context import ToolContext
from google.adk.tools.langchain_tool import LangchainTool
from langchain_community.tools import WikipediaQueryRun
from langchain_community.utilities import WikipediaAPIWrapper
import google.auth
import google.auth.transport.requests
import google.oauth2.id_token
# --- Setup Logging and Environment ---
cloud_logging_client = google.cloud.logging.Client()
cloud_logging_client.setup_logging()
load_dotenv()
model_name = os.getenv("MODEL")
# Greet user and save their prompt
def add_prompt_to_state(
tool_context: ToolContext, prompt: str
) -> dict[str, str]:
"""Saves the user's initial prompt to the state."""
tool_context.state["PROMPT"] = prompt
logging.info(f"[State updated] Added to PROMPT: {prompt}")
return {"status": "success"}
# Configuring the Wikipedia Tool
wikipedia_tool = LangchainTool(
tool=WikipediaQueryRun(api_wrapper=WikipediaAPIWrapper())
)
# 1. Researcher Agent
comprehensive_researcher = Agent(
name="comprehensive_researcher",
model=model_name,
description="The primary researcher that can access both internal zoo data and external knowledge from Wikipedia.",
instruction="""
You are a helpful research assistant. Your goal is to fully answer the user's PROMPT.
You have access to two tools:
1. A tool for getting specific data about animals AT OUR ZOO (names, ages, locations).
2. A tool for searching Wikipedia for general knowledge (facts, lifespan, diet, habitat).
First, analyze the user's PROMPT.
- If the prompt can be answered by only one tool, use that tool.
- If the prompt is complex and requires information from both the zoo's database AND Wikipedia,
you MUST use both tools to gather all necessary information.
- Synthesize the results from the tool(s) you use into preliminary data outputs.
PROMPT:
{ PROMPT }
""",
tools=[
wikipedia_tool
],
output_key="research_data" # A key to store the combined findings
)
# 2. Response Formatter Agent
response_formatter = Agent(
name="response_formatter",
model=model_name,
description="Synthesizes all information into a friendly, readable response.",
instruction="""
You are the friendly voice of the Zoo Tour Guide. Your task is to take the
RESEARCH_DATA and present it to the user in a complete and helpful answer.
- First, present the specific information from the zoo (like names, ages, and where to find them).
- Then, add the interesting general facts from the research.
- If some information is missing, just present the information you have.
- Be conversational and engaging.
RESEARCH_DATA:
{ research_data }
"""
)
tour_guide_workflow = SequentialAgent(
name="tour_guide_workflow",
description="The main workflow for handling a user's request about an animal.",
sub_agents=[
comprehensive_researcher, # Step 1: Gather all data
response_formatter, # Step 2: Format the final response
]
)
root_agent = Agent(
name="greeter",
model=model_name,
description="The main entry point for the Zoo Tour Guide.",
instruction="""
- Let the user know you will help them learn about the animals we have in the zoo.
- When the user responds, use the 'add_prompt_to_state' tool to save their response.
After using the tool, transfer control to the 'tour_guide_workflow' agent.
""",
tools=[add_prompt_to_state],
sub_agents=[tour_guide_workflow]
)
次はデプロイです。
8. デプロイ用にアプリケーションを準備する
最終的な構造を確認する
デプロイする前に、プロジェクト ディレクトリに正しいファイルが含まれていることを確認します。
zoo_guide_agentフォルダが次のようになっていることを確認します。zoo_guide_agent/ ├── .env ├── __init__.py ├── agent.py └── requirements.txt
IAM 権限を設定する
ローカルコードの準備ができたら、次のステップは、エージェントがクラウドで使用する ID を設定することです。
- ターミナルで、変数をシェル セッションに読み込みます。
source .env - Cloud Run サービス専用のサービス アカウントを作成して、独自の特定の権限を付与します。次の内容をターミナルに貼り付けます。
この特定のアプリケーション専用の ID を作成することで、エージェントは広範なアクセス権を持つデフォルトのアカウントを使用するのではなく、必要な権限のみを持つようになります。gcloud iam service-accounts create ${SA_NAME} \ --display-name="Service Account for lab 2 " - サービス アカウントに Vertex AI ユーザーロールを付与します。これにより、Google のモデルを呼び出す権限が付与されます。
# Grant the "Vertex AI User" role to your service account gcloud projects add-iam-policy-binding $PROJECT_ID \ --member="serviceAccount:$SERVICE_ACCOUNT" \ --role="roles/aiplatform.user"
9. ADK CLI を使用してエージェントをデプロイする
ローカルコードの準備が整い、Google Cloud プロジェクトの準備が完了したら、エージェントをデプロイします。ここでは、デプロイ ワークフロー全体を自動化する便利なツールである adk deploy cloud_run コマンドを使用します。この単一のコマンドは、コードのパッケージ化、コンテナ イメージのビルド、Artifact Registry への push、Cloud Run でのサービスの起動を行い、ウェブでアクセスできるようにします。
- ターミナルで次のコマンドを実行して、エージェントをデプロイします。
# Run the deployment command uvx --from google-adk \ adk deploy cloud_run \ --project=$PROJECT_ID \ --region=europe-west1 \ --service_name=zoo-tour-guide \ --with_ui \ . \ -- \ --labels=dev-tutorial=codelab-adk \ --service-account=$SERVICE_ACCOUNTuvxコマンドを使用すると、Python パッケージとして公開されたコマンドライン ツールを、それらのツールのグローバル インストールを必要とせずに実行できます。 - 次のプロンプトが表示された場合:
「Deploying from source requires an Artifact Registry Docker repository to store built containers. A repository named [cloud-run-source-deploy] in region [europe-west1] will be created. Do you want to continue (Y/n)?
Y」と入力して Enter キーを押します。 - 次のプロンプトが表示された場合:
「Allow unauthenticated invocations to [your-service-name] (y/N)?.
y」と入力して Enter キーを押します。これにより、このラボでは未認証の呼び出しが可能になり、テストが容易になります。 コマンドが正常に実行されると、デプロイされた Cloud Run サービスの URL が提供されます。(https://zoo-tour-guide-123456789.europe-west1.run.appのようになります)。 - 次のタスクのために、デプロイされた Cloud Run サービスの URL をコピーします。
10. デプロイしたエージェントをテストする
エージェントが Cloud Run で稼働したら、デプロイが成功し、エージェントが想定どおりに動作していることを確認するテストを行います。ADK のウェブ インターフェースにアクセスしてエージェントとやり取りするには、パブリック サービス URL(https://zoo-tour-guide-123456789.europe-west1.run.app/ など)を使用します。
- ウェブブラウザで一般公開の Cloud Run サービス URL を開きます。
--with_ui flagを使用したため、ADK デベロッパー UI が表示されます。 - 右上にある
Token Streamingをオンにします。
これで、Zoo エージェントを操作できるようになりました。 helloと入力して Enter キーを押すと、新しい会話が始まります。- 結果を確認します。エージェントは、次のような挨拶メッセージですぐに応答します。
"Hello! I'm your Zoo Tour Guide. I can help you learn about the amazing animals we have here. What would you like to know or explore today?"
- エージェントに次のような質問をします。
Where can I find the polar bears in the zoo and what is their diet?

エージェント フローの説明
システムはインテリジェントなマルチエージェント チームとして動作します。このプロセスは明確なシーケンスで管理され、ユーザーの質問から最終的な詳細な回答までスムーズかつ効率的に処理されます。
1. 動物園の受付係(ウェルカム デスク)
プロセス全体は、グリーター エージェントから始まります。
- 役割: 会話を開始します。ユーザーに挨拶し、どの動物について知りたいかを尋ねるように指示されています。
- 独自のツール: ユーザーが返信すると、Greeter は独自の add_prompt_to_state ツールを使用して、ユーザーの言葉を正確にキャプチャします(例: 「ライオンについて教えて」)をシステムメモリに保存します。
- ハンドオフ: プロンプトを保存すると、すぐにサブエージェントである tour_guide_workflow に制御を渡します。
2. 包括的な研究者(スーパー研究者)
これはメイン ワークフローの最初のステップであり、オペレーションの「頭脳」です。大規模なチームではなく、利用可能なすべての情報にアクセスできる 1 人の熟練したエージェントが対応します。
- 役割: ユーザーの質問を分析し、インテリジェントなプランを作成します。言語モデルのツール使用機能を使用して、次のものが必要かどうかを判断します。
- ウェブからの一般的な知識(Wikipedia API 経由)。
- 複雑な質問の場合は、両方。
3. レスポンス フォーマッタ(プレゼンター)
包括的なリサーチャーがすべての事実を収集したら、このエージェントが最後に実行されます。
- 役割: 動物園ツアーガイドの親しみやすい声として機能します。元データ(1 つまたは両方のソースから取得)を取得して、加工します。
- そのアクション: すべての情報を 1 つのまとまりのある魅力的な回答に統合します。指示に従って、まず動物園の具体的な情報を提示し、次に興味深い一般的な事実を追加します。
- 最終結果: このエージェントが生成したテキストは、ユーザーがチャット ウィンドウで確認できる完全で詳細な回答です。
エージェントの構築について詳しく知りたい場合は、次のリソースをご覧ください。
11. 環境をクリーンアップする
このチュートリアルで使用したリソースについて、Google Cloud アカウントに課金されないようにするには、リソースを含むプロジェクトを削除するか、プロジェクトを維持して個々のリソースを削除します。
Cloud Run サービスとイメージを削除する
Google Cloud プロジェクトを残し、このラボで作成した特定のリソースを削除する場合は、実行中のサービスとレジストリに保存されているコンテナ イメージの両方を削除する必要があります。
- ターミナルで次のコマンドを実行します。
gcloud run services delete zoo-tour-guide --region=europe-west1 --quiet gcloud artifacts repositories delete cloud-run-source-deploy --location=europe-west1 --quiet
プロジェクトを削除する(省略可)
このラボ専用に新しいプロジェクトを作成し、今後使用する予定がない場合は、プロジェクト全体を削除するのが最も簡単なクリーンアップ方法です。これにより、すべてのリソース(サービス アカウントや非表示のビルド アーティファクトなど)が完全に削除されます。
- ターミナルで次のコマンドを実行します([YOUR_PROJECT_ID] は実際のプロジェクト ID に置き換えます)。
gcloud projects delete $PROJECT_ID
12. 完了
これで、マルチエージェント AI アプリケーションを Google Cloud に正常にビルドしてデプロイできました。
内容のまとめ
このラボでは、空のディレクトリから一般公開されている AI サービスを作成しました。作成した内容は次のとおりです。
- 専門チームを作成した: 汎用的な AI を 1 つ作成する代わりに、事実を見つける「研究者」と回答を洗練させる「フォーマッタ」を作成しました。
- ツールを提供した: Wikipedia API を使用してエージェントを外部と接続しました。
- リリース済み: ローカルの Python コードを取得し、専用のサービス アカウントで保護されたサーバーレス コンテナとして Cloud Run にデプロイしました。
学習した内容
- ADK でのデプロイ用に Python プロジェクトを構造化する方法。
[SequentialAgent](https://google.github.io/adk-docs/agents/workflow-agents/sequential-agents/)を使用してマルチエージェント ワークフローを実装する方法。- Wikipedia API などの外部ツールを統合する方法。
adk deployコマンドを使用してエージェントを Cloud Run にデプロイする方法。
13. アンケート
出力: