Open6

Goolge AgentspaceでAgent Engineにデプロイしたエージェントを呼び出す

danishidanishi

Agentspaceを構築し画面からIDを取得。
Agent EngineはコンソールのURLからIDが拾える。

danishidanishi

Cloud Shellからコマンドを実行。

PROJECT_ID=<project_id>
PROJECT_NO=<project_no>
TOKEN=$(gcloud auth print-access-token)
AGENTSPACE_ID=<agentspace_id>
AGENTSPACE_LOCATION=global
AGENT_ENGINE_ID=<agent_engine_id>
AGENT_ENGINE_LOCATION=us-central1

curl -X POST \
  "https://discoveryengine.googleapis.com/v1alpha/projects/$PROJECT_ID/locations/$AGENTSPACE_LOCATION/collections/default_collection/engines/$AGENTSPACE_ID/assistants/default_assistant/agents" \
  -H "Authorization: Bearer $TOKEN" \
  -H "x-goog-user-project: $PROJECT_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "displayName": "ブログ作成エージェント",
    "description": "ブログを書きたいときに支援してくれる",
    "adkAgentDefinition": {
        "tool_settings": {
            "tool_description": "ブログ作成"
        },
        "provisionedReasoningEngine": {
          "reasoningEngine": "projects/$PROJECT_NO/locations/$AGENT_ENGINE_LOCATION/reasoningEngines/$AGENT_ENGINE_ID"
        }
    }
  }'

danishidanishi

Mediumの記事にはこの後サービスアカウントに権限付与が必要とあったが特に実施しなくても動いた。

動きはしたが、どうも挙動が不安定。
前の会話の内容が渡されていないような動きをしている。

danishidanishi

更新、削除とかの手順は今のところ不明。