Zenn
🤖

ADK を試す (BigQuery API Tool、pre-build tool、Dev UI、Deploy、Trace)

に公開
2

こんにちはサントリーこと大橋です。

Cloud Next 2025にてAgent Development Kit(ADK)がリリースされました。

https://google.github.io/adk-docs/

基調講演ではそこまで細かな紹介はしていませんが、Google製AI Agentフレームワーク & 開発環境と言えます。

今回は折角発表されたので諸々試しつつ、Google Cloudへデプロイするところまで試してみます。。

ADK is 何?

Agent Development KitはCloud Next 2025にて発表されたGoogle製の新しいAI Agentフレームワーク&開発環境です。
以下のような特徴があります。

  • OSS
  • マルチエージェントアーキテクチャ
    • 最初から複数のエージェントを利用する前提
  • 豊富なpre-build tool
    • ここで言うToolはTool CallingのTool
    • LangChainなどのpre-build toolも利用可能
    • MCPやOpen API、Google関連MCP等など
  • 開発UI

MCPが扱えることや、LangChainなどの既存ライブラリが扱えること、また開発UIなどAI Agentを作る上で有った方が良いものは揃っています。

Evaluationなども仕組みが用意されていますし、Deploy周りもCloud RunへはCLIが準備されており、Agent Engineへもデプロイ可能でドキュメントは揃っています。

またドキュメントには書いていませんでしたが、コードを読む限りではOpenTelemetryを利用したTracingなどもサポートしていて、運用面まで意識した作りになっています。

始めてみよう

とりあえず Googleのenakai さんが書かれたAgent EngineへLangGraphアプリケーションをデプロイする記事と同じアプリケーションをADKバージョンで作成して、Agent EngineとCloud Runへデプロイしてみたいと思います。

https://zenn.dev/google_cloud_jp/articles/06cb259cc1d42d

環境準備

最近はmiseとuvを利用してpythonプロジェクトを管理しているので、miseとuvでプロジェクトを準備します。

mkdir adk-sandbox
cd adk-sandbox
mise use python@3.12.5
mise use uv@latest
uv init --app
uv venv

miseで自動的にuvのvirtualenvが有効になるように設定追加

mise.toml
[tools]
python = "3.12.5"
uv = "latest"

# 以下追加
[settings]
python.uv_venv_auto = true

adkのインストール

uv経由で取得

uv add google-adk

プロジェクト構成

ドキュメントを読む感じ、1 module 1 AI Agentっぽいので以下のようにします。

adk-sandbox # project root
├── README.md
├── data_analysis_agent # AI Agent module
│   ├── __init__.py
│   ├── .env
│   ├── agent.py
│   └── tools.py
├── mise.toml
├── pyproject.toml
└── uv.lock

今回であれば data_analysis_agentが1つのAI Agentにあります。好きなお名前でいいっぽい

.env

Geminiを利用する場合は.envに各種設定を入れておく
環境変数に設定でも多分おk

GOOGLE_GENAI_USE_VERTEXAI=FALSE
GOOGLE_API_KEY= AI StudioからGeminiのAPIを取得して貼り付け

とりあえず最小のAgentで開発UIを表示

とりあえずBigQueryは忘れて、GeminiとだけつながるAgentを作成してみます。

以下をdata_analysis_agent/agent.pyへ記述

agent.py
import os
from google.adk.agents import LlmAgent

