Class ConversationPreprocessor

java.lang.Object
com.google.adk.a2a.converters.ConversationPreprocessor

public final class ConversationPreprocessor extends Object
Preprocesses a batch of ADK events prior to invoking a remote A2A agent.

The class splits the conversation into two logical buckets:

  • The historical session events that should be preserved as-is when relayed over the wire.
  • The most recent user-authored text event, surfaced separately so it can be supplied as the pending user input on the InvocationContext.

This mirrors the Python A2A implementation where the in-flight user message is maintained separately from the persisted transcript.

**EXPERIMENTAL:** Subject to change, rename, or removal in any future patch release. Do not use in production code.

  • Method Details

    • extractHistoryAndUserContent

      public static ConversationPreprocessor.PreparedInput extractHistoryAndUserContent(List<Event> inputEvents)
      Splits the provided event list into history and the latest user-authored text message.
      Parameters:
      inputEvents - ordered session events, oldest to newest; may be null
      Returns:
      container encapsulating the derived history, optional user content, and the original user event when present