Slide 13
Slide 13 text
© Commune Inc. All rights reserved 13
Google-ADK を⽤いて実装
● google-adk でエージェントを定義して、
Google Cloud Agent Engine にデプロイする
⽅式
● サービスアカウント設定で権限を絞る
エージェント定義
# Agent definition
root_agent = Agent(
model=MODEL_NAME,
name=AGENT_NAME,
instruction=build_root_instruction,
tools=[
bq_toolset,
],
)
app = build_adk_app()
# Check if the agent is already deployed
deployed_agent_resource =
find_deployed_agent_resource()
if deployed_agent_resource:
LOGGER.info(f"Agent already deployed:
{deployed_agent_resource}")
LOGGER.info("Update the agent.")
# Update the existing agent
agent_engines.update(
resource_name=deployed_agent_resource,
agent_engine=app,
display_name=DISPLAY_NAME,
extra_packages=extra_packages,
service_account=SERVICE_ACCOUNT,
requirements=requirements,
env_vars={"CUSTOM_AUDIENCE":
CUSTOM_AUDIENCE},
)
LOGGER.info("Agent updated successfully.")
else:
LOGGER.info("Deploying a new agent.")
(省略)
デプロイ