# https://zenn.dev/google_cloud_jp/articles/06cb259cc1d42d のシステムプロンプトをもらってきました。
instruction = """
You are a data analytics expert. Work on the following tasks.
    
[task]
A. Answer the question with the reason based on the data you get from BigQuery.

[condition]
A. Use SQL queries to get information from BigQuery using the column definitions in the [table information].
A. The answer and the reason must be based on the quantitative information in tables.
A. Use concrete area names in the answer instead of zone_id or location_id.
A. Try to use ascii tables and bullet list to visualize your analysis.

[format instruction]
In Japanese. In plain text, no markdowns.

[table information]
columns of the table 'bigquery-public-data.new_york_taxi_trips.taxi_zone_geom'
- zone_id : Unique ID number of each taxi zone. Corresponds with the pickup_location_id and dropoff_location_id in each of the trips tables
- zone_name : Full text name of the taxi zone

columns of the table: 'bigquery-public-data.new_york_taxi_trips.tlc_yellow_trips_2022'
- pickup_datetime : The date and time when the meter was engaged
- dropoff_datetime : The date and time when the meter was disengaged
- passenger_count : The number of passengers in the vehicle. This is a driver-entered value.
- trip_distance : The elapsed trip distance in miles reported by the taximeter.
- fare_amount : The time-and-distance fare calculated by the meter
- tip_amount : Tip amount. This field is automatically populated for credit card tips. Cash tips are not included.
- tolls_amount : Total amount of all tolls paid in trip.
- total_amount : The total amount charged to passengers. Does not include cash tips.
- pickup_location_id : TLC Taxi Zone in which the taximeter was engaged
- dropoff_location_id : TLC Taxi Zone in which the taximeter was disengaged
"""

root_agent = LlmAgent(
    name="data_analysis_agent",
    model="gemini-2.0-flash-exp",
    description="Agent to analysis bigquery data.",
    instruction=instruction
)

この状態でプロジェクトルートに戻って以下を実行

adk web

localhost:8000に開発UIが立ち上がります。
ヘッダーの「Select an agent」をクリックすると作成したAI Agentが表示されるので選択して質問してみます。

うまくいった。だいぶ簡単。
ただし、2025/04/11時点では日本語入力でEnterキー押すとチャットに入力されちゃうのでちょと辛い
Issueを入れておきます。

[2025/04/13追記]
Issue追加済み
https://github.com/google/adk-python/issues/79

ただFrontendのコードがadkのリポジトリになく(難読化済みコードのみ)、PR投げれないため、一旦FrontendくれってIssueを追加しておいた
https://github.com/google/adk-python/issues/118

Tool

今回はBigQueryへと接続する必要があるので、何かしらを用意する必要があります。
その方法がToolです。

https://google.github.io/adk-docs/tools/

ADKにおいてToolはAI Agentに対して提供する特定の機能を表します。
普通はPython関数やクラスメソッド、何かしらのAgentで表現されますが、
概念は他のAI AgentフレームワークのToolとだいたい同じです。

LLMが機能の呼び出しが必要だと判断すると、AI Agent(フレームワーク)に対してToolの呼び出しを求めてTool名とパラメータを渡します。
するとAI Agent(フレームワーク)がToolを呼び出して、結果を取得し、LLMへ渡します。

ADKにおいては大きく分けて3つのToolがあります。

  • Function Tools
    • 自作Tool Pythonの関数を自分で書いたり、ADKで作成したAI AgentをToolとして利用できます。
  • Build-In Tools
    • ADKの中に含まれるRAGやCode Executionなどの実装済みTool
    • MCP用Toolや、OpenAPI用Tool、Google Cloud関連Tool等が存在する
    • OpenAPI用Toolについては、Google API用Toolが作成済みです
  • Third-Party Tools
    • LangChainやCrewAIなど別フレームワークで作成、提供されているTool
    • ADK用のラッパーがあり、ラッパー経由で既存の別フレームワークのToolが利用できる

BigQueryへ接続するツール

BigQueryに接続するにも上記通り複数手段があって、

  • 自作Tool
    • BigQuery Python Clientを利用した自作Toolを作成する
  • Build-In Tool
    • 2種類使えるものがある
      • Integrations Connector を利用してADKに含まれるApplicationInetgrationToolsetからBigQueryへ接続するためのToolを作成する
      • Google API用Tool 多分コード読んだ感じgoogle.adk.tools.google_api_tool.google_api_tool_sets.bigquery_tool_set がそれ
  • MCP Tool
    • BigQuery向けのMCPは誰かが作ったやつがあるのでそれをADKのMCPToolset経由で作成する

