#[non_exhaustive]pub enum AgentEvent {
Show 32 variants
AgentStart {
prompts: Vec<Message>,
session_id: Option<String>,
},
AgentEnd {
messages: Vec<Message>,
stop_reason: Option<String>,
session_id: Option<String>,
},
TurnStart {
turn_number: u32,
},
TurnEnd {
turn_number: u32,
assistant_message: Message,
tool_results: Vec<ToolResultMessage>,
},
MessageStart {
message: Message,
},
MessageUpdate {
message: Message,
delta: Option<String>,
},
MessageEnd {
message: Message,
},
ToolExecutionStart {
tool_call_id: String,
tool_name: String,
args: Value,
},
ToolExecutionUpdate {
tool_call_id: String,
tool_name: String,
partial_result: String,
},
ToolExecutionEnd {
tool_call_id: String,
tool_name: String,
result: ToolResult,
is_error: bool,
},
Start {
prompt: String,
},
Thinking,
ThinkingDelta {
text: String,
},
TextChunk {
text: String,
},
ToolCall {
tool_call: ToolCall,
},
ToolStart {
tool_call_id: String,
tool_name: String,
arguments: Value,
},
ToolProgress {
tool_call_id: String,
message: String,
},
ToolComplete {
result: ToolResult,
},
ToolError {
tool_call_id: String,
error: String,
},
Complete {
content: String,
stop_reason: String,
},
Error {
message: String,
session_id: Option<String>,
},
Iteration {
number: usize,
},
Usage {
input_tokens: usize,
output_tokens: usize,
},
Compaction {
event: CompactionEvent,
},
Retry {
attempt: usize,
max_retries: usize,
retry_after_secs: u64,
reason: String,
session_id: Option<String>,
},
Fallback {
from_model: String,
to_model: String,
},
Cancelled,
PartialResponse {
content: String,
},
AutoRetryStart {
attempt: usize,
max_attempts: usize,
delay_ms: u64,
error_message: String,
},
AutoRetryEnd {
success: bool,
attempt: usize,
final_error: Option<String>,
},
SteeringMessage {
message: Message,
},
FollowUpMessage {
message: Message,
},
}Expand description
Events emitted during agent execution.
Events are tagged with type and serialized as camelCase for JSON consumers.
This enum is #[non_exhaustive] — new variants may be added in future releases.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
AgentStart
Emitted when the agent begins processing a batch of prompts.
Fields
AgentEnd
Emitted when the agent finishes all processing.
Fields
TurnStart
Emitted at the start of each agent loop turn.
TurnEnd
Emitted when a turn completes, including the assistant reply and tool results.
Fields
tool_results: Vec<ToolResultMessage>Tool results collected during this turn.
MessageStart
A new message has been created in the conversation.
MessageUpdate
A message has been updated with new content.
Fields
MessageEnd
A message has been finalized.
ToolExecutionStart
A tool is about to be executed.
Fields
ToolExecutionUpdate
Partial progress from a running tool execution.
Fields
ToolExecutionEnd
A tool execution has finished.
Fields
result: ToolResultThe tool result payload.
Start
Legacy: agent started processing a prompt.
Thinking
Agent is waiting for the first response token.
ThinkingDelta
Incremental thinking / reasoning text from the model.
TextChunk
A chunk of generated text from the model.
ToolCall
The model requested a tool call.
ToolStart
A tool execution has started.
Fields
ToolProgress
Progress update from a running tool.
Fields
ToolComplete
A tool execution has completed.
Fields
result: ToolResultThe tool result payload.
ToolError
A tool execution failed.
Complete
The agent produced a final response.
Error
An error occurred during agent execution.
Fields
Iteration
Agent loop iteration counter update.
Usage
Token usage report for a completed turn.
Fields
Compaction
Context compaction lifecycle event.
Fields
event: CompactionEventThe underlying compaction event detail.
Retry
The agent is retrying after a transient error.
Fields
Fallback
The agent switched to a fallback model.
Fields
Cancelled
The agent run was cancelled by the caller.
PartialResponse
A partial response delivered mid-stream (useful for UI rendering).
AutoRetryStart
An automatic retry attempt is starting.
Fields
AutoRetryEnd
An automatic retry attempt has concluded.
Fields
SteeringMessage
A system-level steering message injected into the conversation.
FollowUpMessage
A follow-up message appended to continue the conversation.
Implementations§
Source§impl AgentEvent
impl AgentEvent
Trait Implementations§
Source§impl Clone for AgentEvent
impl Clone for AgentEvent
Source§fn clone(&self) -> AgentEvent
fn clone(&self) -> AgentEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AgentEvent
impl Debug for AgentEvent
Source§impl<'de> Deserialize<'de> for AgentEvent
impl<'de> Deserialize<'de> for AgentEvent
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<AgentEvent, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<AgentEvent, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for AgentEvent
impl Serialize for AgentEvent
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 AgentEvent
impl RefUnwindSafe for AgentEvent
impl Send for AgentEvent
impl Sync for AgentEvent
impl Unpin for AgentEvent
impl UnsafeUnpin for AgentEvent
impl UnwindSafe for AgentEvent
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> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
self file descriptor. Read moreSource§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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more