pub struct Event {
pub id: String,
pub timestamp: DateTime<Utc>,
pub invocation_id: String,
pub branch: String,
pub author: String,
pub llm_response: LlmResponse,
pub actions: EventActions,
pub long_running_tool_ids: Vec<String>,
pub llm_request: Option<String>,
pub provider_metadata: HashMap<String, String>,
}Expand description
Event represents a single interaction in a conversation. This struct embeds LlmResponse to match ADK-Go’s design pattern.
Fields§
§id: String§timestamp: DateTime<Utc>§invocation_id: String§branch: String§llm_response: LlmResponseThe LLM response containing content and metadata.
Access content via event.llm_response.content.
actions: EventActions§long_running_tool_ids: Vec<String>IDs of long-running tools associated with this event.
llm_request: Option<String>LLM request data for UI display (JSON string)
provider_metadata: HashMap<String, String>Provider-specific metadata (e.g., GCP Vertex, Azure OpenAI). Keeps the core Event struct provider-agnostic.
Implementations§
Source§impl Event
impl Event
pub fn new(invocation_id: impl Into<String>) -> Self
Sourcepub fn with_id(id: impl Into<String>, invocation_id: impl Into<String>) -> Self
pub fn with_id(id: impl Into<String>, invocation_id: impl Into<String>) -> Self
Create an event with a specific ID. Use this for streaming events where all chunks should share the same event ID.
Sourcepub fn set_content(&mut self, content: Content)
pub fn set_content(&mut self, content: Content)
Convenience method to set content directly.
Sourcepub fn is_final_response(&self) -> bool
pub fn is_final_response(&self) -> bool
Returns whether the event is the final response of an agent.
An event is considered final if:
- It has skip_summarization set, OR
- It has long_running_tool_ids (indicating async operations), OR
- It has no function calls, no function responses, is not partial, and has no trailing code execution results.
Note: When multiple agents participate in one invocation, there could be multiple events with is_final_response() as true, for each participating agent.
Sourcepub fn function_call_ids(&self) -> Vec<String>
pub fn function_call_ids(&self) -> Vec<String>
Extracts function call IDs from this event’s content. Used to identify which function calls are associated with long-running tools.