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

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

Link copied to clipboard

Optional actions associated with this event.

Link copied to clipboard

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

Link copied to clipboard
val avgLogProbs: Double? = null

The average log probabilities of the generated tokens.

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.

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

The content of the event.

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

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

Link copied to clipboard
val errorMessage: String? = null

A human-readable error message if an error occurred.

Link copied to clipboard

The reason the LLM generation finished.

Link copied to clipboard

The grounding metadata of the event.

Link copied to clipboard
val id: String

The event id.

Link copied to clipboard
val interrupted: Boolean = false

True if the generation of this event was interrupted.

Link copied to clipboard
val invocationId: String? = null

Id of the invocation that this event belongs to.

Link copied to clipboard

Returns true if this is a final response.

Link copied to clipboard

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

Link copied to clipboard
val modelVersion: String? = null

The model version used to generate the response.

Link copied to clipboard
val partial: Boolean = false

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

Link copied to clipboard

The timestamp of the event.

Link copied to clipboard
val turnComplete: Boolean = false

True if this event marks the completion of a turn.

Link copied to clipboard

Metadata about the token usage for the LLM call.

Functions

Link copied to clipboard

Returns all function calls from this event.

Link copied to clipboard

Returns all function responses from this event.

Link copied to clipboard

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