From 589f15cb273b1b83a87f0c3145880344ed5b1b91 Mon Sep 17 00:00:00 2001 From: Shangjie Chen Date: Wed, 17 Dec 2025 15:05:36 -0800 Subject: [PATCH] feat: Add an internal function name 'adk_framework' to allow passing function response to the framework but not poluting the agent context Co-authored-by: Shangjie Chen PiperOrigin-RevId: 845933584 --- src/google/adk/flows/llm_flows/contents.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/google/adk/flows/llm_flows/contents.py b/src/google/adk/flows/llm_flows/contents.py index fefa014c..39902e85 100644 --- a/src/google/adk/flows/llm_flows/contents.py +++ b/src/google/adk/flows/llm_flows/contents.py @@ -270,6 +270,7 @@ def _should_include_event_in_context( return not ( _contains_empty_content(event) or not _is_event_belongs_to_branch(current_branch, event) + or _is_adk_framework_event(event) or _is_auth_event(event) or _is_request_confirmation_event(event) ) @@ -656,6 +657,11 @@ def _is_request_confirmation_event(event: Event) -> bool: return _is_function_call_event(event, REQUEST_CONFIRMATION_FUNCTION_CALL_NAME) +def _is_adk_framework_event(event: Event) -> bool: + """Checks if the event is an ADK framework event.""" + return _is_function_call_event(event, 'adk_framework') + + def _is_live_model_audio_event_with_inline_data(event: Event) -> bool: """Check if the event is a live/bidi audio event with inline data.