Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/google/adk/flows/llm_flows/base_llm_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,15 @@ async def run_live(
# cancel the tasks that belongs to the closed connection.
send_task.cancel()
await llm_connection.close()
# transfer to the sub agent.
transfer_to_agent = event.actions.transfer_to_agent
if transfer_to_agent:
agent_to_run = self._get_agent_to_run(
invocation_context, transfer_to_agent
)
async with Aclosing(agent_to_run.run_live(invocation_context)) as agen:
async for item in agen:
yield item
if (
event.content
and event.content.parts
Expand Down Expand Up @@ -547,15 +556,6 @@ async def _postprocess_live(
)
yield final_event

transfer_to_agent = function_response_event.actions.transfer_to_agent
if transfer_to_agent:
agent_to_run = self._get_agent_to_run(
invocation_context, transfer_to_agent
)
async with Aclosing(agent_to_run.run_live(invocation_context)) as agen:
async for item in agen:
yield item

async def _postprocess_run_processors_async(
self, invocation_context: InvocationContext, llm_response: LlmResponse
) -> AsyncGenerator[Event, None]:
Expand Down