#[non_exhaustive]pub enum SessionEvent {
Message {
content: Vec<ContentBlock>,
seq: u64,
},
ToolUse {
tool_use_id: String,
name: String,
input: Value,
seq: u64,
},
CustomToolUse {
custom_tool_use_id: String,
name: String,
input: Value,
seq: u64,
},
McpToolUse {
tool_use_id: String,
name: String,
input: Value,
seq: u64,
},
StatusRunning {
seq: u64,
},
StatusIdle {
seq: u64,
stop_reason: Option<StopReason>,
usage: Option<UsageReport>,
},
Error {
code: String,
message: String,
seq: u64,
},
}Expand description
Agent-to-client event. Each carries a monotonic seq per session.
§Wire Shapes (CANON §3.4)
{"type": "agent.message", "content": [{"type": "text", "text": "Hi"}], "seq": 1}
{"type": "status.running", "seq": 2}
{"type": "status.idle", "seq": 3, "stop_reason": {"reason": "end_turn"}}§Example
use adk_managed::types::{SessionEvent, ContentBlock};
let event = SessionEvent::Message {
content: vec![ContentBlock::Text { text: "Hello".to_string() }],
seq: 1,
};
let json = serde_json::to_string(&event).unwrap();
assert!(json.contains(r#""type":"agent.message""#));
assert!(json.contains(r#""seq":1"#));Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Message
Assistant message content.
Fields
§
content: Vec<ContentBlock>The message content blocks.
ToolUse
Built-in tool invocation (executes server-side in sandbox).
Fields
CustomToolUse
Custom tool invocation (client must execute and return result).
The loop PARKS until user.custom_tool_result with matching ID arrives.
Fields
McpToolUse
MCP tool invocation.
Fields
StatusRunning
Session became active (processing a turn).
StatusIdle
Turn complete; awaiting next event.
Includes stop_reason to tell the caller WHY the turn ended,
and usage reporting token consumption for billing/metering.
Fields
§
stop_reason: Option<StopReason>Why the turn ended. Enables the client to decide what to do next.
§
usage: Option<UsageReport>Token usage for this turn (input/output/total).
Present when the LLM reports usage metadata; None on error turns.
Error
Error during execution.
Trait Implementations§
Source§impl Clone for SessionEvent
impl Clone for SessionEvent
Source§fn clone(&self) -> SessionEvent
fn clone(&self) -> SessionEvent
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SessionEvent
impl Debug for SessionEvent
Source§impl<'de> Deserialize<'de> for SessionEvent
impl<'de> Deserialize<'de> for SessionEvent
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for SessionEvent
impl RefUnwindSafe for SessionEvent
impl Send for SessionEvent
impl Sync for SessionEvent
impl Unpin for SessionEvent
impl UnsafeUnpin for SessionEvent
impl UnwindSafe for SessionEvent
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
Mutably borrows from an owned value. Read more