Class Runner
java.lang.Object
com.google.adk.runner.Runner
- Direct Known Subclasses:
InMemoryRunner
The main class for the GenAI Agents runner.
-
Constructor Summary
ConstructorsConstructorDescriptionRunner(BaseAgent agent, String appName, BaseArtifactService artifactService, BaseSessionService sessionService) Deprecated.Runner(BaseAgent agent, String appName, BaseArtifactService artifactService, BaseSessionService sessionService, BaseMemoryService memoryService) Creates a newRunner.Runner(BaseAgent agent, String appName, BaseArtifactService artifactService, BaseSessionService sessionService, BaseMemoryService memoryService, List<BasePlugin> plugins) Creates a newRunnerwith a list of plugins. -
Method Summary
Modifier and TypeMethodDescriptionagent()appName()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.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) Runs the agent asynchronously with a default user ID.
-
Constructor Details
-
Runner
public Runner(BaseAgent agent, String appName, BaseArtifactService artifactService, BaseSessionService sessionService, @Nullable BaseMemoryService memoryService) Creates a newRunner. -
Runner
public Runner(BaseAgent agent, String appName, BaseArtifactService artifactService, BaseSessionService sessionService, @Nullable BaseMemoryService memoryService, List<BasePlugin> plugins) Creates a newRunnerwith a list of plugins. -
Runner
@InlineMe(replacement="this(agent, appName, artifactService, sessionService, null)") @Deprecated public Runner(BaseAgent agent, String appName, BaseArtifactService artifactService, BaseSessionService sessionService) Deprecated.Use the constructor withBaseMemoryServiceinstead even if with a null if you don't need the memory service.Creates a newRunner.
-
-
Method Details
-
agent
-
appName
-
artifactService
-
sessionService
-
memoryService
-
pluginManager
-
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.
-
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
-
BaseMemoryServiceinstead even if with a null if you don't need the memory service.