Agent Platform SDK for Python: バージョン 2.0.1 移行ガイド

google-cloud-aiplatform パッケージには、AI Platform SDK for Python と Gemini Enterprise Agent Platform Python クライアント ライブラリの両方が含まれています。このページでは、google-cloud-aiplatform パッケージの次のカテゴリの変更について説明します。

  • 生成 AI モジュールが Google Gen AI SDK に移行: vertexai パッケージの次の生成 AI モジュールは非推奨となり、Google Gen AI SDK(google-genai)に移行されます。

    • vertexai.generative_models
    • vertexai.language_models
    • vertexai.vision_models
    • vertexai.caching
    • vertexai.tuning

    非推奨のモジュールを Google Gen AI SDK に移行する方法については、生成 AI モジュールを Google Gen AI SDK に移行するをご覧ください。

  • エージェント サーフェスの再構築: google-cloud-aiplatformagentplatform モジュールに次の変更が加えられました。

    • 名前の変更
    • トップレベルへの昇格
    • グローバル イニシャライザの削除

    新しい SDK 構造に移行する方法については、Agent Platform SDK の再構築をご覧ください。

  • agentplatform の分離: google-cloud-agentplatform はスタンドアロンの軽量ディストリビューションとなり、エージェント ワークロードに推奨されるインストールになりました。エージェントのみを構築する場合は、生成 AI モジュールを含まない google-cloud-agentplatform をインストールします。agentplatform モジュールは、[adk][a2a][agent_engines][langchain][ag2][llama_index][evaluation][bigquery][live][all] などの一般的な統合を対象としています。

影響を受けないもの

従来の ML サーフェス(データセット、トレーニング、モデル、予測、トラッキング、パイプライン)は完全にサポートされており、バージョン 2.0.1 の変更の影響を受けず、Google Gen AI SDK に同等の機能はありません。google-cloud-aiplatform をインストールすると、評価、Agent Runtime、プロンプト、スキルに引き続きアクセスできます。google-cloud-aiplatformgoogle-genai は 1 つの環境に共存し、google-genaigoogle-cloud-aiplatform のハード依存関係になりました。

import agentplatform

client = agentplatform.Client(project="my-project", location="global")
# client.evals                  client.prompts
# client.prompt_optimizer client.datasets           client.skills

vertexai.batch_prediction は非推奨ではありませんが、同等の Google Gen AI SDK が存在し、推奨ツールとなっています。

生成 AI モジュールを Google Gen AI SDK に移行する

