Class Runner
java.lang.Object
com.google.adk.runner.Runner
- Direct Known Subclasses:
FirestoreDatabaseRunner, InMemoryRunner
The main class for the GenAI Agents runner.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsModifierConstructorDescriptionRunner(BaseAgent agent, String appName, BaseArtifactService artifactService, BaseSessionService sessionService) Deprecated.Runner(BaseAgent agent, String appName, BaseArtifactService artifactService, BaseSessionService sessionService, BaseMemoryService memoryService) Deprecated.UseRunner.Builderinstead.Runner(BaseAgent agent, String appName, BaseArtifactService artifactService, BaseSessionService sessionService, BaseMemoryService memoryService, List<? extends Plugin> plugins) Deprecated.UseRunner.Builderinstead.protectedRunner(BaseAgent agent, String appName, BaseArtifactService artifactService, BaseSessionService sessionService, BaseMemoryService memoryService, List<? extends Plugin> plugins, EventsCompactionConfig eventsCompactionConfig, ContextCacheConfig contextCacheConfig) Deprecated.UseRunner.Builderinstead. -
Method Summary
Modifier and TypeMethodDescriptionagent()appName()static Runner.Builderbuilder()io.reactivex.rxjava3.core.Completableclose()Closes all plugins, code executors, and releases any resources.io.reactivex.rxjava3.core.Flowable<Event> Deprecated, for removal: This API element is subject to removal in a future version.Use runAsync with sessionId.io.reactivex.rxjava3.core.Flowable<Event> runAsync(Session session, com.google.genai.types.Content newMessage, RunConfig runConfig, Map<String, Object> stateDelta) Deprecated, for removal: This API element is subject to removal in a future version.Use runAsync with sessionId.io.reactivex.rxjava3.core.Flowable<Event> io.reactivex.rxjava3.core.Flowable<Event> runAsync(String userId, String sessionId, com.google.genai.types.Content newMessage, RunConfig runConfig) io.reactivex.rxjava3.core.Flowable<Event> runAsync(String userId, String sessionId, com.google.genai.types.Content newMessage, RunConfig runConfig, Map<String, Object> stateDelta) Runs the agent with an invocation-based mode.protected io.reactivex.rxjava3.core.Flowable<Event> runAsyncImpl(Session session, com.google.genai.types.Content newMessage, RunConfig runConfig, Map<String, Object> stateDelta) Runs the agent asynchronously using a provided Session object.io.reactivex.rxjava3.core.Flowable<Event> runLive(Session session, LiveRequestQueue liveRequestQueue, RunConfig runConfig) Runs the agent in live mode, appending generated events to the session.io.reactivex.rxjava3.core.Flowable<Event> runLive(String userId, String sessionId, LiveRequestQueue liveRequestQueue, RunConfig runConfig) Retrieves the session and runs the agent in live mode.io.reactivex.rxjava3.core.Flowable<Event> runWithSessionId(String sessionId, com.google.genai.types.Content newMessage, RunConfig runConfig) Deprecated, for removal: This API element is subject to removal in a future version.
-
Constructor Details
-
Runner
@Deprecated public Runner(BaseAgent agent, String appName, BaseArtifactService artifactService, BaseSessionService sessionService, @Nullable BaseMemoryService memoryService) Deprecated.UseRunner.Builderinstead.Creates a newRunner. -
Runner
@Deprecated public Runner(BaseAgent agent, String appName, BaseArtifactService artifactService, BaseSessionService sessionService, @Nullable BaseMemoryService memoryService, List<? extends Plugin> plugins) Deprecated.UseRunner.Builderinstead.Creates a newRunnerwith a list of plugins. -
Runner
@Deprecated protected Runner(BaseAgent agent, String appName, BaseArtifactService artifactService, BaseSessionService sessionService, @Nullable BaseMemoryService memoryService, List<? extends Plugin> plugins, @Nullable EventsCompactionConfig eventsCompactionConfig, @Nullable ContextCacheConfig contextCacheConfig) Deprecated.UseRunner.Builderinstead.Creates a newRunnerwith a list of plugins. -
Runner
@Deprecated public Runner(BaseAgent agent, String appName, BaseArtifactService artifactService, BaseSessionService sessionService) Deprecated.UseRunner.Builderinstead.Creates a newRunner.
-
-
Method Details
-
builder
-
agent
-
appName
-
artifactService
-
sessionService
-
memoryService
-
pluginManager
-
close
public io.reactivex.rxjava3.core.Completable close()Closes all plugins, code executors, and releases any resources. -
runAsync
-
runAsync
public io.reactivex.rxjava3.core.Flowable<Event> runAsync(String userId, String sessionId, com.google.genai.types.Content newMessage, RunConfig runConfig, @Nullable Map<String, Object> stateDelta) Runs the agent with an invocation-based mode.TODO: make this the main implementation.
- Parameters:
userId- The ID of the user for the session.sessionId- The ID of the session to run the agent in.newMessage- The new message from the user to process.runConfig- Configuration for the agent run.stateDelta- Optional map of state updates to merge into the session for this run.- Returns:
- A Flowable stream of
Eventobjects generated by the agent during execution.
-
runAsync
-
runAsync
@Deprecated(since="0.4.0", forRemoval=true) public io.reactivex.rxjava3.core.Flowable<Event> runAsync(Session session, com.google.genai.types.Content newMessage, RunConfig runConfig) Deprecated, for removal: This API element is subject to removal in a future version.Use runAsync with sessionId. -
runAsync
@Deprecated(since="0.4.0", forRemoval=true) public io.reactivex.rxjava3.core.Flowable<Event> runAsync(Session session, com.google.genai.types.Content newMessage, RunConfig runConfig, @Nullable Map<String, Object> stateDelta) Deprecated, for removal: This API element is subject to removal in a future version.Use runAsync with sessionId.Runs the agent asynchronously using a provided Session object.- Parameters:
session- The session to run the agent in.newMessage- The new message from the user to process.runConfig- Configuration for the agent run.stateDelta- Optional map of state updates to merge into the session for this run.- Returns:
- A Flowable stream of
Eventobjects generated by the agent during execution.
-
runAsyncImpl
protected io.reactivex.rxjava3.core.Flowable<Event> runAsyncImpl(Session session, com.google.genai.types.Content newMessage, RunConfig runConfig, @Nullable Map<String, Object> stateDelta) Runs the agent asynchronously using a provided Session object.- Parameters:
session- The session to run the agent in.newMessage- The new message from the user to process.runConfig- Configuration for the agent run.stateDelta- Optional map of state updates to merge into the session for this run.- Returns:
- A Flowable stream of
Eventobjects generated by the agent during execution.
-
runLive
public io.reactivex.rxjava3.core.Flowable<Event> runLive(Session session, LiveRequestQueue liveRequestQueue, RunConfig runConfig) Runs the agent in live mode, appending generated events to the session.- Returns:
- stream of events from the agent.
-
runLive
public io.reactivex.rxjava3.core.Flowable<Event> runLive(String userId, String sessionId, LiveRequestQueue liveRequestQueue, RunConfig runConfig) Retrieves the session and runs the agent in live mode.- Returns:
- stream of events from the agent.
- Throws:
IllegalArgumentException- if the session is not found.
-
runWithSessionId
@Deprecated(since="0.5.0", forRemoval=true) public io.reactivex.rxjava3.core.Flowable<Event> runWithSessionId(String sessionId, com.google.genai.types.Content newMessage, RunConfig runConfig) Deprecated, for removal: This API element is subject to removal in a future version.Runs the agent asynchronously with a default user ID.- Returns:
- stream of generated events.
-
Runner.Builderinstead.