From 46282eeb0de6d42dcbb5c52b62aaab6997103c8b Mon Sep 17 00:00:00 2001 From: "Wei Sun (Jack)" Date: Tue, 27 May 2025 23:40:58 -0700 Subject: [PATCH] chore: Don't add prompt about parent agent when `disallow_transfer_to_parent=True` Fixes https://github.com/google/adk-python/issues/844 PiperOrigin-RevId: 764116180 --- src/google/adk/flows/llm_flows/agent_transfer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/google/adk/flows/llm_flows/agent_transfer.py b/src/google/adk/flows/llm_flows/agent_transfer.py index e795c78..8612870 100644 --- a/src/google/adk/flows/llm_flows/agent_transfer.py +++ b/src/google/adk/flows/llm_flows/agent_transfer.py @@ -98,11 +98,11 @@ question to that agent. When transferring, do not generate any text other than the function call. """ - if agent.parent_agent: + if agent.parent_agent and not agent.disallow_transfer_to_parent: si += f""" Your parent agent is {agent.parent_agent.name}. If neither the other agents nor you are best for answering the question according to the descriptions, transfer -to your parent agent. If you don't have parent agent, try answer by yourself. +to your parent agent. """ return si