Skip to content

Commit bb4a7b5

Browse files
committed
feat: allow runAsync with null newMessage
1 parent 806e985 commit bb4a7b5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

core/src/main/java/com/google/adk/runner/Runner.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
import java.util.List;
5050
import java.util.Optional;
5151
import javax.annotation.Nullable;
52+
import org.jetbrains.annotations.NotNull;
5253

5354
/** The main class for the GenAI Agents runner. */
5455
public class Runner {
@@ -203,7 +204,8 @@ public Flowable<Event> runAsync(String userId, String sessionId, Content newMess
203204
* @param runConfig Configuration for the agent run.
204205
* @return A Flowable stream of {@link Event} objects generated by the agent during execution.
205206
*/
206-
public Flowable<Event> runAsync(Session session, Content newMessage, RunConfig runConfig) {
207+
public Flowable<Event> runAsync(
208+
@NotNull Session session, @Nullable Content newMessage, @NotNull RunConfig runConfig) {
207209
Span span = Telemetry.getTracer().spanBuilder("invocation").startSpan();
208210
try (Scope scope = span.makeCurrent()) {
209211
return Flowable.just(session)
@@ -213,7 +215,7 @@ public Flowable<Event> runAsync(Session session, Content newMessage, RunConfig r
213215
InvocationContext invocationContext =
214216
newInvocationContext(
215217
sess,
216-
Optional.of(newMessage),
218+
Optional.ofNullable(newMessage),
217219
/* liveRequestQueue= */ Optional.empty(),
218220
runConfig);
219221

0 commit comments

Comments
 (0)