pub enum AgentMessage {
Show 16 variants
Text {
message_id: String,
chunk: String,
is_complete: bool,
model_name: String,
},
Thought {
message_id: String,
chunk: String,
is_complete: bool,
model_name: String,
},
ToolCall {
request: ToolCallRequest,
model_name: String,
},
ToolCallUpdate {
tool_call_id: String,
chunk: String,
model_name: String,
},
ToolProgress {
request: ToolCallRequest,
progress: f64,
total: Option<f64>,
message: Option<String>,
},
ToolResult {
result: ToolCallResult,
result_meta: Option<ToolResultMeta>,
model_name: String,
},
ToolError {
error: ToolCallError,
model_name: String,
},
Error {
message: String,
},
Cancelled {
message: String,
},
ContextCompactionStarted {
message_count: usize,
},
ContextCompactionResult {
summary: String,
messages_removed: usize,
},
ContextUsageUpdate {
usage_ratio: Option<f64>,
context_limit: Option<u32>,
input_tokens: u32,
output_tokens: u32,
cache_read_tokens: Option<u32>,
cache_creation_tokens: Option<u32>,
reasoning_tokens: Option<u32>,
total_input_tokens: u64,
total_output_tokens: u64,
total_cache_read_tokens: u64,
total_cache_creation_tokens: u64,
total_reasoning_tokens: u64,
},
AutoContinue {
attempt: u32,
max_attempts: u32,
},
ModelSwitched {
previous: String,
new: String,
},
ContextCleared,
Done,
}Expand description
Message from the agent to the user.
Variants§
Text
Thought
ToolCall
ToolCallUpdate
ToolProgress
ToolResult
ToolError
Error
Cancelled
ContextCompactionStarted
Context compaction has been triggered.
ContextCompactionResult
Context was compacted to reduce token usage.
ContextUsageUpdate
Context usage update for UI display.
Fields
AutoContinue
Agent is auto-continuing because LLM stopped with a resumable stop reason.
ModelSwitched
The model was successfully switched.
ContextCleared
The agent context was cleared and reset to its blank state.
Done
Implementations§
Trait Implementations§
Source§impl Clone for AgentMessage
impl Clone for AgentMessage
Source§fn clone(&self) -> AgentMessage
fn clone(&self) -> AgentMessage
Returns a duplicate of the value. Read more
1.0.0 · 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 AgentMessage
impl Debug for AgentMessage
Source§impl<'de> Deserialize<'de> for AgentMessage
impl<'de> Deserialize<'de> for AgentMessage
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
Source§impl From<&AgentMessage> for SubAgentEvent
impl From<&AgentMessage> for SubAgentEvent
Source§fn from(msg: &AgentMessage) -> Self
fn from(msg: &AgentMessage) -> Self
Converts to this type from the input type.
Source§impl PartialEq for AgentMessage
impl PartialEq for AgentMessage
Source§impl Serialize for AgentMessage
impl Serialize for AgentMessage
impl StructuralPartialEq for AgentMessage
Auto Trait Implementations§
impl Freeze for AgentMessage
impl RefUnwindSafe for AgentMessage
impl Send for AgentMessage
impl Sync for AgentMessage
impl Unpin for AgentMessage
impl UnsafeUnpin for AgentMessage
impl UnwindSafe for AgentMessage
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