google-cloud-aiplatform パッケージの生成 AI モジュールを使用する場合は、次の推奨事項に沿って Google Gen AI SDK(google-genai)に移行してください。

  1. google-cloud-aiplatform < 2.0.0 を設定して、関連性のない依存関係の更新によって、下位のモジュールが削除されないようにします。

  2. コード内で非推奨のモジュールを検索します。

    • vertexai.generative_models
    • vertexai.language_models
    • vertexai.vision_models
    • vertexai.caching
    • vertexai.tuning

    影響を受ける Python モジュールをインポートすると、次の非推奨の警告が表示されます。

    UserWarning: This feature is deprecated as of June 24, 2025 and will be removed on
    June 24, 2026. For details, see
    https://cloud.google.com/vertex-ai/generative-ai/docs/deprecations/genai-vertexai-sdk.
    

    -W error::UserWarning でテストスイートを実行して、見逃したインポートを検出します。

  3. vertexai.init(...) を明示的な genai.Client(enterprise=True, project=..., location=...) に置き換えます。従来の ML サーフェスも使用する場合は、vertexai.init() を保持します。

    # pip install google-cloud-aiplatform
    
    import vertexai
    from vertexai.generative_models import GenerativeModel
    
    vertexai.init(project="my-project", location="us-central1")
    
    # Model identity and config are bound at construction time.
    model = GenerativeModel("gemini-2.5-flash")
    

    移行後

    # pip install google-genai
    
    from google import genai
    from google.genai import types
    
    client = genai.Client(
        enterprise=True,
        project="my-project",
        location="global",
    )
    

    または、環境から構成します。

    export GOOGLE_GENAI_USE_ENTERPRISE=true
    export GOOGLE_CLOUD_PROJECT=my-project
    export GOOGLE_CLOUD_LOCATION=global
    
    from google import genai
    
    client = genai.Client()
    

    重要な考慮事項:

    • グローバル状態が明示的なクライアントになります。vertexai.init() はプロセス全体を構成し、genai.Client() は渡すオブジェクトです。genai.Client() を使用すると、1 つのプロセスで 2 つのプロジェクトまたはリージョンを使用できます。
    • enterprise=True は必須です。省略すると、クライアントは Gemini Developer API を暗黙的にターゲットにします。この API は、アプリケーションのデフォルト認証情報で失敗するか、API キーを要求します。
    • モデル名は、構築からすべてのコールに移行します。バインド 1 回モデル オブジェクトはありません。model= は、各 client.models.* 呼び出しで必須のキーワード引数です。
    • 認証は変更されていません。アプリケーションのデフォルト認証情報は引き続き適用され、credentials= は両方の SDK で google.auth.credentials.Credentials を受け入れます。
    • vertexai.init() には、staging_bucketexperimentencryption_spec_key_nameservice_accountnetwork などの非生成設定も含まれていました。genai.Client に相当するものは存在しません。
    • 新しい enterprise=True のスペルは google-genai 2.20.0 以降で受け入れられますが、古いバージョンの vertexai=True はすべてのリリースで動作し、より安全な選択肢です。
  4. エラーが発生せずに動作が異なるサイレント変更がないか、コードを監査します。これらはコンパイルして実行できますが、意味が変わります。

    動作
    ブロックされたレスポンスまたは空のレスポンスに対する response.text ValueError を発生させる None を返します。
    response.text 人の候補者がいる ValueError を発生させる 警告をログに記録し、最初の候補を返す
    クライアント ターゲティング vertexai.init() 暗黙的な Agent Platform vertexai=True を省略すると、Gemini Developer API が暗黙的にターゲットになります
    エンベディング auto_truncate デフォルトは True です 設定解除。サーバーのデフォルトが適用されます
    ツールとして渡される Python 関数 非対応 SDK によって自動的に実行される
    system_instruction モデルで 1 回バインド すべての呼び出しで渡す必要があります

    最初に検索するのは response.text の変更です。.text をラップするすべての try/except ValueError がデッドコードになり、保護されていないすべての .text が、以前は str が返されていた場所で None を生成できるようになりました。

    if response.text is None:
        print(
            "blocked or empty:",
            response.prompt_feedback,
            response.candidates[0].finish_reason if response.candidates else None,
        )
    
  5. 評価、Agent Runtime、プロンプト、データセット、スキル、従来の ML サーフェス全体を使用する場合は、google-cloud-aiplatform をインストールしたままにします。

  6. 新しいバージョンに呼び出しを変更します。まず機械的な名前変更を行い、次に config= の統合を行います。

タスクベースの通話の変更

タスクに基づいて変更された呼び出しを確認します。

テキスト生成

テキスト生成タスクの場合、すべての引数はキーワード専用です。位置呼び出しは TypeError を発生させます。

model = GenerativeModel("gemini-2.5-flash")

response = model.generate_content("Why is the sky blue?")
print(response.text)

移行後

response = client.models.generate_content(
    model="gemini-3.5-flash",
    contents="Why is the sky blue?",
)
print(response.text)

ストリーミング生成

ストリーミング生成タスクの場合、stream=True フラグは削除されます。ストリーミングは、Iterator[types.GenerateContentResponse] を返す別のメソッドになりました。各チャンクは完全なレスポンス オブジェクトであり、その .text 属性が None になることがあるため、テキストにアクセスする前に if chunk.text: を使用して確認します。

stream = model.generate_content("Tell me a story in 300 words.", stream=True)
for chunk in stream:
    print(chunk.text, end="")

移行後

for chunk in client.models.generate_content_stream(
    model="gemini-3.5-flash",
    contents="Tell me a story in 300 words.",
):
    if chunk.text:
        print(chunk.text, end="")

非同期生成

非同期生成タスクの場合、_async メソッド名の接尾辞が削除されました。すべての非同期呼び出しは client.aio.<module> の下にあり、同期呼び出しと同じメソッド名が付けられています。await client.aio.aclose() でクライアントを閉じるか、async with genai.Client(...).aio as aclient: を使用します。

response = await model.generate_content_async("Why is the sky blue?")

async_stream = await model.generate_content_async("Why is the sky blue?", stream=True)
async for chunk in async_stream:
    print(chunk.text, end="")

移行後

response = await client.aio.models.generate_content(
    model="gemini-3.5-flash",
    contents="Why is the sky blue?",
)

# Note the `await` in front of the async iterator.
async for chunk in await client.aio.models.generate_content_stream(
    model="gemini-3.5-flash",
    contents="Tell me a story in 300 words.",
):
    print(chunk.text, end="")

