mirror of
https://github.com/encounter/adk-python.git
synced 2026-07-09 18:19:28 -07:00
chore: Simplfiy the parallel agent py version handling logic
PiperOrigin-RevId: 811992425
This commit is contained in:
committed by
Copybara-Service
parent
c984b9e552
commit
7b707cebea
@@ -188,18 +188,17 @@ class ParallelAgent(BaseAgent):
|
||||
pause_invocation = False
|
||||
try:
|
||||
# TODO remove if once Python <3.11 is no longer supported.
|
||||
if sys.version_info >= (3, 11):
|
||||
async with Aclosing(_merge_agent_run(agent_runs)) as agen:
|
||||
async for event in agen:
|
||||
yield event
|
||||
if ctx.should_pause_invocation(event):
|
||||
pause_invocation = True
|
||||
else:
|
||||
async with Aclosing(_merge_agent_run_pre_3_11(agent_runs)) as agen:
|
||||
async for event in agen:
|
||||
yield event
|
||||
if ctx.should_pause_invocation(event):
|
||||
pause_invocation = True
|
||||
merge_func = (
|
||||
_merge_agent_run
|
||||
if sys.version_info >= (3, 11)
|
||||
else _merge_agent_run_pre_3_11
|
||||
)
|
||||
|
||||
async with Aclosing(merge_func(agent_runs)) as agen:
|
||||
async for event in agen:
|
||||
yield event
|
||||
if ctx.should_pause_invocation(event):
|
||||
pause_invocation = True
|
||||
|
||||
if pause_invocation:
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user