Skip to content

Commit 31db039

Browse files
google-genai-botcopybara-github
authored andcommitted
fix: Make BaseMemoryService nullable in Runner
This change allows the Runner to be constructed and used even if a BaseMemoryService is not provided, which is the default as of now. PiperOrigin-RevId: 795476217
1 parent 0099e5f commit 31db039

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,22 +48,23 @@
4848
import java.util.Collections;
4949
import java.util.List;
5050
import java.util.Optional;
51+
import org.checkerframework.checker.nullness.qual.Nullable;
5152

5253
/** The main class for the GenAI Agents runner. */
5354
public class Runner {
5455
private final BaseAgent agent;
5556
private final String appName;
5657
private final BaseArtifactService artifactService;
5758
private final BaseSessionService sessionService;
58-
private final BaseMemoryService memoryService;
59+
private final @Nullable BaseMemoryService memoryService;
5960

6061
/** Creates a new {@code Runner}. */
6162
public Runner(
6263
BaseAgent agent,
6364
String appName,
6465
BaseArtifactService artifactService,
6566
BaseSessionService sessionService,
66-
BaseMemoryService memoryService) {
67+
@Nullable BaseMemoryService memoryService) {
6768
this.agent = agent;
6869
this.appName = appName;
6970
this.artifactService = artifactService;
@@ -103,7 +104,7 @@ public BaseSessionService sessionService() {
103104
return this.sessionService;
104105
}
105106

106-
public BaseMemoryService memoryService() {
107+
public @Nullable BaseMemoryService memoryService() {
107108
return this.memoryService;
108109
}
109110

0 commit comments

Comments
 (0)