チャット セッション

チャット セッション タスクの変更点は次のとおりです。

  • チャットはモデル オブジェクトからではなく、クライアントから作成されます。
  • chat.history(プロパティ)が chat.get_history()(メソッド)になります。新しいメソッドは curated: bool = False を受け取ります。True を渡すと、保持されたターンのみが返されます。これに相当する古いものはありません。
  • client.aio.chats.create(...)AsyncChat を直接返します。send_messagesend_message_stream のみが待機されます。
  • ターンごとのオプションは 1 つの引数 send_message(message, config=types.GenerateContentConfig(...)) にまとめられます。最初のパラメータの名前も content から message に変更されました。
  • start_chat(response_validation=False) は、以前のバージョンに相当するものがない新しいメソッドです。

model = GenerativeModel("gemini-2.5-flash")
chat = model.start_chat()

print(chat.send_message("Tell me a story").text)

for content in chat.history:
    print(content.role, content.parts)

移行後

chat = client.chats.create(model="gemini-3.5-flash")

print(chat.send_message("Tell me a story").text)

for content in chat.get_history():
    print(content.role, content.parts)

構成、安全に関する設定、システム指示

構成、安全性設定、システム指示タスクの次の変更点に注意してください。

  • 次の引数は、GenerateContentConfig のフィールドとして 1 つの config= に折りたたまれます。

    • generation_config
    • safety_settings
    • tools
    • tool_config
    • labels
    • system_instruction

    プレーン dict は、構成タイプが機能する場所であればどこでも機能します。

  • system_instruction がモデル コンストラクタから呼び出しごとの構成に移動します。以前の SDK バージョンでは、GenerativeModel のビルド時に system_instruction が一度設定されていました。system_instruction は、すべての呼び出しで渡すか、client.chats.create(config=...) に含める必要があります。

  • 安全に関する設定が dict から list に変更されます。例: [types.SafetySetting(category=c, threshold=t) for c, t in old_dict.items()]

  • 列挙型はプレーン文字列として受け入れられ、強制変換されます。

  • スカラー フィールド名は変更されません(temperaturetop_ptop_kcandidate_countmax_output_tokensstop_sequencespresence_penaltyfrequency_penaltyseedresponse_mime_typeresponse_schemaresponse_logprobslogprobs)。

  • thinking_configcached_contentautomatic_function_callinghttp_optionsmedia_resolutionspeech_config など、以前の同等のフィールドがない新しいフィールドがあります。

from vertexai.generative_models import (
    GenerativeModel, GenerationConfig, HarmCategory, HarmBlockThreshold,
)

model = GenerativeModel(
    "gemini-2.5-flash",
    system_instruction=["Talk like a pirate.", "Don't use rude words."],
)

response = model.generate_content(
    contents="Why is the sky blue?",
    generation_config=GenerationConfig(temperature=0, top_p=0.95, max_output_tokens=100),
    safety_settings={
        HarmCategory.HARM_CATEGORY_HATE_SPEECH: HarmBlockThreshold.BLOCK_MEDIUM_AND_ABOVE,
        HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT: HarmBlockThreshold.BLOCK_ONLY_HIGH,
    },
)

移行後

from google.genai import types

response = client.models.generate_content(
    model="gemini-3.5-flash",
    contents="Why is the sky blue?",
    config=types.GenerateContentConfig(
      system_instruction="Talk like a pirate. Don't use rude words.",
      temperature=0,
      top_p=0.95,
      max_output_tokens=100,
      safety_settings=[
          types.SafetySetting(
              category="HARM_CATEGORY_HATE_SPEECH",
              threshold="BLOCK_MEDIUM_AND_ABOVE",
          ),
          types.SafetySetting(
              category=types.HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT,
              threshold=types.HarmBlockThreshold.BLOCK_ONLY_HIGH,
          ),
      ],
    ),
)

マルチモーダル入力

マルチモーダル入力タスクの次の変更点に注意してください。

新規
Part.from_uri(uri, mime_type)、位置指定が許可されている Part.from_uri(file_uri=, mime_type=)、キーワード専用、パラメータの名前変更
Part.from_data(data, mime_type) Part.from_bytes(data=, mime_type=)、メソッドの名前を変更
Part.from_text(text) Part.from_text(text=)、キーワードのみ
Image.load_from_file(path) 同等のものはありません。ファイルを開いて Part.from_bytes を使用してください
  • mime_typetypes.Part.from_uri()(サーバーサイドで推測)では省略可能ですが、types.Part.from_bytes() では必須のままです。
  • client.files.upload(...) は Gemini Developer API でのみサポートされています。Agent Platform ワークロードの場合は、引き続き from_uri を使用して Cloud Storage URI を渡すか、from_bytes を使用してインライン バイトを渡します。

