# Class BaseLlmFlow

java.lang.Object
com.google.adk.flows.llmflows.BaseLlmFlow

All Implemented Interfaces:
  `BaseFlow`

Direct Known Subclasses:
  `SingleFlow`

public abstract class BaseLlmFlow extends Object implements BaseFlow
A basic flow that calls the LLM in a loop until a final response is generated.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final int`
  `maxSteps`
  `protected final List<RequestProcessor>`
  `requestProcessors`
  `protected final List<ResponseProcessor>`
  `responseProcessors`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `BaseLlmFlow(List<RequestProcessor> requestProcessors, List<ResponseProcessor> responseProcessors)`
  `BaseLlmFlow(List<RequestProcessor> requestProcessors, List<ResponseProcessor> responseProcessors, Optional<Integer> maxSteps)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected io.reactivex.rxjava3.core.Flowable<Event>`
  `postprocess(InvocationContext context, Event baseEventForLlmResponse, LlmRequest llmRequest, LlmResponse llmResponse, io.opentelemetry.context.Context parentContext)`
  Post-processes the LLM response after receiving it from the LLM.
  `io.reactivex.rxjava3.core.Flowable<Event>`
  `run(InvocationContext invocationContext)`
  Executes the full LLM flow by repeatedly calling `runOneStep(Context, InvocationContext)` until a final response is produced.
  `io.reactivex.rxjava3.core.Flowable<Event>`
  `runLive(InvocationContext invocationContext)`
  Executes the LLM flow in streaming mode.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### requestProcessors

    protected final List<RequestProcessor> requestProcessors

  - ### responseProcessors

    protected final List<ResponseProcessor> responseProcessors

  - ### maxSteps

    protected final int maxSteps

- ## Constructor Details

  - ### BaseLlmFlow

    public BaseLlmFlow(List<RequestProcessor> requestProcessors, List<ResponseProcessor> responseProcessors)

  - ### BaseLlmFlow

    public BaseLlmFlow(List<RequestProcessor> requestProcessors, List<ResponseProcessor> responseProcessors, Optional<Integer> maxSteps)

- ## Method Details

  - ### postprocess

    protected io.reactivex.rxjava3.core.Flowable<Event> postprocess(InvocationContext context, Event baseEventForLlmResponse, LlmRequest llmRequest, LlmResponse llmResponse, io.opentelemetry.context.Context parentContext)
    Post-processes the LLM response after receiving it from the LLM. Executes all registered `ResponseProcessor` instances. Emits events for the model response and any subsequent function calls.

  - ### run

    public io.reactivex.rxjava3.core.Flowable<Event> run(InvocationContext invocationContext)
    Executes the full LLM flow by repeatedly calling `runOneStep(Context, InvocationContext)` until a final response is produced.
    Specified by:
      `run` in interface `BaseFlow`
    Returns:
      A `Flowable` of all `Event`s generated during the flow.

  - ### runLive

    public io.reactivex.rxjava3.core.Flowable<Event> runLive(InvocationContext invocationContext)
    Executes the LLM flow in streaming mode.

    Handles sending history and live requests to the LLM, receiving responses, processing them, and managing agent transfers.

    Specified by:
      `runLive` in interface `BaseFlow`
    Returns:
      A `Flowable` of `Event`s streamed in real-time.