`A2aAgent` builds agent-card `url` from default region (us-central1), ignoring `GOOGLE_CLOUD_AGENT_ENGINE_LOCATION`
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 68/100
調査の方向性
vertexai/preview/reasoning_engines/templates/a2a.py から始めて、A2aAgent.init と set_up() を読み、次に vertexai/agent_engines/templates/adk.py とロケーションの扱いを比較します。non-us-central1 へのデプロイメントで served card を確認します。URL が一貫して runtime リージョンを使用し、デフォルトリージョンの動作が維持されていれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Summary
When an A2A agent (vertexai.preview.reasoning_engines.A2aAgent) is deployed to Vertex AI Agent Engine in a region other than us-central1, the served Agent Card's url field is built with the wrong region (us-central1). The reasoningEngines/<id> resource itself is created in the correct region, but the card url — which A2A clients use as the base for message:send — points elsewhere, so client calls derived from the card hit the wrong region.
Environment
google-cloud-aiplatform==1.149.0agents-cli(google-agents-cli)0.4.0— agent generated from itsadk_a2atemplate with--deployment-target agent_runtimea2a-sdk==0.3.26(server-side; pinned~=0.3.22by theadk_a2atemplate)- Deploy target: Vertex AI Agent Engine (Agent Runtime), region
us-east1 - Agent: ADK agent wrapped via
A2aAgent
Steps to reproduce
- Deploy an
A2aAgent-wrapped ADK agent to Agent Engine inus-east1(any non-us-central1region). - Fetch the authenticated agent card:
GET https://us-east1-aiplatform.googleapis.com/v1beta1/projects/<project>/locations/us-east1/reasoningEngines/<id>/a2a/v1/card
Expected — card.url:
https://us-east1-aiplatform.googleapis.com/v1beta1/projects/<project>/locations/us-east1/reasoningEngines/<id>/a2a
Actual — card.url:
https://us-central1-aiplatform.googleapis.com/v1beta1/projects/<project>/locations/us-central1/reasoningEngines/<id>/a2a
(The reasoningEngines/<id> resource is correctly in us-east1; only the card url is wrong.)
Root cause
In vertexai/preview/reasoning_engines/templates/a2a.py:
A2aAgent.__init__ captures the location from the SDK global config (L198):
"location": initializer.global_config.location,
set_up() then uses that captured value to build the card URL (L244, L249):
location = self._tmpl_attrs.get("location")
...
self.agent_card.url = f"https://{location}-aiplatform.googleapis.com/{version}/projects/{project}/locations/{location}/reasoningEngines/{agent_engine_id}/a2a"
initializer.global_config.location falls back to DEFAULT_REGION = "us-central1" (google/cloud/aiplatform/constants/base.py:21) whenever vertexai.init(location=...) has not been called — which is the case in the deployed runtime — so the URL is stamped with us-central1.
The Agent Engine runtime does inject the correct region as the env var GOOGLE_CLOUD_AGENT_ENGINE_LOCATION (confirmed present at runtime with the real region). AdkApp already honors it — vertexai/agent_engines/templates/adk.py:321:
location = os.getenv("GOOGLE_CLOUD_AGENT_ENGINE_LOCATION", "") or os.getenv("GOOGLE_CLOUD_LOCATION", "")
A2aAgent does not, so the two templates resolve the deploy region inconsistently.
Suggested fix
Resolve the location in A2aAgent.set_up() the same way AdkApp does, preferring the runtime-injected env var over the SDK default:
location = (
os.getenv("GOOGLE_CLOUD_AGENT_ENGINE_LOCATION")
or os.getenv("GOOGLE_CLOUD_LOCATION")
or self._tmpl_attrs.get("location")
)
Resolve in set_up() (not __init__): __init__ also runs during deploy-time introspection, where the runtime env var is absent.
Workaround
In user code imported before the A2aAgent is constructed, set the SDK location at import:
import os, vertexai
_loc = os.environ.get("GOOGLE_CLOUD_AGENT_ENGINE_LOCATION")
if _loc:
vertexai.init(location=_loc)
- 主要言語
- Python
- スター
- 907
- フォーク
- 467
- 平均マージ
- 1日 13時間
- マージ済み PR(30日)
- 44
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
googleapis/python-aiplatform のほかの issue
-
api: vertex-ai
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
googleapis/python-aiplatform#7132 ·
-
api: vertex-ai
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
googleapis/python-aiplatform#7097 · コメント 1 件 ·
-
CustomContainerTrainingJob.run drops max_wait_duration=0 instead of requesting indefinite DWS wait オープンapi: vertex-ai
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
googleapis/python-aiplatform#7067 · コメント 1 件 ·
-
api: vertex-ai
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
googleapis/python-aiplatform#6865 · コメント 1 件 ·
-
api: vertex-ai
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
googleapis/python-aiplatform#6822 · リアクション 2 件 ·
googleapis/python-aiplatform の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100