# Event

data class Event(val id: String = Uuid.random(), val invocationId: String? = null, val author: String, val content: Content? = null, val actions: EventActions = EventActions(), val longRunningToolIds: Set<String> = emptySet(), val partial: Boolean = false, val turnComplete: Boolean = false, val errorCode: String? = null, val errorMessage: String? = null, val finishReason: FinishReason? = null, val usageMetadata: UsageMetadata? = null, val avgLogProbs: Double? = null, val interrupted: Boolean = false, val branch: String? = null, val groundingMetadata: GroundingMetadata? = null, val modelVersion: String? = null, val citationMetadata: CitationMetadata? = null, val customMetadata: Map<String, Any>? = null, val timestamp: Long = Clock.System.now().toEpochMilliseconds())

Represents an event in a session.

## Constructors

Event
Link copied to clipboard
constructor(id: String = Uuid.random(), invocationId: String? = null, author: String, content: Content? = null, actions: EventActions = EventActions(), longRunningToolIds: Set<String> = emptySet(), partial: Boolean = false, turnComplete: Boolean = false, errorCode: String? = null, errorMessage: String? = null, finishReason: FinishReason? = null, usageMetadata: UsageMetadata? = null, avgLogProbs: Double? = null, interrupted: Boolean = false, branch: String? = null, groundingMetadata: GroundingMetadata? = null, modelVersion: String? = null, citationMetadata: CitationMetadata? = null, customMetadata: Map<String, Any>? = null, timestamp: Long = Clock.System.now().toEpochMilliseconds())

## Properties

actions
Link copied to clipboard
val actions: EventActions

Optional actions associated with this event.

author
Link copied to clipboard
val author: String

The author of the event, it could be the name of the agent or "user" literal.

avgLogProbs
Link copied to clipboard
val avgLogProbs: Double? = null

The average log probabilities of the generated tokens.

branch
Link copied to clipboard
val branch: String? = null

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-agents shouldn't see their peer agents' conversation history.

citationMetadata
Link copied to clipboard
val citationMetadata: CitationMetadata? = null
content
Link copied to clipboard
val content: Content? = null

The content of the event.

customMetadata
Link copied to clipboard
val customMetadata: Map<String, Any>? = null
errorCode
Link copied to clipboard
val errorCode: String? = null

An error code if an error occurred during the event processing.

errorMessage
Link copied to clipboard
val errorMessage: String? = null

A human-readable error message if an error occurred.

finishReason
Link copied to clipboard
val finishReason: FinishReason? = null

The reason the LLM generation finished.

groundingMetadata
Link copied to clipboard
val groundingMetadata: GroundingMetadata? = null

The grounding metadata of the event.

id
Link copied to clipboard
val id: String

The event id.

interrupted
Link copied to clipboard
val interrupted: Boolean = false

True if the generation of this event was interrupted.

invocationId
Link copied to clipboard
val invocationId: String? = null

Id of the invocation that this event belongs to.

isFinalResponse
Link copied to clipboard
val isFinalResponse: Boolean

Returns true if this is a final response.

longRunningToolIds
Link copied to clipboard
val longRunningToolIds: Set<String>

Set of ids of the long running function calls. Agent client will know from this field about which function call is long running.

modelVersion
Link copied to clipboard
val modelVersion: String? = null

The model version used to generate the response.

partial
Link copied to clipboard
val partial: Boolean = false

True for incomplete chunks from the LLM streaming response. The last chunk's partial is false.

timestamp
Link copied to clipboard
val timestamp: Long

The timestamp of the event.

turnComplete
Link copied to clipboard
val turnComplete: Boolean = false

True if this event marks the completion of a turn.

usageMetadata
Link copied to clipboard
val usageMetadata: UsageMetadata? = null

Metadata about the token usage for the LLM call.

## Functions

functionCalls
Link copied to clipboard
fun functionCalls(): List<FunctionCall>

Returns all function calls from this event.

functionResponses
Link copied to clipboard
fun functionResponses(): List<FunctionResponse>

Returns all function responses from this event.

populateClientFunctionCallId
Link copied to clipboard
fun populateClientFunctionCallId(): Event

Scans a model response event's parts for function calls missing an ID and generates one for them.