from vertexai.generative_models import GenerativeModel, Part, Image

image = Image.load_from_file("image.jpg")
print(model.generate_content(["What is shown in this image?", image]).text)

image_part = Part.from_uri(
    "gs://cloud-samples-data/generative-ai/image/scones.jpg",
    mime_type="image/jpeg",
)

移行後

from google.genai import types

# Image.load_from_file has no equivalent: read the bytes yourself.
with open("image.jpg", "rb") as f:
    image = types.Part.from_bytes(data=f.read(), mime_type="image/jpeg")

response = client.models.generate_content(
    model="gemini-3.5-flash",
    contents=["What is shown in this image?", image],
)

image_part = types.Part.from_uri(
    file_uri="gs://cloud-samples-data/generative-ai/image/scones.jpg",
    mime_type="image/jpeg",
)

関数呼び出しとグラウンディング

関数呼び出しとグラウンディング タスクについては、次の変更点に注意してください。

  • ツールが config= に移動します。呼び出しまたはモデル オブジェクトに tools= 引数がありません。
  • Tool.from_google_search_retrieval(grounding.GoogleSearchRetrieval())types.Tool(google_search=types.GoogleSearch()) になります。ファクトリ メソッドはプレーン フィールドになります。types.Tool には、別の google_search_retrieval フィールドもあります。
  • response.function_calls は慣用的なアクセサであり、パート ゼロがテキストの場合でも失敗しません。古いトラバーサルは引き続き機能します。
  • 未加工の JSON スキーマは parameters_json_schema で指定されます。型付き types.Schemaparameters で指定されます。
  • Python 関数をツールとして渡せるようになりました。関数を渡す場合、自動関数呼び出しはデフォルトでオンになっています。手動ツールループを移植して関数オブジェクトを渡すと、SDK はコードの実行を開始します。automatic_function_calling=types.AutomaticFunctionCallingConfig(disable=True) を使用して、デフォルトの自動関数呼び出しを無効にします。
  • 次の新しいツールタイプは、以前のバージョンには相当するものがありません。code_executionurl_contextgoogle_mapscomputer_usefile_searchenterprise_web_searchmcp_servers

from vertexai.generative_models import GenerativeModel, FunctionDeclaration, Tool, grounding

weather_tool = Tool(function_declarations=[
    FunctionDeclaration(
        name="get_current_weather",
        description="Get the current weather in a given location",
        parameters={
            "type": "object",
            "properties": {"location": {"type": "string"}},
            "required": ["location"],
        },
    )
])

model = GenerativeModel("gemini-2.5-flash", tools=[weather_tool])
response = model.generate_content("What is the weather in Boston?")
call = response.candidates[0].content.parts[0].function_call

# Grounding
search_tool = Tool.from_google_search_retrieval(grounding.GoogleSearchRetrieval())

移行後

from google.genai import types

weather_tool = types.Tool(function_declarations=[
    types.FunctionDeclaration(
        name="get_current_weather",
        description="Get the current weather in a given location",
        parameters_json_schema={
            "type": "object",
            "properties": {"location": {"type": "string"}},
            "required": ["location"],
        },
    )
])

response = client.models.generate_content(
    model="gemini-3.5-flash",
    contents="What is the weather in Boston?",
    config=types.GenerateContentConfig(tools=[weather_tool]),
)
call = response.function_calls[0]

# Grounding
search_tool = types.Tool(google_search=types.GoogleSearch())

エンベディング

エンベディング タスクの変更点は次のとおりです。

  • TextEmbeddingInput を削除しました。task_typetitle はリクエストごとに設定されるようになったため、混合タスク バッチは複数の呼び出しに分割する必要があります。
  • 戻り値の型が直接リストからレスポンス オブジェクトに変更されました。get_embeddings()list[TextEmbedding] を直接返していたため、呼び出し元はリストを直接インデックス登録していました(embeddings[0].values)。新しいバージョンでは、embed_content().embeddings リストを含む EmbedContentResponse オブジェクトを返すため、response.embeddings[0].values にアクセスする必要があります。個々のエンベディング フィールド(.values.statistics)は元の名前を保持します。
  • auto_truncate のデフォルトは True ではなくなりました。新しいフィールドのデフォルトは unset です。長すぎる入力のサイレント切り捨てに依存している場合は、auto_truncate を明示的に設定します。

