pub struct Event {
pub id: String,
pub timestamp: DateTime<Utc>,
pub invocation_id: String,
pub invocation_id_camel: 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 gcp_llm_request: Option<String>,
pub gcp_llm_response: Option<String>,
}Expand description
Core traits and types.
Always available regardless of feature flags. Includes:
Agent- The fundamental trait for all agentsTool/Toolset- For extending agents with capabilitiesSession/State- For managing conversation contextEvent- For streaming agent responsesAdkError/Result- Unified error handling 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§invocation_id_camel: StringCamel case version for UI compatibility
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)
gcp_llm_request: Option<String>GCP Vertex Agent LLM request (for UI compatibility)
gcp_llm_response: Option<String>GCP Vertex Agent LLM response (for UI compatibility)
Implementations§
Source§impl Event
impl Event
pub fn new(invocation_id: impl Into<String>) -> Event
sessions only.Sourcepub fn with_id(id: impl Into<String>, invocation_id: impl Into<String>) -> Event
Available on crate feature sessions only.
pub fn with_id(id: impl Into<String>, invocation_id: impl Into<String>) -> Event
sessions only.Create an event with a specific ID. Use this for streaming events where all chunks should share the same event ID.
Sourcepub fn content(&self) -> Option<&Content>
Available on crate feature sessions only.
pub fn content(&self) -> Option<&Content>
sessions only.Convenience method to access content directly.
Sourcepub fn set_content(&mut self, content: Content)
Available on crate feature sessions only.
pub fn set_content(&mut self, content: Content)
sessions only.Convenience method to set content directly.
Sourcepub fn is_final_response(&self) -> bool
Available on crate feature sessions only.
pub fn is_final_response(&self) -> bool
sessions only.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>
Available on crate feature sessions only.
pub fn function_call_ids(&self) -> Vec<String>
sessions only.Extracts function call IDs from this event’s content. Used to identify which function calls are associated with long-running tools.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Event
impl<'de> Deserialize<'de> for Event
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Event, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Event, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for Event
impl Serialize for Event
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for Event
impl RefUnwindSafe for Event
impl Send for Event
impl Sync for Event
impl Unpin for Event
impl UnwindSafe for Event
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request