Class Runner

java.lang.Object
com.google.adk.runner.Runner
Direct Known Subclasses:
InMemoryRunner

public class Runner extends Object
The main class for the GenAI Agents runner.
  • Constructor Details

  • Method Details

    • agent

      public BaseAgent agent()
    • appName

      public String appName()
    • artifactService

      public BaseArtifactService artifactService()
    • sessionService

      public BaseSessionService 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 default RunConfig.

      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 of Event 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 new Content message to be processed by the agent.
      Returns:
      A Flowable emitting Event 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

      public io.reactivex.rxjava3.core.Flowable<Event> runWithSessionId(String sessionId, com.google.genai.types.Content newMessage, RunConfig runConfig)