From f64190446c154fe4aa82743db639793608bc4186 Mon Sep 17 00:00:00 2001 From: perseus <51974392+tcconnally@users.noreply.github.com> Date: Mon, 15 Jun 2026 15:21:36 -0500 Subject: [PATCH 1/2] fix: skip eval invocations without user content to prevent ValidationError When a session contains invocations without user-authored events, convert_events_to_eval_invocations() created an Invocation with an empty Content(parts=[]). This caused a Pydantic ValidationError because Invocation.user_content is typed as genai_types.Content (non-optional) and an empty Content with no parts triggered validation failure. Fix: skip invocations entirely when no user event is found in the event list, since evaluations without user input are not meaningful. Closes #3760 --- src/google/adk/evaluation/evaluation_generator.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/google/adk/evaluation/evaluation_generator.py b/src/google/adk/evaluation/evaluation_generator.py index e0e61fe758..7264c9dad6 100644 --- a/src/google/adk/evaluation/evaluation_generator.py +++ b/src/google/adk/evaluation/evaluation_generator.py @@ -672,6 +672,12 @@ def convert_events_to_eval_invocations( events_to_add.append(event) break + # Skip invocations without user content — evaluations without + # user input are not meaningful and would cause a Pydantic + # ValidationError on Invocation.user_content. + if not user_content.parts: + continue + invocation_events = [ InvocationEvent(author=e.author, content=e.content) for e in events_to_add From 9352f628df47473ce6bb9c008140e645900fe022 Mon Sep 17 00:00:00 2001 From: perseus <51974392+tcconnally@users.noreply.github.com> Date: Wed, 17 Jun 2026 18:39:59 +0000 Subject: [PATCH 2/2] fix: add None guard for user_content in eval event processing --- src/google/adk/evaluation/evaluation_generator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/google/adk/evaluation/evaluation_generator.py b/src/google/adk/evaluation/evaluation_generator.py index 7264c9dad6..c1e3227a29 100644 --- a/src/google/adk/evaluation/evaluation_generator.py +++ b/src/google/adk/evaluation/evaluation_generator.py @@ -675,7 +675,7 @@ def convert_events_to_eval_invocations( # Skip invocations without user content — evaluations without # user input are not meaningful and would cause a Pydantic # ValidationError on Invocation.user_content. - if not user_content.parts: + if not (user_content and user_content.parts): continue invocation_events = [