diff --git a/core/src/main/java/com/google/adk/flows/llmflows/AgentTransfer.java b/core/src/main/java/com/google/adk/flows/llmflows/AgentTransfer.java index 5b302d75..2ba9dd26 100644 --- a/core/src/main/java/com/google/adk/flows/llmflows/AgentTransfer.java +++ b/core/src/main/java/com/google/adk/flows/llmflows/AgentTransfer.java @@ -87,7 +87,7 @@ private String buildTargetAgentsInstructions(LlmAgent agent, List tra "If another agent is better for answering the question according to its description, call" + " `transferToAgent` function to transfer the question to that agent. When" + " transferring, do not generate any text other than the function call.\n"); - if (agent.parentAgent() != null) { + if (agent.parentAgent() != null && !agent.disallowTransferToParent()) { sb.append("Your parent agent is "); sb.append(agent.parentAgent().name()); sb.append(