0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ADKで開発したAIエージェントをエージェントランタイムにデプロイする

0
Posted at

はじめに

前にAgentEngineにデプロイするスクリプトを書いたのですが、そちらで紹介した書き方は古くなっているようです。
今回は、新しい書き方を試してみます。

そもそも、Vertex AI という名前も「Agent Platform」という名前に刷新されたようです。
エージェントエンジンも「エージェントランタイム」という名称になっていました。

image.png

また、ADKもいつの間にか2.0系が出ていました。

今までのデプロイスクリプトでは、デプロイ後に正常な動作ができなかったので、スクリプトの書き方を見直したかったのがモチベーションです。

デプロイするコード

これがそのデプロイのコードです。
大きく変わった部分はありませんが、agent_engines.create()client.agent_engines.create()になったり、引数で指定していたものはconfigの中で指定することでインターフェース追加がいらなくなっていますね。

import logging

import vertexai
from vertexai import types
from vertexai.agent_engines import AdkApp

from stream_agent.agent import root_agent

logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)

PROJECT_ID = "hogehoge"
LOCATION = "asia-northeast1"
STAGING_BUCKET = "gs://fugafuga"

client = vertexai.Client(
    project=PROJECT_ID,
    location=LOCATION,
)

logger.info("deploying app...")

app = AdkApp(agent=root_agent)

remote_app = client.agent_engines.create(
    agent=app,
    config={
        "staging_bucket": STAGING_BUCKET,
        "agent_framework": "google-adk",
        "requirements": "requirements.txt",
        "extra_packages": [
            "./stream_agent",
        ]
    },
)

logger.info("deployed: %s", remote_app.api_resource.name)

おわりに

AgentEngineもADKも見ない間に新しいバージョンが出ていました。
特にADKはメジャーバージョンアップで書き方が新しくなったようなので、その辺も今度検証してみようと思います。
ここまでご覧いただきありがとうございました!

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?