from vertexai.language_models import TextEmbeddingModel, TextEmbeddingInput

model = TextEmbeddingModel.from_pretrained("gemini-embedding-001")

text_input = TextEmbeddingInput(
    text="How do I get a driver's license?",
    task_type="RETRIEVAL_DOCUMENT",   # per input
    title="Driver's License",         # per input
)

embeddings = model.get_embeddings([text_input], output_dimensionality=3072, auto_truncate=True)
print(embeddings[0].values)

移行後

from google.genai import types

response = client.models.embed_content(
    model="gemini-embedding-2",
    contents="How do I get a driver's license?",
    config=types.EmbedContentConfig(
        task_type="RETRIEVAL_DOCUMENT",   # now per request
        title="Driver's License",         # now per request
        output_dimensionality=3072,
        auto_truncate=True,
    ),
)
print(response.embeddings[0].values)

トークンのカウント

トークン数のカウントタスクについては、次の変更点に注意してください。

  • total_billable_characters が削除され、置き換えはありません。total_billable_characters をキーとする費用見積もりは、生成呼び出しから再作成する必要があります(たとえば、total_tokens または response.usage_metadata に対して)。
  • トークン ID と文字列の断片に client.models.compute_tokens(...) が追加されました。
  • オフライン カウントは google.genai.local_tokenizer.LocalTokenizer を通じて追加されました。

model = GenerativeModel("gemini-2.5-flash")

response = model.count_tokens(["Why is the sky blue?"])
print(response.total_tokens)
print(response.total_billable_characters)

移行後

response = client.models.count_tokens(
    model="gemini-3.5-flash",
    contents=["Why is the sky blue?"],
)
print(response.total_tokens)
print(response.cached_content_token_count)

コンテキストのキャッシュ保存

コンテキスト キャッシュ保存タスクの変更点は次のとおりです。

  • ttl の型が datetime.timedelta から期間文字列("86400s" など)に変更されます。
  • リソース オブジェクトのメソッドはクライアント モジュールの呼び出しになります。
  • update は、インプレースで変更するのではなく、新しいオブジェクトを返します。

import datetime
from vertexai.caching import CachedContent

cache = CachedContent.create(
    model_name="gemini-2.5-flash",
    system_instruction="Please answer my question formally",
    contents=contents,
    ttl=datetime.timedelta(days=1),
)
cache.update(ttl=datetime.timedelta(days=2))
cache.delete()

移行後

from google.genai import types

cache = client.caches.create(
    model="gemini-3.5-flash",
    config=types.CreateCachedContentConfig(
        contents=contents,
        system_instruction="Please answer my question formally",
        ttl="86400s",
    ),
)
cache = client.caches.update(
    name=cache.name, config=types.UpdateCachedContentConfig(ttl="172800s")
)
client.caches.delete(name=cache.name)

バッチ予測とチューニング

バッチ予測タスクとチューニング タスクの次の変更点に注意してください。

  • ポーリングはインプレースではなく、再バインドベースです。job.refresh()job.has_ended もありません。client.batches.get(name=...) から新しいオブジェクトを取得し、job.stateJOB_STATE_* 文字列と比較します。
  • 一括変更: source_modelmodel に、input_datasetsrc に、output_uri_prefixconfig.dest に、job_display_nameconfig.display_name に変更。
  • バッチ マシンシェイプの制御が削除され、新しい SDK バージョンには同等のものがありません。machine_typeaccelerator_typeaccelerator_countstarting_replica_countmax_replica_countCreateBatchJobConfig のフィールドではなくなりました。
  • 次のメソッドの名前が変更されました。
    • sft.train から client.tunings.tune
    • source_modelbase_model に設定
    • train_datasettraining_dataset に設定
    • epochs から epoch_count
  • チューニング用データセットがラップされます。裸の "gs://..." 文字列は types.TuningDataset(gcs_uri=...) になります。
  • adapter_size の型が int から "ADAPTER_SIZE_FOUR" などの列挙型文字列に変更されました。

from vertexai.batch_prediction import BatchPredictionJob
from vertexai.tuning import sft

job = BatchPredictionJob.submit(
    source_model="gemini-2.5-flash",
    input_dataset="bq://my-project.my-dataset.my-table",
    output_uri_prefix="bq://my-project.my-dataset.output",
)
while not job.has_ended:
    job.refresh()

