refactor: rename parameter name and add type annotation of _get_agent_to_run method

PiperOrigin-RevId: 763234780
This commit is contained in:
Xiang (Sean) Zhou 2025-05-25 18:55:41 -07:00 committed by Copybara-Service
parent b0fb3536e5
commit 98c8a71d67

View File

@ -472,14 +472,12 @@ class BaseLlmFlow(ABC):
yield event
def _get_agent_to_run(
self, invocation_context: InvocationContext, transfer_to_agent
self, invocation_context: InvocationContext, agent_name: str
) -> BaseAgent:
root_agent = invocation_context.agent.root_agent
agent_to_run = root_agent.find_agent(transfer_to_agent)
agent_to_run = root_agent.find_agent(agent_name)
if not agent_to_run:
raise ValueError(
f'Agent {transfer_to_agent} not found in the agent tree.'
)
raise ValueError(f'Agent {agent_name} not found in the agent tree.')
return agent_to_run
async def _call_llm_async(