From 48ddd078941f9240b10f052b6de171c310bc2bc6 Mon Sep 17 00:00:00 2001 From: Liang Wu Date: Mon, 27 Oct 2025 10:00:37 -0700 Subject: [PATCH] chore:clarify the behavior of disallow_transfer_to_parent The original description is not clear enough and can create confusion like https://github.com/google/adk-python/issues/3081. PiperOrigin-RevId: 824564227 --- src/google/adk/agents/llm_agent.py | 5 +++-- src/google/adk/flows/llm_flows/auto_flow.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/google/adk/agents/llm_agent.py b/src/google/adk/agents/llm_agent.py index c1435682..2fa3ef56 100644 --- a/src/google/adk/agents/llm_agent.py +++ b/src/google/adk/agents/llm_agent.py @@ -267,8 +267,9 @@ class LlmAgent(BaseAgent): disallow_transfer_to_parent: bool = False """Disallows LLM-controlled transferring to the parent agent. - NOTE: Setting this as True also prevents this agent to continue reply to the - end-user. This behavior prevents one-way transfer, in which end-user may be + NOTE: Setting this as True also prevents this agent from continuing to reply + to the end-user, and will transfer control back to the parent agent in the + next turn. This behavior prevents one-way transfer, in which end-user may be stuck with one agent that cannot transfer to other agents in the agent tree. """ disallow_transfer_to_peers: bool = False diff --git a/src/google/adk/flows/llm_flows/auto_flow.py b/src/google/adk/flows/llm_flows/auto_flow.py index 32272c9d..7d6eac80 100644 --- a/src/google/adk/flows/llm_flows/auto_flow.py +++ b/src/google/adk/flows/llm_flows/auto_flow.py @@ -32,7 +32,7 @@ class AutoFlow(SingleFlow): For peer-agent transfers, it's only enabled when all below conditions are met: - The parent agent is also an LlmAgent. - - `disallow_transfer_to_peer` option of this agent is False (default). + - `disallow_transfer_to_peers` option of this agent is False (default). Depending on the target agent type, the transfer may be automatically reversed. (see Runner._find_agent_to_run method for which agent will remain