のいずれかがあります。
自作Toolはまあやれるでしょうから他の手段でやってみます。

Build-In Tool① Integrations Connector

先に言おう。うまくできなかった。
興味ない人は読み飛ばしてください。

この方法は、Cloud Next 2025で同時に発表された、Agent Gardenでも紹介されいて、ざっくり言えば

  1. Google CloudでBigQueryと接続するIntegrations Connectorを作成
  2. ADKのApplicationInetgrationToolsetにて、1.で作成したConnectorと接続する

の方法でできるらしいです。
この方法の利点はみんな大好きADC(Application Default Credential)を利用できるので、
ローカルではgcloud auth application-default loginで認証が作成でき、
Google Cloud上ではそれぞれの実行環境の認証情報が利用でき認証周りを気にする必要がなくなります。。

ApplicationInetgrationToolsetのサンプルコードも以下でだいぶ楽

tools.py
bigquery_tool_set = ApplicationIntegrationToolset(
    project="projectID", # TODO: replace with GCP project of the connection
    location="location", #TODO: replace with location of the connection
    connection="connector name", #TODO: replace with connection name
    entity_operations={"Entity_One": ["LIST","CREATE"], "Entity_Two": []},#empty list for actions means all operations on the entity are supported.
    actions=["action1"], #TODO: replace with actions
    service_account_credentials='{...}', # optional
    tool_name="tool_prefix2",
    tool_instructions="..."
)

ということで、1.からやってみようとBigQueryのIntegrations Connectorを素のGoogle Cloud Projectから作成しようとすると、Internal Errorが発生します。
多分他に事前の設定が必要なのだけど(Cloud Loggingを見る限りDNS Authorizationに関するエラーらしくて多分ネットワーク周りの設定が必要?)、今回これのエラーを解決することが目的じゃないので一旦保留 Integrations Connectorを扱ったことがある人は試してみてほしいです。

Build-In Tool② Google API

こちらはADKに含まれるOpen APIToolを利用して作成されたToolを利用します。
全くサンプルコードとか、テストコードとか無いけどgoogle.adk.tools.google_api_tool.google_api_tool_sets.bigquery_tool_set があるので、多分これじゃね?

とりあえず以下のコードでやってみます。

agent.py
import os
from google.adk.agents import LlmAgent
from google.adk.tools.google_api_tool.google_api_tool_sets import bigquery_tool_set

instruction = """
あれこれAgentへのsytem prompt
"""

# 調べた感じ、OAuth2フローで認証するっぽいのでCloud ConsoleでClient IDとClient Secretを作成して環境変数に設定
bigquery_tool_set.configure_auth(os.environ["GOOGLE_CLIENT_ID"], os.environ["GOOGLE_CLIENT_SECRET"])

# ここの変数名は root_agentにしていないと
root_agent = LlmAgent(
    name="data_analysis_agent",
    model="gemini-2.0-flash-exp",
    description="Agent to analysis bigquery data.",
    instruction=instruction,
    tools=[bigquery_tool_set.get_tool("bigquery_jobs_query")],
)

これでOK
開発UIでやってみましょう。
.... なんかできない。 OAuth2フローが開発UIでサポートしてない臭い??

あとgoogle_api_tool_setsモジュールを読み込むと、各種Google APITool群の初期化処理が走るらしく、サポートしてる全部のAPIのOpen APIドキュメントを取得しに行くらしく最初時間かかる辛い Issueにあげておきます。


[2025/04/13]
追加済

https://github.com/google/adk-python/issues/87

他の人がPRも投げてくれているけど、bigquery_tool_setも消してるので、そのうち無くなるかも


がががっとコードを調べた感じ、
google.adk.tools.openapi_tool.auth.auth_helpers.service_account_scheme_credentialgoogle.adk.tools.openapi_tool.auth.auth_helpers.ServiceAccountを利用してうまい感じでやればADC経由でできそうなので、そちらを利用する方法でやってみましょう。