tuning_job = sft.train(
    source_model="gemini-2.5-flash",
    train_dataset="gs://bucket/train.jsonl",
    epochs=1,
    adapter_size=4,
)

移行後

from google.genai import types

job = client.batches.create(
    model="gemini-3.5-flash",
    src="bq://my-project.my-dataset.my-table",
    config=types.CreateBatchJobConfig(dest="bq://my-project.my-dataset.output"),
)
completed = {"JOB_STATE_SUCCEEDED", "JOB_STATE_FAILED", "JOB_STATE_CANCELLED", "JOB_STATE_PAUSED"}
while job.state not in completed:
    job = client.batches.get(name=job.name)

tuning_job = client.tunings.tune(
    base_model="gemini-3.5-flash",
    training_dataset=types.TuningDataset(gcs_uri="gs://bucket/train.jsonl"),
    config=types.CreateTuningJobConfig(
        epoch_count=1,
        adapter_size="ADAPTER_SIZE_FOUR",
    ),
)

Agent Platform SDK の再構築

google-cloud-aiplatformagentplatform モジュールを使用している場合は、次の推奨事項に沿って新しい SDK 構造に移行してください。

  1. google-cloud-agentplatform はスタンドアロンの軽量ディストリビューションとなり、エージェント ワークロードに推奨されるインストールになりました。以前の ML サーフェスが不要な場合は、インストールを pip install google-cloud-aiplatform から pip install google-cloud-agentplatform に切り替えます。

  2. 次の表を使用して、インポートと属性パスを更新します。

    前へ 新規
    client.agent_engines.create client.runtimes.create(Gemini Enterprise Agent Platform インスタンスに Agent Runtime をデプロイします。これにより、組み込みのセッション、サンドボックス コード実行、コンテキスト メモリ構成が提供されます)
    client.memory_banks.create(インタラクション全体でメモリを永続化、管理、取得するためのスタンドアロンのメモリバンク リソースを作成します)
    client.agent_engines.sandboxes client.sandboxes
    client.agent_engines.sandboxes.snapshots client.sandboxes.snapshots
    client.agent_engines.sandboxes.templates client.sandboxes.templates
    client.agent_engines.sessions client.sessions
    client.agent_engines.sessions.events client.sessions.events
    client.agent_engines.runtimes.revisions client.runtimes.revisions
    client.agent_engines.memories client.memory_banks.memories
    agentplatform.agent_engines.templates agentplatform.frameworks
  3. グローバル イニシャライザが削除され、エージェント フレームワークは aiplatform.init() または vertexai.init() 状態からプロジェクトとロケーションを読み取らなくなりました。エージェント フレームワーク内で実行されるすべてのものについて、イニシャライザから派生した構成を環境変数に置き換えます。デプロイされたエージェントの構成に初期化子を使用するコードは、エラーを発生させるのではなく、サイレントに中断します。

  4. SDK が types.AgentEngine を受け付けなくなったため、evals.run_inference(agent=...) 呼び出しサイトを更新して types.Runtime を渡します。

  5. 次のように変更します。

    • vertexai.Client から agentplatform.Client
    • vertexai.rag から agentplatform.Client().rag

    vertexai.Client は、最初のインスタンス化で FutureWarning を出力します。

    The vertexai.Client class is deprecated. Please use agentplatform.Client instead.
    

    vertexai.rag は、呼び出し時ではなく、モジュールのインポート時に UserWarning を出力します。以下に移行します。

    import agentplatform
    
    client = agentplatform.Client(project="your-project", location="global")
    client.rag.create_corpus(...)
    
  6. AdkApp とセッション呼び出しに関するエラー処理を更新しました。同期セッション メソッドとストリーミング エージェント実行で、基盤となる API エラーが表示されるようになりました。一般的なラップされたエラーをキャッチする呼び出し元は一致しなくなりました。汎用ライブラリ ラッパー例外のキャッチを google.api_core.exceptions.GoogleAPICallError(または ResourceExhaustedNotFound などの特定のステータス エラー)に置き換えます。

  7. トークンはエフェメラルになり、セッション状態に保持されなくなったため、クライアントの呼び出し元またはミドルウェアを更新して、各リクエストにユーザーの OAuth アクセス トークンを含めるようにします。トークンの更新がクライアント サイドで管理されていることを確認します。

  8. a2a.tasks モジュールは置き換えなしで削除されました。