はじめに
2024年4月に,ラスベガスで行なわれたGoogle Cloud Next '24にて,Vertex AI Agent Builderが発表されました.今回はお試しにそれを触ってみようと思います.
Agent Builderとは
Agent Builderとは,生成AIを活用したAgent開発を簡単に行なうことができる,サーバーレスなフルマネージドサービスです.
料金
Vertex AI エージェントはクエリ1000件あたり$12となっています.
お題
今回はドキュメントに書かれていた「対話型 AI エージェントを構築する」を行ないます.ノーコードでAgentを作成することができます.
題材として,野球に関する質問が来たら,野球の専門家問い合わせをして回答するAppを作成します.
「新しいアプリ」 → 「Agent」
Agentの作成
以下2つのAgentを作成し,それぞれにGoalとInstructionsを付与します.
- 質問受け付けAgent(Reception)
- 野球専門家Agent(baseball expert)
Reception
Goal
Your goal is to collect the user's request and route the user to the correct expert among the various experts.
Instructions
- Greet the user and tell them that you can help answer question s related baseball.
- DO NOT attempt to answer the user's question ever.
- ALWAYS transfer them directly to another topic.
- There is a topic you can choose from:
- For questions related to maths transfert to ${AGENT: baseball expert}
baseball expert
Goal
Your goal is to help users find answers related to baseball. DO NOT answer question of topics other than baseball.
Instructions
- Step 1. Ask the user to share the question.
- Step 2. Once the user shares the question, answer the question based on your knowledge.
Exampleの作成
Reception内に想定されるやり取りを追加
「Enter user input」で想定するユーザーの入力を行ない,適宜「Add action」を使って編集していきます.
今回は「Agent invocation」を選択し,baseball expertをお呼びします.
実際に問い合わせる
それでは,想定通りの質問をして野球の専門家が回答してくれるか確認します.
まずは,「野球に関して質問がある」とReceptionに言うと,baseball expertをお招きいただきました.
いたずらで,「ダブルフォルトとはなんですか?」「ダブルドリブルとはなんですか?」と聞いたのですが,専門外のようなので答えてくれませんでした.「ダブルプレーとはなんですか?」としたところうまく回答してくれました.
所感
複雑な作業をすることなく,簡単にAgentを作ることができました.非常に簡単ではあるとは思いますが,やはり中の動きがわからなかったり,設定の再現性を担保するにはコードで作る方が良いのかなと感じたりしています.
まとめ
単純な例を使って,Agent Builderを触ってみました.今後は応用先も検討していきたいです.
おまけ: SlackからAgentとやりとりする
ドキュメント通りに,今回作成したAgentをSlackから呼び出す事もできました.