まずapplication default credentialsをローカルで使えるようにgcloudコマンドでログインします。

gcloud auth application-default login

次にコードを修正します。

agent.py
import os
from google.adk.agents import LlmAgent
from google.adk.tools.google_api_tool.google_api_tool_sets import bigquery_tool_set
from google.adk.tools.openapi_tool.auth.auth_helpers import service_account_scheme_credential, ServiceAccount

instruction = """
# 上のinstructionの文章に
# 以下をconditionに追加
A. If you need project id for query, please use `your project id`.
----
"""

# ServiceAccountクラスのuse_default_credential=Trueを設定することでADCを利用するようになる
sa = ServiceAccount(
    use_default_credential=True,
    scopes=["https://www.googleapis.com/auth/bigquery"]
)
auth_scheme, auth_credential = service_account_scheme_credential(sa)

bigquery_jobs_query_tool = bigquery_tool_set.get_tool("bigquery_jobs_query")

# 内部で利用しているrest_api_toolにスキーマと、クレデンシャルを設定
bigquery_jobs_query_tool.rest_api_tool.auth_scheme = auth_scheme
bigquery_jobs_query_tool.rest_api_tool.auth_credential = auth_credential

root_agent = LlmAgent(
    name="data_analysis_agent",
    model="gemini-2.0-flash-exp",
    description="Agent to analysis bigquery data.",
    instruction=instruction,
    tools=[bigquery_jobs_query_tool],
)

コードの修正ができたので再度 開発UIを起動します。

adk web

うまくいった!
なお、bigquery_jobs_query_toolを利用する場合、呼び出しにはOpenAPIドキュメントによって定義されたパラメータがすべて指定可能です。
逆に言うと、LLMはパラメータが複数あるのでそれらをほとんど指定しに行きます。ここでたまに不正なパラメータを指定したりするので、固定したいパラメータはinstructionの中で指定しておいてあげると良さそうです。(最初 project_idを your_project_idにされていました。)

そういう意味では変に不正なパラメータを指定されたくないのであれば、自分でBigQuery Python Clientを呼びだし、SQLを実行するだけのToolを作成するほうが良いです。

なおこの処理も普通にやるでしょと思うので、Issue追加済
https://github.com/google/adk-python/pull/120

自作Tool

https://google.github.io/adk-docs/tools/function-tools/

自作Toolも試してみましょう。
まず bigquery-python-clinetを追加します。

uv add google-cloud-bigquery

次に以下のPython関数を作成します。

tools.py
from google.cloud import bigquery
import json

def execute_query(query: str) -> str:
    """
    This is a tool for executing queries in BigQuery and retrieving data.
    Query results are returned in JSON format.

    Args:
        query (str): The SQL query to execute.

    Returns:
        str: The query result in JSON format.

    Raises:
        Exception: If the query fails.
    """
    try:
      client = bigquery.Client(project="ai-agent-sample-1", location="US")
      job = client.query(query)
      result = job.result()
      result = [dict(row) for row in result]
      result = [{key: str(value) for key, value in raw.items()} for raw in result]
      return json.dumps(result, ensure_ascii=False)
    except Exception as e:
      print(f"Failed to run query: {e}")
      raise

なお自作Toolの場合、Toolの説明はDocstring形式で書きます。
ADKのドキュメントではGoogle形式のDocstringで書かれていますが、
多分そうじゃなくても大丈夫?かな

このToolをAgentで読み込むように設定します。

agent.py
import os
from google.adk.agents import LlmAgent
from . import tools

instruction = """
略
"""

root_agent = LlmAgent(
    name="data_analysis_agent",
    model="gemini-2.0-flash-exp",
    description="Agent to analysis bigquery data.",
    instruction=instruction,
    tools=[tools.execute_query], # ここ修正
)

実行してみると正しく動いているようです。

自作Toolのほうが、先程のBuild-In Toolに比べてパラメータはSQLクエリのみであり、また戻り値もJSON形式の結果のみのため、LLM的にも解釈がしやすく呼び出し易いでしょう。

