Skip to content
Merged
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
8 changes: 3 additions & 5 deletions src/google/adk/agents/invocation_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,9 +396,7 @@ def should_pause_invocation(self, event: Event) -> bool:

return False

def has_unresolved_long_running_tool_calls(
self, events: list[Event]
) -> bool:
def has_unresolved_long_running_tool_calls(self, events: list[Event]) -> bool:
"""Returns whether any long-running tool call in events is unresolved."""
if not self.is_resumable or not events:
return False
Expand All @@ -407,7 +405,7 @@ def has_unresolved_long_running_tool_calls(
function_response.id
for event in events
for function_response in event.get_function_responses()
if function_response.id
if function_response.id and event.author == 'user'
}

for event in reversed(events):
Expand All @@ -417,7 +415,7 @@ def has_unresolved_long_running_tool_calls(
paused_function_call_ids = {
function_call.id
for function_call in event.get_function_calls()
if function_call.id in event.long_running_tool_ids
if event.long_running_tool_ids and function_call.id in event.long_running_tool_ids
}
if paused_function_call_ids - function_response_ids:
return True
Expand Down