pub enum SdkMessage {
System {
subtype: SystemSubtype,
session_id: String,
data: Value,
},
Assistant {
content: Vec<ContentBlock>,
stop_reason: Option<String>,
},
User {
content: Vec<ContentBlock>,
},
Result {
subtype: ResultSubtype,
result: Option<String>,
total_cost_usd: Option<f64>,
usage: Option<UsageInfo>,
num_turns: u32,
session_id: String,
stop_reason: Option<String>,
},
}Expand description
Streamed message types in turn order.
Matches SystemMessage / AssistantMessage / UserMessage /
ResultMessage from the Claude Agent SDK. We do not emit StreamEvent
(token deltas) — the loop runs in non-streaming mode.
Variants§
System
Lifecycle event. Init carries session metadata.
Assistant
One assistant turn — text and/or tool_use blocks. The final assistant message in a successful run has no tool_use blocks.
User
One synthetic user turn carrying tool_result blocks back to the model.
Fields
§
content: Vec<ContentBlock>Result
Terminal message. result is Some only when subtype = Success.
Implementations§
Source§impl SdkMessage
impl SdkMessage
Sourcepub fn is_terminal(&self) -> bool
pub fn is_terminal(&self) -> bool
True for the terminal Result message.
Trait Implementations§
Source§impl Clone for SdkMessage
impl Clone for SdkMessage
Source§fn clone(&self) -> SdkMessage
fn clone(&self) -> SdkMessage
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 SdkMessage
impl Debug for SdkMessage
Source§impl<'de> Deserialize<'de> for SdkMessage
impl<'de> Deserialize<'de> for SdkMessage
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 SdkMessage
impl RefUnwindSafe for SdkMessage
impl Send for SdkMessage
impl Sync for SdkMessage
impl Unpin for SdkMessage
impl UnsafeUnpin for SdkMessage
impl UnwindSafe for SdkMessage
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