MCPTool

MCPも対応しているのですが、今回は面倒なので省略します。
他のAgentフレームワーク同様に諸々設定すればMCP経由でMCPサーバーを呼び出せます。

https://google.github.io/adk-docs/tools/mcp-tools/

デプロイ

では次にデプロイをしてみます。

https://google.github.io/adk-docs/deploy/

デプロイ先は3種類あって

  • Agent Engine
  • Cloud Run
  • その他

がドキュメントでは書かれています。

Agent Engine

https://google.github.io/adk-docs/deploy/agent-engine/

まずはAgent Engineへデプロイしてみましょう。
Agent EngineはGoogle Cloudのサービスの一つで、AI Agentをデプロイ・管理するためのコンピューティングサービスです。

AppEngine老害勢としては何度もAppEngineと書きそうになりますよね。興奮します。

AI Agentをデプロイすると、HTTP(curl)で経由でAI Agentの呼び出しができるようになります。

Agent Engineへデプロイする場合は、adkでというよりも、Agent Engine用に用意されているライブラリ(Vertex AI SDK)を利用してデプロイを行います。

まずAgent Engineのライブラリ(Vertex AI SDK)をインストールします。

uv add google-cloud-aiplatform[adk,agent_engines]

次にデプロイ時にソースコードがGCSにアップロードされるためそのバケットを作成しておきます。

gcloud storage buckets create gs://bucket_name --project your_projecct_id

次にデプロイ用のコードを書きます。

main.py
import vertexai
from vertexai import agent_engines
from vertexai.preview import reasoning_engines
from data_analysis_agent.agent import root_agent

PROJECT_ID = "your_projecct_id"
LOCATION = "us-central1"
STAGING_BUCKET = "gs://bucket_name"

vertexai.init(
    project=PROJECT_ID,
    location=LOCATION,
    staging_bucket=STAGING_BUCKET,
)

def main():

    app = reasoning_engines.AdkApp(
        agent=root_agent,
        enable_tracing=True,
    )

    remote_app = agent_engines.create(
        agent_engine=app,
        requirements=[
            "google-adk>=0.1.0",
            "google-cloud-aiplatform[adk,agent-engines]>=1.88.0",
            "google-cloud-bigquery>=3.31.0",
        ],
        extra_packages=['data_analysis_agent']
    )

if __name__ == "__main__":
    main()

