From c195b0b132f2c110e4af910ecfd2a7dd4f1ceaf2 Mon Sep 17 00:00:00 2001 From: wenhaozhao Date: Tue, 19 Aug 2025 13:58:41 +0800 Subject: [PATCH] feat: allow runAsync with null newMessage --- core/src/main/java/com/google/adk/runner/Runner.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/google/adk/runner/Runner.java b/core/src/main/java/com/google/adk/runner/Runner.java index 3595f912..ff1b2d0f 100644 --- a/core/src/main/java/com/google/adk/runner/Runner.java +++ b/core/src/main/java/com/google/adk/runner/Runner.java @@ -203,7 +203,8 @@ public Flowable runAsync(String userId, String sessionId, Content newMess * @param runConfig Configuration for the agent run. * @return A Flowable stream of {@link Event} objects generated by the agent during execution. */ - public Flowable runAsync(Session session, Content newMessage, RunConfig runConfig) { + public Flowable runAsync( + Session session, @Nullable Content newMessage, RunConfig runConfig) { Span span = Telemetry.getTracer().spanBuilder("invocation").startSpan(); try (Scope scope = span.makeCurrent()) { return Flowable.just(session) @@ -213,7 +214,7 @@ public Flowable runAsync(Session session, Content newMessage, RunConfig r InvocationContext invocationContext = newInvocationContext( sess, - Optional.of(newMessage), + Optional.ofNullable(newMessage), /* liveRequestQueue= */ Optional.empty(), runConfig);