From b67182c50f170d80dc343c8fe02b9b6f18fc445f Mon Sep 17 00:00:00 2001 From: "Wei Sun (Jack)" Date: Wed, 14 May 2025 07:36:15 -0700 Subject: [PATCH] chore: Adds docstring for LlmAgent.disallow_transfer_to_parent to clarify the expected behavior. PiperOrigin-RevId: 758676926 --- src/google/adk/agents/llm_agent.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/google/adk/agents/llm_agent.py b/src/google/adk/agents/llm_agent.py index 302b1bc..e6b782a 100644 --- a/src/google/adk/agents/llm_agent.py +++ b/src/google/adk/agents/llm_agent.py @@ -16,15 +16,13 @@ from __future__ import annotations import inspect import logging -from typing import ( - Any, - AsyncGenerator, - Awaitable, - Callable, - Literal, - Optional, - Union, -) +from typing import Any +from typing import AsyncGenerator +from typing import Awaitable +from typing import Callable +from typing import Literal +from typing import Optional +from typing import Union from google.genai import types from pydantic import BaseModel @@ -152,7 +150,12 @@ class LlmAgent(BaseAgent): # LLM-based agent transfer configs - Start disallow_transfer_to_parent: bool = False - """Disallows LLM-controlled transferring to the parent agent.""" + """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 + stuck with one agent that cannot transfer to other agents in the agent tree. + """ disallow_transfer_to_peers: bool = False """Disallows LLM-controlled transferring to the peer agents.""" # LLM-based agent transfer configs - End