はじめに
七尾百合子さん、お誕生日 39日目 おめでとうございます!1 nikkieです。
GoogleのAgent Development Kitを素振りしていきます!
目次
動画「Getting started with Agent Development Kit」
Cloud Next ‘25で Agent Development Kit (ADK) が発表されました。
YouTube Shorts エージェントを作る動画を見つけました
サンプルコードはこちら
3つのサブエージェント
動かした様子です(adk web)
「write me a script on how to build AI agents」

# .env # GOOGLE_API_KEY は1Password管理のものを渡しています GOOGLE_GENAI_USE_VERTEXAI=FALSE
ディレクトリ構造はこちらを元にしています。
https://google.github.io/adk-docs/get-started/quickstart/#run-your-agent
root_agent (youtube_shorts_agent) に3つのサブエージェントを渡す実装です。
root_agent = LlmAgent(
name="youtube_shorts_agent",
# 省略
sub_agents=[scriptwriter_agent, visualizer_agent, formatter_agent],
)
これらはtransfer_to_agentされます。
親のエージェントはタスクを見て子のエージェントに振り分け(その旨の返答がありますね)、子のエージェントがタスクに答えて終了です2。
「write me a script on how to build AI agents」に対してサブエージェントはscriptwriter_agentしか出番がありません。
ADKドキュメントの「2.3. Interaction & Communication Mechanisms」(Multi-Agent Systems in ADK)より
b) LLM-Driven Delegation (Agent Transfer)
Mechanism: The agent's LLM generates a specific function call: transfer_to_agent(agent_name='target_agent_name').
Web UIにあったtransfer_to_agentですね
Handling: The AutoFlow, used by default when sub-agents are present or transfer isn't disallowed, intercepts this call.
親のエージェントがfunction callingして子のエージェントにtransferし、親のエージェントはそこで終わり(子のエージェントにお任せ)です。
transferだと、親が子のエージェントの出力のレビューといったことはできないという理解です。
google_search toolが動かない!
サブエージェントのscriptwriter_agentについて
scriptwriter_agent = LlmAgent(
name="ShortsScriptwriter",
# 省略
tools=[google_search],
)
YouTube動画では動いているように見えるのですが、手元で動きませんでした。
google.genai.errors.ClientError: 400 INVALID_ARGUMENT. {'error': {'code': 400, 'message': 'Tool use with function calling is unsupported', 'status': 'INVALID_ARGUMENT'}}
ADKでは現在、サブエージェントでBuilt-in toolのGoogle Search3を実行できないようです
https://github.com/google/adk-python/issues/134#issuecomment-2801710804 より4
However, once inside that function-called context, the sub-agent is no longer allowed to invoke any tools, such as google_search.
AgentToolというWorkaroundはありますが、
https://github.com/google/adk-python/issues/53#issuecomment-2798906767
上のドキュメントの「c) Explicit Invocation (AgentTool)」の話になるので、今回は記事のスコープを狭めるためにコメントアウトしました。
Web検索できないのは痛いですが、サブエージェントへのtransferは体験できました。
終わりに
ADKにはAgentの階層構造があり(sub_agents引数)、親のエージェントは子のエージェントにtransferします。
これはfunction callingで実現されていると知りました。
親のエージェントはtransferした時点でお役御免です。
動画はさらに続いており、Workflow agentsを使って3体のサブエージェントを順番に動かします。
別途記事にしようかと思います
-
櫻木真乃さん、お誕生日おめでとうございます!! かわいい... かわいい...
↩【櫻木 真乃さんの誕生日♪】
— アイドルマスター シャイニーカラーズ公式 (@imassc_official) 2025年4月24日
4月25日は「イルミネーションスターズ」のメンバー「櫻木 真乃」さんの誕生日です!
「誕生日ミニコミュ」や「限定入り HAPPY BIRTHDAY 真乃スタンプガシャ」の開催のほか、「フェザージュエル×300」をプレゼント♪https://t.co/cSzxKOkmRs
ぜひハッシュタグ… pic.twitter.com/ZAIML5sYYX - 親子のhierarchyがあります。ref: https://google.github.io/adk-docs/agents/multi-agents/#21-agent-hierarchy-parent_agent-sub_agents↩
- https://google.github.io/adk-docs/tools/built-in-tools/#google-search↩
- 「Built-in tools cannot be used within a sub-agent.」ref: https://google.github.io/adk-docs/tools/built-in-tools/#limitations↩