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) -
Method Summary
Modifier and TypeMethodDescriptionagent()
appName()
io.reactivex.rxjava3.core.Flowable
<Event> Runs the agent in the standard mode using a provided Session object.io.reactivex.rxjava3.core.Flowable
<Event> Asynchronously runs the agent for a given user and session, processing a new message and using a defaultRunConfig
.io.reactivex.rxjava3.core.Flowable
<Event> runAsync
(String userId, String sessionId, com.google.genai.types.Content newMessage, RunConfig runConfig) Runs the agent in the standard mode.io.reactivex.rxjava3.core.Flowable
<Event> runLive
(Session session, LiveRequestQueue liveRequestQueue, RunConfig runConfig) io.reactivex.rxjava3.core.Flowable
<Event> runLive
(String userId, String sessionId, LiveRequestQueue liveRequestQueue, RunConfig runConfig) io.reactivex.rxjava3.core.Flowable
<Event> runWithSessionId
(String sessionId, com.google.genai.types.Content newMessage, RunConfig runConfig)
-
Constructor Details
-
Runner
public Runner(BaseAgent agent, String appName, BaseArtifactService artifactService, BaseSessionService sessionService)
-
-
Method Details
-
agent
-
appName
-
artifactService
-
sessionService
-
runAsync
public io.reactivex.rxjava3.core.Flowable<Event> runAsync(String userId, String sessionId, com.google.genai.types.Content newMessage, RunConfig runConfig) Runs the agent in the standard mode.- 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.- Returns:
- A Flowable stream of
Event
objects generated by the agent during execution.
-
runAsync
public io.reactivex.rxjava3.core.Flowable<Event> runAsync(String userId, String sessionId, com.google.genai.types.Content newMessage) Asynchronously runs the agent for a given user and session, processing a new message and using a defaultRunConfig
.This method initiates an agent execution within the specified session, appending the provided new message to the session's history. It utilizes a default
RunConfig
to control execution parameters. The method returns a stream ofEvent
objects representing the agent's activity during the run.- Parameters:
userId
- The ID of the user initiating the session.sessionId
- The ID of the session in which the agent will run.newMessage
- The newContent
message to be processed by the agent.- Returns:
- A
Flowable
emittingEvent
objects generated by the agent.
-
runAsync
public io.reactivex.rxjava3.core.Flowable<Event> runAsync(Session session, com.google.genai.types.Content newMessage, RunConfig runConfig) Runs the agent in the standard mode 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.- Returns:
- A Flowable stream of
Event
objects generated by the agent during execution.
-
runLive
public io.reactivex.rxjava3.core.Flowable<Event> runLive(Session session, LiveRequestQueue liveRequestQueue, RunConfig runConfig) -
runLive
public io.reactivex.rxjava3.core.Flowable<Event> runLive(String userId, String sessionId, LiveRequestQueue liveRequestQueue, RunConfig runConfig) -
runWithSessionId
-