# 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.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `Event.Builder`
  Builder for `Event`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `EventActions`
  `actions()`
  `String`
  `author()`
  The author of the event, it could be the name of the agent or "user" literal.
  `Optional<Double>`
  `avgLogprobs()`
  `Optional<String>`
  `branch()`
  The branch of the event.
  `void`
  `branch(@Nullable String branch)`
  Sets the branch for this event.
  `static Event.Builder`
  `builder()`
  `Optional<com.google.genai.types.Content>`
  `content()`
  `Optional<List<com.google.genai.types.CustomMetadata>>`
  `customMetadata()`
  The custom metadata of the event.
  `boolean`
  `equals(Object obj)`
  `Optional<com.google.genai.types.FinishReason>`
  `errorCode()`
  `Optional<String>`
  `errorMessage()`
  `final boolean`
  `finalResponse()`
  Returns true if this is a final response.
  `Optional<com.google.genai.types.FinishReason>`
  `finishReason()`
  `static Event`
  `fromJson(String json)`
  Parses an event from a JSON string.
  `final com.google.common.collect.ImmutableList<com.google.genai.types.FunctionCall>`
  `functionCalls()`
  Returns all function calls from this event.
  `final com.google.common.collect.ImmutableList<com.google.genai.types.FunctionResponse>`
  `functionResponses()`
  Returns all function responses from this event.
  `static String`
  `generateEventId()`
  `Optional<com.google.genai.types.GroundingMetadata>`
  `groundingMetadata()`
  The grounding metadata of the event.
  `int`
  `hashCode()`
  `final boolean`
  `hasTrailingCodeExecutionResult()`
  Returns whether the event has a trailing code execution result.
  `String`
  `id()`
  The event id.
  `Optional<com.google.genai.types.Transcription>`
  `inputTranscription()`
  Input transcription.
  `Optional<Boolean>`
  `interrupted()`
  `String`
  `invocationId()`
  Id of the invocation that this event belongs to.
  `Optional<Set<String>>`
  `longRunningToolIds()`
  Set of ids of the long running function calls.
  `Optional<String>`
  `modelVersion()`
  The model version used to generate the response.
  `Optional<com.google.genai.types.Transcription>`
  `outputTranscription()`
  Output transcription.
  `Optional<Boolean>`
  `partial()`
  partial is true for incomplete chunks from the LLM streaming response.
  `void`
  `setActions(EventActions actions)`
  `void`
  `setAuthor(String author)`
  `void`
  `setAvgLogprobs(@Nullable Double avgLogprobs)`
  `void`
  `setContent(@Nullable com.google.genai.types.Content content)`
  `void`
  `setCustomMetadata(@Nullable List<com.google.genai.types.CustomMetadata> customMetadata)`
  `void`
  `setErrorCode(@Nullable com.google.genai.types.FinishReason errorCode)`
  `void`
  `setErrorMessage(@Nullable String errorMessage)`
  `void`
  `setFinishReason(@Nullable com.google.genai.types.FinishReason finishReason)`
  `void`
  `setFinishReason(Optional<com.google.genai.types.FinishReason> finishReason)`
  Deprecated.
  `void`
  `setGroundingMetadata(@Nullable com.google.genai.types.GroundingMetadata groundingMetadata)`
  `void`
  `setId(String id)`
  `void`
  `setInputTranscription(@Nullable com.google.genai.types.Transcription inputTranscription)`
  `void`
  `setInterrupted(@Nullable Boolean interrupted)`
  `void`
  `setInvocationId(String invocationId)`
  `void`
  `setLongRunningToolIds(@Nullable Set<String> longRunningToolIds)`
  `void`
  `setModelVersion(@Nullable String modelVersion)`
  `void`
  `setOutputTranscription(@Nullable com.google.genai.types.Transcription outputTranscription)`
  `void`
  `setPartial(@Nullable Boolean partial)`
  `void`
  `setTimestamp(long timestamp)`
  `void`
  `setTurnComplete(@Nullable Boolean turnComplete)`
  `void`
  `setUsageMetadata(@Nullable com.google.genai.types.GenerateContentResponseUsageMetadata usageMetadata)`
  `final String`
  `stringifyContent()`
  Converts the event content into a readable string.
  `long`
  `timestamp()`
  The timestamp of the event.
  `Event.Builder`
  `toBuilder()`
  Creates a builder pre-filled with this event's values.
  `String`
  `toString()`
  `Optional<Boolean>`
  `turnComplete()`
  `Optional<com.google.genai.types.GenerateContentResponseUsageMetadata>`
  `usageMetadata()`

  ### Methods inherited from class JsonBaseModel

  `fromJsonNode, fromJsonString, getMapper, toJson, toJsonNode, toJsonString`
  Modifier and Type
  Method
  Description
  `static <T extends JsonBaseModel>
  T`
  `fromJsonNode(com.fasterxml.jackson.databind.JsonNode jsonNode, Class<T> clazz)`
  Deserializes a JsonNode to an object of the given type.
  `static <T extends JsonBaseModel>
  T`
  `fromJsonString(String jsonString, Class<T> clazz)`
  Deserializes a Json string to an object of the given type.
  `static com.fasterxml.jackson.databind.ObjectMapper`
  `getMapper()`
  Returns the mutable ObjectMapper instance used by ADK.
  `String`
  `toJson()`
  Serializes this object (i.e., the ObjectMappper instance used by ADK) to a Json string.
  `protected static com.fasterxml.jackson.databind.JsonNode`
  `toJsonNode(Object object)`
  Serializes an object to a JsonNode.
  `static String`
  `toJsonString(Object object)`
  Serializes an object to a Json string.

  ### Methods inherited from class Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## 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(@Nullable 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(@Nullable 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(@Nullable Boolean partial)

  - ### turnComplete

    public Optional<Boolean> turnComplete()

  - ### setTurnComplete

    public void setTurnComplete(@Nullable Boolean turnComplete)

  - ### errorCode

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

  - ### finishReason

    public Optional<com.google.genai.types.FinishReason> finishReason()

  - ### setErrorCode

    public void setErrorCode(@Nullable com.google.genai.types.FinishReason errorCode)

  - ### setFinishReason

    @Deprecated public void setFinishReason(Optional<com.google.genai.types.FinishReason> finishReason)
    Deprecated.

  - ### setFinishReason

    public void setFinishReason(@Nullable com.google.genai.types.FinishReason finishReason)

  - ### errorMessage

    public Optional<String> errorMessage()

  - ### setErrorMessage

    public void setErrorMessage(@Nullable String errorMessage)

  - ### usageMetadata

    public Optional<com.google.genai.types.GenerateContentResponseUsageMetadata> usageMetadata()

  - ### setUsageMetadata

    public void setUsageMetadata(@Nullable com.google.genai.types.GenerateContentResponseUsageMetadata usageMetadata)

  - ### avgLogprobs

    public Optional<Double> avgLogprobs()

  - ### setAvgLogprobs

    public void setAvgLogprobs(@Nullable Double avgLogprobs)

  - ### interrupted

    public Optional<Boolean> interrupted()

  - ### setInterrupted

    public void setInterrupted(@Nullable 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)
    Sets the branch for this event.

    Format: agentA.agentB.agentC — shows hierarchy of nested agents.

    Parameters:
      `branch` - Branch identifier.

  - ### groundingMetadata

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

  - ### setGroundingMetadata

    public void setGroundingMetadata(@Nullable com.google.genai.types.GroundingMetadata groundingMetadata)

  - ### customMetadata

    public Optional<List<com.google.genai.types.CustomMetadata>> customMetadata()
    The custom metadata of the event.

  - ### setCustomMetadata

    public void setCustomMetadata(@Nullable List<com.google.genai.types.CustomMetadata> customMetadata)

  - ### modelVersion

    public Optional<String> modelVersion()
    The model version used to generate the response.

  - ### setModelVersion

    public void setModelVersion(@Nullable String modelVersion)

  - ### inputTranscription

    public Optional<com.google.genai.types.Transcription> inputTranscription()
    Input transcription. The transcription is independent to the model turn which means it doesn't imply any ordering between transcription and model turn.

  - ### setInputTranscription

    public void setInputTranscription(@Nullable com.google.genai.types.Transcription inputTranscription)

  - ### outputTranscription

    public Optional<com.google.genai.types.Transcription> outputTranscription()
    Output transcription. The transcription is independent to the model turn which means it doesn't imply any ordering between transcription and model turn.

  - ### setOutputTranscription

    public void setOutputTranscription(@Nullable com.google.genai.types.Transcription outputTranscription)

  - ### 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()
    Returns all function calls from this event.

  - ### functionResponses

    public final com.google.common.collect.ImmutableList<com.google.genai.types.FunctionResponse> functionResponses()
    Returns all function responses from this event.

  - ### hasTrailingCodeExecutionResult

    public final boolean hasTrailingCodeExecutionResult()
    Returns whether the event has a trailing code execution result.

  - ### finalResponse

    public final boolean finalResponse()
    Returns true if this is a final response.

  - ### stringifyContent

    public final String stringifyContent()
    Converts the event content into a readable string.

    Includes text, function calls, and responses.

    Returns:
      Stringified content.

  - ### builder

    public static Event.Builder builder()

  - ### fromJson

    public static Event fromJson(String json)
    Parses an event from a JSON string.

  - ### toBuilder

    public Event.Builder toBuilder()
    Creates a builder pre-filled with this event's values.

  - ### equals

    public boolean equals(Object obj)
    Overrides:
      `equals` in class `Object`

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`