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>,
}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§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.
Implementations§
Source§impl Event
impl Event
pub fn new(invocation_id: impl Into<String>) -> Event
Available on crate feature
sessions only.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>,
Deserialize this value from the given Serde deserializer. Read more
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,
Serialize this value into the given Serde serializer. Read more
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§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)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>
Wrap the input message
T in a tonic::Request