ADKのドキュメントには書いていませんが以下が必要です。

  • extra_packagesで読み込むagentがおいてあるディレクトリ(モジュール)を指定
    • やらないとソースコードがアップロードされないため、デプロイエラーになります。なりました。
  • ADKのドキュメントではagent_engines.createagent_engineパラメータにAdkAppでラップせずに直接`root_agentPを指定していますが、多分ラップした方がtraceとか使えるんじゃないかと思ってます。まだ試していません。Agent Engineのドキュメントではラップして渡しています。

あとはこのpythonコードを実行すればデプロイされます。

python main.py

ではデプロイされたか確認してみましょう。
Cloud Console? gcloudコマンド? Agent Engineにそんなものはまだ準備されていません。

REST APIかVertex AI SDK経由で登録状況を取得します。

list_agent.py
import vertexai
from vertexai import agent_engines

PROJECT_ID = "your_projecct_id"
LOCATION = "us-central1"

def main():
    vertexai.init(
        project=PROJECT_ID,
        location=LOCATION,
    )

    agents = agent_engines.list()

    for agent in agents:
        print(agent.name)
        
if __name__ == "__main__":
    main()

実行します。

python list_agent.py

xxxxxxxxx(ID)

デプロイできているようです。

Agent Engine上のAI Agentを実行してみる

ではAgent EngineにあるAI Agentへクエリを投げてみましょう。
Agent EngineにあるAI AgentへはcurlかVertex AI SDK経由で実行できます。
今回はVertex AI SDK経由で実行します。

まずAgent Engineで利用するService Accountにいくつかの権限を与えます。

PROJECT_ID=your_project_id
PROJECT_NUMBER=$(gcloud projects describe $PROJECT_ID --format='value(projectNumber)')
gcloud projects add-iam-policy-binding $PROJECT_ID \
    --member="serviceAccount:service-${PROJECT_NUMBER}@gcp-sa-aiplatform-re.iam.gserviceaccount.com" \
    --role='roles/aiplatform.user'
gcloud projects add-iam-policy-binding $PROJECT_ID \
    --member="serviceAccount:service-${PROJECT_NUMBER}@gcp-sa-aiplatform-re.iam.gserviceaccount.com" \
    --role='roles/bigquery.user'

次に実行用のコードを作成します。

run_agent_engine.py
import vertexai
from vertexai import agent_engines

PROJECT_ID = "your_project_id"
LOCATION = "us-central1"
AGENT_ENGINE_ID="xxxxxxx"
def main():
    vertexai.init(
        project=PROJECT_ID,
        location=LOCATION,
    )

    agent = agent_engines.get(f"projects/{PROJECT_ID}/locations/{LOCATION}/reasoningEngines/{AGENT_ENGINE_ID}")
    
    # セッションの作成
    remote_session = agent.create_session(user_id="santry")

    # queryの実行
    for event in agent.stream_query(
        user_id="santry",
        session_id=remote_session["id"],
        message="tlc_yellow_trips_2022 テーブルには何件レコードがありますか?"
    ):
        print("-----")
        print(event)
        
if __name__ == "__main__":
    main()

実行してみます。

python run_agent_engine.py
-----
{'content': {'parts': [{'function_call': {'id': 'adk-171a4c0f-450c-402f-8c60-4d157990b378', 'args': {'query': 'SELECT count(*) FROM bigquery-public-data.new_york_taxi_trips.tlc_yellow_trips_2022'}, 'name': 'execute_query'}}], 'role': 'model'}, 'invocation_id': 'e-add838ae-f55c-472e-999f-ed74f524cc3c', 'author': 'data_analysis_agent', 'actions': {'state_delta': {}, 'artifact_delta': {}, 'requested_auth_configs': {}}, 'long_running_tool_ids': [], 'id': 'nhtqp3AU', 'timestamp': xxxxxxxxxxxxxx}
-----
{'content': {'parts': [{'function_response': {'id': 'adk-171a4c0f-450c-402f-8c60-4d157990b378', 'name': 'execute_query', 'response': {'result': '[{"f0_": "36256539"}]'}}}], 'role': 'user'}, 'invocation_id': 'e-add838ae-f55c-472e-999f-ed74f524cc3c', 'author': 'data_analysis_agent', 'actions': {'state_delta': {}, 'artifact_delta': {}, 'requested_auth_configs': {}}, 'id': 'Jcpg3VV6', 'timestamp': xxxxxxxxxxxxxx}
-----
{'content': {'parts': [{'text': 'tlc_yellow_trips_2022テーブルには36,256,539件のレコードがあります。\n'}], 'role': 'model'}, 'invocation_id': 'e-add838ae-f55c-472e-999f-ed74f524cc3c', 'author': 'data_analysis_agent', 'actions': {'state_delta': {}, 'artifact_delta': {}, 'requested_auth_configs': {}}, 'id': '4BGTg2U4', 'timestamp': xxxxxxxxxxxx}

うまくいったようです。
たまにうまくToolが呼べない事がありますが、Geminiさん日本語が不得意な時があるので、その場合は英語でやさしく聞いてください。

トレース

enable_tracingTrueにしていたので、トレースできているといいですね
見てみましょう。

トレース情報はCloud ConsoleのCloud Traceに入っています。

実行のトレースがCloud Traceに送られているようです。
Cloud TraceのRelease noteやアップデート情報には見当たりませんでしたが、「生成AI」というタブやチップが追加されており、やっとCloud Traceで生成AI用のTraceのやる気を出してきたようです。

ただし「生成AI」タブには入出力トークン数が表示されるようですが、まだ0としてカウントされているのでこれから諸々サポートされていくでしょう。

Agent Engineの削除(クリーンアップ)

一応作成したものを削除しておきます。
以下のpythonコードを実行します。

delete_agent_engine.py
import vertexai
from vertexai import agent_engines

PROJECT_ID = "your_project_id"
LOCATION = "us-central1"
AGENT_ENGINE_ID="xxxxxx"
def main():
    vertexai.init(
        project=PROJECT_ID,
        location=LOCATION,
    )

    agent = agent_engines.get(f"projects/{PROJECT_ID}/locations/{LOCATION}/reasoningEngines/{AGENT_ENGINE_ID}")
    agent.delete()
        
if __name__ == "__main__":
    main()

実行して削除します。

python delete_agent_engine.py

Cloud Run

次はCloud Runにデプロイします。
Cloud RunへADKのcli経由でデプロイができます。

export GOOGLE_CLOUD_PROJECT="your_project_id"
export GOOGLE_CLOUD_LOCATION="asia-northeast1"
export SERVICE_NAME="ai-agent-sample"
export APP_NAME="data_analysis_agent"
export AGENT_PATH="./data_analysis_agent"

adk deploy cloud_run \
--project=$GOOGLE_CLOUD_PROJECT \
--region=$GOOGLE_CLOUD_LOCATION \
--service_name=$SERVICE_NAME \
--app_name=$APP_NAME \
--with_ui \
$AGENT_PATH

なお --with_ui を行うことで先程利用していたDev UIも一緒にデプロイが可能です。

途中以下の様にCloud Runへの未認証でのアクセスを許容するか聞かれます。
利用用途に合わせて答えてください。

Allow unauthenticated invocations to [ai-agent-sample] (y/N)? 

未認証アクセスを拒否(否定の否定はわかりにくい 認証アクセスのみにする)した場合はCloud Runのドキュメントとか参照していい感じにやってください。今回は面倒なので、アクセスを許可します。
暫く待つとデプロイが完了します。

Done.                                                                                                                                             
Service [ai-agent-sample] revision [xxxxxxxxxxx] has been deployed and is serving 100 percent of traffic.
Service URL: https://ai-agent-sample-xxxxxxxxxxxxxxxx.asia-northeast1.run.app
Cleaning up the temp folder: xxxxxxxx

Cloud RunへのURLが表示されるので表示してみます。

無事できたようです。

トレース

残念ながらCloud Runの場合はCloud Traceへトレース情報が出力されていませんでした。
他に何かしらの設定が必要なのかもしれませんが、現状だとさぐれていません。
なにかわかったら別記事を書きます。

Clean up

なんかいい感じでやっておいてください。
面倒になったわけでは.....あります。

まとめ

ということでAgent Development Kitを利用してAI Agentを作成し、デプロイまでしてみました。
LLMを利用したアプリケーションが比較的少ないコード量で作成することができました。

また、豊富なBuild-In Toolにより、BigQueryへの接続も簡単にできましたし、比較的リッチな開発UIがあるため開発も容易に行えそうです。

Agent EngineへのデプロイであればCloud Traceへのトレース情報の出力も可能で、かなり本番環境で利用可能なプロダクトになっているのではないでしょうか。

まだまだバグやドキュメント不足感は否めませんが、OSSであるため、文句言うより貢献をするべきですね。

なおGoogleにはFirebaseが作成したGenkitというJavaScript(TypeScript GoやPythonバージョンもある)のAI Agentフレームワークがあり、Genkit MonitoringというAI Agent向けトレースサービスもあります。
このあたりとの兼ね合いはどうなっていくのか、統合する気はあるのか、ドキドキしながら見ていきたいですね。

また、個人的には開発UIはスクラップにも書きましたがAgent Starter Packのほうが好みです。
このあたりも良いものを統合していっていただけるといいですね。

2

Discussion

ログインするとコメントできます