Class Event

java.lang.Object
com.google.adk.JsonBaseModel
com.google.adk.events.Event

public class Event extends JsonBaseModel
Represents an event in a session.
  • Method Details

    • generateEventId

      public static String generateEventId()
    • id

      public String id()
      The event id.
    • setId

      public void setId(String id)
    • invocationId

      public String invocationId()
      Id of the invocation that this event belongs to.
    • setInvocationId

      public void setInvocationId(String invocationId)
    • author

      public String author()
      The author of the event, it could be the name of the agent or "user" literal.
    • setAuthor

      public void setAuthor(String author)
    • content

      public Optional<com.google.genai.types.Content> content()
    • setContent

      public void setContent(Optional<com.google.genai.types.Content> content)
    • actions

      public EventActions actions()
    • setActions

      public void setActions(EventActions actions)
    • longRunningToolIds

      public Optional<Set<String>> longRunningToolIds()
      Set of ids of the long running function calls. Agent client will know from this field about which function call is long running.
    • setLongRunningToolIds

      public void setLongRunningToolIds(Optional<Set<String>> longRunningToolIds)
    • partial

      public Optional<Boolean> partial()
      partial is true for incomplete chunks from the LLM streaming response. The last chunk's partial is False.
    • setPartial

      public void setPartial(Optional<Boolean> partial)
    • turnComplete

      public Optional<Boolean> turnComplete()
    • setTurnComplete

      public void setTurnComplete(Optional<Boolean> turnComplete)
    • errorCode

      public Optional<com.google.genai.types.FinishReason> errorCode()
    • setErrorCode

      public void setErrorCode(Optional<com.google.genai.types.FinishReason> errorCode)
    • errorMessage

      public Optional<String> errorMessage()
    • setErrorMessage

      public void setErrorMessage(Optional<String> errorMessage)
    • interrupted

      public Optional<Boolean> interrupted()
    • setInterrupted

      public void setInterrupted(Optional<Boolean> interrupted)
    • branch

      public Optional<String> branch()
      The branch of the event. The format is like agent_1.agent_2.agent_3, where agent_1 is the parent of agent_2, and agent_2 is the parent of agent_3. Branch is used when multiple sub-agent shouldn't see their peer agents' conversation history.
    • branch

      public void branch(@Nullable String branch)
    • branch

      public void branch(Optional<String> branch)
    • groundingMetadata

      public Optional<com.google.genai.types.GroundingMetadata> groundingMetadata()
      The grounding metadata of the event.
    • setGroundingMetadata

      public void setGroundingMetadata(Optional<com.google.genai.types.GroundingMetadata> groundingMetadata)
    • timestamp

      public long timestamp()
      The timestamp of the event.
    • setTimestamp

      public void setTimestamp(long timestamp)
    • functionCalls

      public final com.google.common.collect.ImmutableList<com.google.genai.types.FunctionCall> functionCalls()
    • functionResponses

      public final com.google.common.collect.ImmutableList<com.google.genai.types.FunctionResponse> functionResponses()
    • finalResponse

      public final boolean finalResponse()
    • stringifyContent

      public final String stringifyContent()
    • builder

      public static Event.Builder builder()
    • fromJson

      public static Event fromJson(String json)
    • toBuilder

      public Event.Builder toBuilder()
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object