From 4f54660d6de54ddde0fec6e09fdd68890ce657ca Mon Sep 17 00:00:00 2001 From: Google Team Member Date: Tue, 9 Dec 2025 14:47:57 -0800 Subject: [PATCH] fix: Update the code to work with either 1 event or more than 1 events Update the code to work with either 1 event or more than 1 events. PiperOrigin-RevId: 842406345 --- src/google/adk/agents/llm_agent.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/google/adk/agents/llm_agent.py b/src/google/adk/agents/llm_agent.py index 005d073c..5abaef58 100644 --- a/src/google/adk/agents/llm_agent.py +++ b/src/google/adk/agents/llm_agent.py @@ -469,10 +469,7 @@ class LlmAgent(BaseAgent): if ctx.is_resumable: events = ctx._get_events(current_invocation=True, current_branch=True) - if events and ( - ctx.should_pause_invocation(events[-1]) - or ctx.should_pause_invocation(events[-2]) - ): + if events and any(ctx.should_pause_invocation(e) for e in events[-2:]): return # Only yield an end state if the last event is no longer a long running # tool call.