fix: Fix out of bounds error in _run_async_impl

PiperOrigin-RevId: 834492696
This commit is contained in:
Divyansh Shukla
2025-11-19 16:36:35 -08:00
committed by Copybara-Service
parent 679d543f8e
commit 8fc6128b62
+1 -4
View File
@@ -469,10 +469,7 @@ class LlmAgent(BaseAgent):
if ctx.is_resumable: if ctx.is_resumable:
events = ctx._get_events(current_invocation=True, current_branch=True) events = ctx._get_events(current_invocation=True, current_branch=True)
if events and ( if any(ctx.should_pause_invocation(e) for e in events[-2:]):
ctx.should_pause_invocation(events[-1])
or ctx.should_pause_invocation(events[-2])
):
return return
# Only yield an end state if the last event is no longer a long running # Only yield an end state if the last event is no longer a long running
# tool call. # tool call.